[compiler-rt] [libcxx] [lld] [llvm] CodeGen: Optionally emit PAuth relocations as IRELATIVE relocations. (PR #133533)
Harald van Dijk via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 10:55:06 PST 2025
hvdijk wrote:
Mentioning the details in here rather than in #171648 where I noticed it:
When the test is updated to use `aarch64-linux-gnu`, it does not gracefully error out, it crashes instead. To reproduce the problem easily:
```console
$ ninja llc && bin/llvm-lit -sv /path/to/llvm-project/llvm/test/CodeGen/AArch64/ptrauth-reloc.ll && bin/llc -mtriple aarch64-linux-gnu -mattr=+pauth -o - test/CodeGen/AArch64/Output/ptrauth-reloc.ll.tmp/ok.ll
[...]
.Lpauth_ifunc2:
adrp x0, :got:g
ldr x0, [x0, :got_lo12:g]
add x0, x0, llc: /path/to/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp:1337: void llvm::AArch64InstPrinter::printAddSubImm(const llvm::MCInst*, unsigned int, const llvm::MCSubtargetInfo&, llvm::raw_ostream&): Assertion `Val == MO.getImm() && "Add/sub immediate out of range!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: bin/llc -mtriple aarch64-linux-gnu -mattr=+pauth -o - test/CodeGen/AArch64/Output/ptrauth-reloc.ll.tmp/ok.ll
#0 0x00007f9412515748 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /path/to/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:22
#1 0x00007f9412515c0c PrintStackTraceSignalHandler(void*) /path/to/llvm-project/llvm/lib/Support/Unix/Signals.inc:916:1
#2 0x00007f9412513148 llvm::sys::RunSignalHandlers() /path/to/llvm-project/llvm/lib/Support/Signals.cpp:104:20
#3 0x00007f94125150b1 SignalHandler(int, siginfo_t*, void*) /path/to/llvm-project/llvm/lib/Support/Unix/Signals.inc:426:14
#4 0x00007f9410e49df0 (/lib/x86_64-linux-gnu/libc.so.6+0x3fdf0)
#5 0x00007f9410e9e95c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0x00007f9410e49cc2 raise ./signal/../sysdeps/posix/raise.c:27:6
#7 0x00007f9410e324ac abort ./stdlib/abort.c:81:3
#8 0x00007f9410e32420 __assert_perror_fail ./assert/assert-perr.c:31:1
#9 0x00007f94170f3593 llvm::AArch64InstPrinter::printAddSubImm(llvm::MCInst const*, unsigned int, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) /path/to/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp:1339:49
#10 0x00007f94170dfcbf llvm::AArch64InstPrinter::printInstruction(llvm::MCInst const*, unsigned long, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) /path/to/llvm-project/build/x86_64-linux-debug/lib/Target/AArch64/AArch64GenAsmWriter.inc:21906:5
#11 0x00007f94170f0b48 llvm::AArch64InstPrinter::printInst(llvm::MCInst const*, unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) /path/to/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp:377:18
#12 0x00007f9415ba08cd llvm::MCTargetStreamer::prettyPrintAsm(llvm::MCInstPrinter&, unsigned long, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) /path/to/llvm-project/llvm/lib/MC/MCStreamer.cpp:1159:24
#13 0x00007f9415b15dcb (anonymous namespace)::MCAsmStreamer::emitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) /path/to/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp:2460:40
#14 0x00007f9416cbe7b8 emitAddress(llvm::MCStreamer&, llvm::MCRegister, llvm::MCExpr const*, bool, llvm::MCSubtargetInfo const&) /path/to/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp:2377:32
#15 0x00007f9416cbed75 (anonymous namespace)::AArch64AsmPrinter::emitPAuthRelocationAsIRelative(llvm::MCExpr const*, unsigned long, llvm::AArch64PACKey::ID, bool, bool, llvm::MCExpr const*) /path/to/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp:2509:3
#16 0x00007f9416cbf858 (anonymous namespace)::AArch64AsmPrinter::lowerConstantPtrAuth(llvm::ConstantPtrAuth const&) /path/to/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp:2602:54
#17 0x00007f94139c1317 llvm::AsmPrinter::lowerConstant(llvm::Constant const*, llvm::Constant const*, unsigned long) /path/to/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3650:32
#18 0x00007f9416cc6e60 (anonymous namespace)::AArch64AsmPrinter::lowerConstant(llvm::Constant const*, llvm::Constant const*, unsigned long) /path/to/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp:3935:54
#19 0x00007f94139c42aa emitGlobalConstantImpl(llvm::DataLayout const&, llvm::Constant const*, llvm::AsmPrinter&, llvm::Constant const*, unsigned long, llvm::DenseMap<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>>>*) /path/to/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:4313:57
#20 0x00007f94139c43f5 llvm::AsmPrinter::emitGlobalConstant(llvm::DataLayout const&, llvm::Constant const*, llvm::DenseMap<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>>>*) /path/to/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:4329:27
#21 0x00007f94139b2429 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) /path/to/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:932:7
#22 0x00007f94139bc54e llvm::AsmPrinter::doFinalization(llvm::Module&) /path/to/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2707:34
#23 0x00007f9412866fcf llvm::FPPassManager::doFinalization(llvm::Module&) /path/to/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1462:13
#24 0x00007f9412867569 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /path/to/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1549:13
#25 0x00007f9412862a8a llvm::legacy::PassManagerImpl::run(llvm::Module&) /path/to/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:13
#26 0x00007f9412867b05 llvm::legacy::PassManager::run(llvm::Module&) /path/to/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1641:1
#27 0x0000559b200ed7f7 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /path/to/llvm-project/llvm/tools/llc/llc.cpp:851:34
#28 0x0000559b200eac99 main /path/to/llvm-project/llvm/tools/llc/llc.cpp:450:35
#29 0x00007f9410e33ca8 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#30 0x00007f9410e33d65 call_init ./csu/../csu/libc-start.c:128:20
#31 0x00007f9410e33d65 __libc_start_main ./csu/../csu/libc-start.c:347:5
#32 0x0000559b200e9651 _start (bin/llc+0x16651)
Aborted (core dumped)
```
https://github.com/llvm/llvm-project/pull/133533
More information about the llvm-commits
mailing list