With our Clang-15 arm64 CI this test-case crashes when compiling the test program: ``` user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/c/calling-conventions/ms_abi.c Unexpected callee-save save/restore opcode! UNREACHABLE executed at /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:1129! PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501_build/bin/clang -g -O0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -arch arm64 -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/lldb-build/tools/lldb/include -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/c/calling-conventions -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info -Werror=ignored-attributes -MT ms_abi.o -MD -MP -MF ms_abi.d -c -o ms_abi.o /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/c/calling-conventions/ms_abi.c 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module '/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/c/calling-conventions/ms_abi.c'. 4. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@func' Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 clang-15 0x0000000105d512b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 clang-15 0x0000000105d500e4 llvm::sys::RunSignalHandlers() + 112 2 clang-15 0x0000000105d507c4 llvm::sys::CleanupOnSignal(unsigned long) + 232 3 clang-15 0x0000000105c79d78 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 128 4 clang-15 0x0000000105c79f94 CrashRecoverySignalHandler(int) + 124 5 libsystem_platform.dylib 0x0000000185ecba24 _sigtramp + 56 6 libsystem_pthread.dylib 0x0000000185e9ccc0 pthread_kill + 288 7 libsystem_c.dylib 0x0000000185daca40 abort + 180 8 clang-15 0x0000000105c88508 llvm::install_out_of_memory_new_handler() + 0 9 clang-15 0x0000000104af7404 fixupCalleeSaveRestoreStackOffset(llvm::MachineInstr&, unsigned long long, bool, bool*) + 0 10 clang-15 0x0000000104af53e0 llvm::AArch64FrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const + 3564 ```
93 lines
3.6 KiB
Python
93 lines
3.6 KiB
Python
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
from lldbsuite.test_event.build_exception import BuildError
|
|
|
|
|
|
class TestCase(TestBase):
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
def build_and_run(self, test_file):
|
|
"""
|
|
Tries building the given test source and runs to the first breakpoint.
|
|
Returns false if the file fails to build due to an unsupported calling
|
|
convention on the current test target. Returns true if building and
|
|
running to the breakpoint succeeded.
|
|
"""
|
|
try:
|
|
self.build(
|
|
dictionary={
|
|
"C_SOURCES": test_file,
|
|
"CFLAGS_EXTRAS": "-Werror=ignored-attributes",
|
|
}
|
|
)
|
|
except BuildError as e:
|
|
# Test source failed to build. Check if it failed because the
|
|
# calling convention argument is unsupported/unknown in which case
|
|
# the test should be skipped.
|
|
error_msg = str(e)
|
|
# Clang gives an explicit error when a calling convention is
|
|
# not supported.
|
|
if "calling convention is not supported for this target" in error_msg:
|
|
return False
|
|
# GCC's has two different generic warnings it can emit.
|
|
if "attribute ignored" in error_msg:
|
|
return False
|
|
if "attribute directive ignored " in error_msg:
|
|
return False
|
|
# We got a different build error, so raise it again to fail the
|
|
# test.
|
|
raise
|
|
lldbutil.run_to_source_breakpoint(
|
|
self, "// break here", lldb.SBFileSpec(test_file)
|
|
)
|
|
return True
|
|
|
|
@skipIf(compiler="clang", compiler_version=["<", "9.0"])
|
|
def test_regcall(self):
|
|
if not self.build_and_run("regcall.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|
|
|
|
@skipIf(compiler="clang", compiler_version=["<", "17.0"], archs=["arm64"])
|
|
@skipIf(compiler="clang", compiler_version=["<", "9.0"])
|
|
def test_ms_abi(self):
|
|
if not self.build_and_run("ms_abi.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|
|
|
|
@skipIf(compiler="clang", compiler_version=["<", "9.0"])
|
|
def test_stdcall(self):
|
|
if not self.build_and_run("stdcall.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|
|
|
|
# Fails on x86, passes elsewhere because clang doesn't support vectorcall on
|
|
# any other architectures.
|
|
@expectedFailureAll(
|
|
triple=re.compile("^(x86|i386)"),
|
|
oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56084"
|
|
)
|
|
def test_vectorcall(self):
|
|
if not self.build_and_run("vectorcall.c"):
|
|
return
|
|
self.expect_expr("func(1.0)", result_type="int", result_value="1")
|
|
|
|
@skipIf(compiler="clang", compiler_version=["<", "9.0"])
|
|
def test_fastcall(self):
|
|
if not self.build_and_run("fastcall.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|
|
|
|
@skipIf(compiler="clang", compiler_version=["<", "9.0"])
|
|
def test_pascal(self):
|
|
if not self.build_and_run("pascal.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|
|
|
|
def test_sysv_abi(self):
|
|
if not self.build_and_run("sysv_abi.c"):
|
|
return
|
|
self.expect_expr("func(1, 2, 3, 4)", result_type="int", result_value="10")
|