llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.61k stars 11.82k forks source link

[AArch64]clang-13: error: unable to execute command: Segmentation fault (core dumped) #103009

Open yundemuren opened 2 months ago

yundemuren commented 2 months ago
  1. Program arguments: /home/fast/tools/llvm-13/bin/clang-13 -cc1 -triple aarch64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name tls.c -mrelocation-model static -mframe-pointer=non-leaf -fmath-errno -fno-rounding-math -no-integrated-as -mconstructor-aliases -target-cpu generic -target-feature +neon -target-feature +strict-align -target-abi aapcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fno-dwarf-directory-asm -fcoverage-compilation-dir=/home/fast/sel4test/cbuild -nostdsysteminc -nobuiltininc -resource-dir /home/fast/tools/llvm-13/lib/clang/13.0.1 -I ... ... -D __KERNEL_64 -Wno-sizeof-pointer-div -Wno-constant-logical-operand -Wno-sizeof-pointer-div -Wno-constant-logical-operand -std=gnu11 -fdebug-compilation-dir=/home/fast/sel4test/cbuild -ferror-limit 19 -ftls-model=local-exec -fno-signed-char -fgnuc-version=4.2.1 -mllvm -global-isel=0 -DGCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/tls-cae81b.s -x c /home/fast/sel4test/projects/sel4test/apps/sel4test-tests/src/tests/tls.c
  2. parser at end of file
  3. Code generation
  4. Running pass 'Function Pass Manager' on module '/home/fast/sel4test/projects/sel4test/apps/sel4test-tests/src/tests/tls.c'.
  5. Running pass 'AArch64 Assembly Printer' on function '@simple_tls_test_thread'

    0 0x000000000262af73 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/fast/tools/llvm-13/bin/clang-13+0x262af73)

    1 0x0000000002628f6e llvm::sys::RunSignalHandlers() (/home/fast/tools/llvm-13/bin/clang-13+0x2628f6e)

    2 0x000000000262b2ff SignalHandler(int) Signals.cpp:0:0

    3 0x00007f68e7ecd980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)

    4 0x0000000000b97456 llvm::AArch64InstPrinter::printOperand(llvm::MCInst const*, unsigned int, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/home/fast/tools/llvm-13/bin/clang-13+0xb97456)

    5 0x0000000000b94dd2 llvm::AArch64InstPrinter::printInstruction(llvm::MCInst const*, unsigned long, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/home/fast/tools/llvm-13/bin/clang-13+0xb94dd2)

    6 0x0000000000ba4ab2 llvm::AArch64InstPrinter::printInst(llvm::MCInst const*, unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/home/fast/tools/llvm-13/bin/clang-13+0xba4ab2)

    7 0x00000000022f11b4 llvm::MCTargetStreamer::prettyPrintAsm(llvm::MCInstPrinter&, unsigned long, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/home/fast/tools/llvm-13/bin/clang-13+0x22f11b4)

    8 0x00000000022b2dd2 (anonymous namespace)::MCAsmStreamer::emitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) MCAsmStreamer.cpp:0:0

    9 0x0000000000a052db (anonymous namespace)::AArch64AsmPrinter::emitInstruction(llvm::MachineInstr const*) AArch64AsmPrinter.cpp:0:0

    10 0x00000000030a1fdf llvm::AsmPrinter::emitFunctionBody() (/home/fast/tools/llvm-13/bin/clang-13+0x30a1fdf)

    11 0x0000000000a02522 (anonymous namespace)::AArch64AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) AArch64AsmPrinter.cpp:0:0

    12 0x0000000001b8db9e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/fast/tools/llvm-13/bin/clang-13+0x1b8db9e)

    13 0x0000000001f4098d llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/fast/tools/llvm-13/bin/clang-13+0x1f4098d)

    14 0x0000000001f47823 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/fast/tools/llvm-13/bin/clang-13+0x1f47823)

    15 0x0000000001f41104 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/fast/tools/llvm-13/bin/clang-13+0x1f41104)

    16 0x0000000002852f4b (anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) BackendUtil.cpp:0:0

    17 0x000000000284c9e7 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) (/home/fast/tools/llvm-13/bin/clang-13+0x284c9e7)

    18 0x0000000003399f3e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/fast/tools/llvm-13/bin/clang-13+0x3399f3e)

    19 0x0000000003f535c4 clang::ParseAST(clang::Sema&, bool, bool) (/home/fast/tools/llvm-13/bin/clang-13+0x3f535c4)

    20 0x0000000002df15e9 clang::FrontendAction::Execute() (/home/fast/tools/llvm-13/bin/clang-13+0x2df15e9)

    21 0x0000000002d65c66 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/fast/tools/llvm-13/bin/clang-13+0x2d65c66)

    22 0x0000000002e98c2c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/fast/tools/llvm-13/bin/clang-13+0x2e98c2c)

    23 0x00000000009f8283 cc1_main(llvm::ArrayRef<char const>, char const, void*) (/home/fast/tools/llvm-13/bin/clang-13+0x9f8283)

    24 0x00000000009f6288 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0

    25 0x00000000009f6046 main (/home/fast/tools/llvm-13/bin/clang-13+0x9f6046)

    26 0x00007f68e6959c87 __libc_start_main /build/glibc-uZu3wS/glibc-2.27/csu/../csu/libc-start.c:344:0

    27 0x00000000009f302a _start (/home/fast/tools/llvm-13/bin/clang-13+0x9f302a)

    clang-13: error: unable to execute command: Segmentation fault (core dumped) clang-13: error: clang frontend command failed due to signal (use -v to see invocation) clang version 13.0.1 Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin clang-13: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: tls-7e736c_C.txt tls-7e736c_SH.txt

Preprocessed source(s) and associated run script(s) are located at: clang-13: note: diagnostic msg: /tmp/tls-3356a4.c clang-13: note: diagnostic msg: /tmp/tls-3356a4.sh clang-13: note: diagnostic msg:

yundemuren commented 2 months ago

Additionally, the above error seems to be related to the funciton call "__sync_add_and_fetch".

Sirraide commented 2 months ago

Er, Clang 13 is several versions out-of-date. We only really do bug fixes for the latest release (which is soon to be 19). Have you tried using a more recent version of Clang?

EugeneZelenko commented 2 months ago

https://godbolt.org should be helpful.

yundemuren commented 2 months ago

Er, Clang 13 is several versions out-of-date. We only really do bug fixes for the latest release (which is soon to be 19). Have you tried using a more recent version of Clang?

Before Clang 13, I tried to use clang-18 version and the following errors happened at the time of compiling the first C source file. error-0

error-1

So I use the lower version clang13.0 and the only problem is above,.when committing the funciton call "__sync_add_and_fetch", the project was built well.

yundemuren commented 2 months ago

https://godbolt.org should be helpful.

Thanks. I will try.

yundemuren commented 2 months ago

I download the newest version clang 18.1.8. The following error still happened. clang18 error

Sirraide commented 2 months ago

I mean, that looks like something is choking on the contents of some assembly file. We don’t normally output assembly as an intermediate step so I don’t think it’s a file that we’re producing, but I might be wrong about that.

yundemuren commented 2 months ago

I am confused. For me ,which version do we choose will be better. Please help me. To solve it do you need other more information?