[llvm] [LoongArch] Allow delayed decision for ADD/SUB relocations (PR #72960)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 09:37:18 PST 2024


nathanchance wrote:

While https://github.com/llvm/llvm-project/commit/0731567a31e4ade97c27801045156a88c4589704 does appear to address the vDSO error, as I note on its pull request, that change has other issues.

Additionally, this change (a8081ed8ff0fd11fb8d5f4c83df49da909e49612) has an assertion failure that I only uncovered when working around the vDSO error (as that causes the build to error quite early):

```
clang: /home/nathan/cbl/src/llvm-project/llvm/include/llvm/MC/MCSymbol.h:270: MCSection &llvm::MCSymbol::getSection() const: Assertion `isInSection() && "Invalid accessor!"' failed.
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: /mnt/nvme/tmp/build/llvm-project/final/bin/clang --target=loongarch64-linux-gnusf -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument -fmacro-prefix-map== -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mabi=lp64s -pipe -msoft-float -fno-builtin-memcpy -fno-builtin-memmove -fno-builtin-memset -fno-asynchronous-unwind-tables -mstrict-align -fno-delete-null-pointer-checks -O2 -fstack-protector-strong -fomit-frame-pointer -ftrivial-auto-var-init=zero -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wframe-larger-than=2048 -Wno-gnu -Wno-unused-but-set-variable -Wno-unused-const-variable -Wvla -Wno-pointer-sign -Wcast-function-type -Wimplicit-fallthrough -Werror=date-time -Werror=incompatible-pointer-types -Wenum-conversion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-format-overflow -Wno-format-truncation -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -Wno-unaligned-access -Wno-cast-function-type-strict -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-initializer-overrides -Wno-sign-compare -fdirect-access-external-data -fPIE -nostdinc -Iarch/loongarch/include -I./arch/loongarch/include/generated -Iinclude -I./include -Iarch/loongarch/include/uapi -I./arch/loongarch/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0x9000000000200000 -isystem /mnt/nvme/tmp/build/llvm-project/final/lib/clang/18/include -I net/ipv4 -I ./net/ipv4 -DKBUILD_MODFILE=\"net/ipv4/xfrm4_output\" -DKBUILD_BASENAME=\"xfrm4_output\" -DKBUILD_MODNAME=\"xfrm4_output\" -D__KBUILD_MODNAME=kmod_xfrm4_output -c -Wp,-MMD,net/ipv4/.xfrm4_output.o.d -fcolor-diagnostics -o net/ipv4/xfrm4_output.o net/ipv4/xfrm4_output.c
1.	<eof> parser at end of file
2.	Code generation
 #0 0x0000557cdd3f9f38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x31faf38)
 #1 0x0000557cdd3f7b6e llvm::sys::RunSignalHandlers() (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x31f8b6e)
 #2 0x0000557cdd37cf06 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f1c2dd5f710 (/usr/lib/libc.so.6+0x3e710)
 #4 0x00007f1c2ddaf83c (/usr/lib/libc.so.6+0x8e83c)
 #5 0x00007f1c2dd5f668 gsignal (/usr/lib/libc.so.6+0x3e668)
 #6 0x00007f1c2dd474b8 abort (/usr/lib/libc.so.6+0x264b8)
 #7 0x00007f1c2dd473dc (/usr/lib/libc.so.6+0x263dc)
 #8 0x00007f1c2dd57d26 (/usr/lib/libc.so.6+0x36d26)
 #9 0x0000557cdc2f52fb llvm::LoongArchAsmBackend::handleAddSubRelocations(llvm::MCAsmLayout const&, llvm::MCFragment const&, llvm::MCFixup const&, llvm::MCValue const&, unsigned long&) const LoongArchAsmBackend.cpp:0:0
#10 0x0000557cdd164eb1 llvm::MCAssembler::layout(llvm::MCAsmLayout&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2f65eb1)
#11 0x0000557cdd1656f6 llvm::MCAssembler::Finish() (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2f666f6)
#12 0x0000557cdd185e25 llvm::MCELFStreamer::finishImpl() (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2f86e25)
#13 0x0000557cde21e914 llvm::AsmPrinter::doFinalization(llvm::Module&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x401f914)
#14 0x0000557cdcf4b9ba llvm::FPPassManager::doFinalization(llvm::Module&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2d4c9ba)
#15 0x0000557cdcf44600 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2d45600)
#16 0x0000557cddb8dcb5 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x398ecb5)
#17 0x0000557cddbb25c1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x39b35c1)
#18 0x0000557cdee7de76 clang::ParseAST(clang::Sema&, bool, bool) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x4c7ee76)
#19 0x0000557cddfb8a2f clang::FrontendAction::Execute() (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3db9a2f)
#20 0x0000557cddf29f7d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3d2af7d)
#21 0x0000557cde083028 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3e84028)
#22 0x0000557cdc287b42 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2088b42)
#23 0x0000557cdc283f6d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#24 0x0000557cddd836c9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
#25 0x0000557cdd37cc86 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x317dc86)
#26 0x0000557cddd82de2 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3b83de2)
#27 0x0000557cddd3dfb7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3b3efb7)
#28 0x0000557cddd3e4f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3b3f4f7)
#29 0x0000557cddd5e539 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x3b5f539)
#30 0x0000557cdc283426 clang_main(int, char**, llvm::ToolContext const&) (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2084426)
#31 0x0000557cdc294281 main (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2095281)
#32 0x00007f1c2dd48cd0 (/usr/lib/libc.so.6+0x27cd0)
#33 0x00007f1c2dd48d8a __libc_start_main (/usr/lib/libc.so.6+0x27d8a)
#34 0x0000557cdc280525 _start (/mnt/nvme/tmp/build/llvm-project/final/bin/clang+0x2081525)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
ClangBuiltLinux clang version 18.0.0git (https://github.com/llvm/llvm-project a8081ed8ff0fd11fb8d5f4c83df49da909e49612)
Target: loongarch64-unknown-linux-gnusf
Thread model: posix
InstalledDir: /mnt/nvme/tmp/build/llvm-project/final/bin
```

Luckily, that issue appears to be addressed by https://github.com/llvm/llvm-project/pull/76433 as well, so getting that merged would be good (I didn't bother with a reproducer due to this but I can come up with one if desired).

https://github.com/llvm/llvm-project/pull/72960


More information about the llvm-commits mailing list