[llvm] 821cd6a - [Object] Handle SHT_CREL relocation sections when resolving relocation data (#141843)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 13:47:23 PDT 2025
Author: Zequan Wu
Date: 2025-05-29T16:47:20-04:00
New Revision: 821cd6aa77233b4659fafca5b2d63432ae32610c
URL: https://github.com/llvm/llvm-project/commit/821cd6aa77233b4659fafca5b2d63432ae32610c
DIFF: https://github.com/llvm/llvm-project/commit/821cd6aa77233b4659fafca5b2d63432ae32610c.diff
LOG: [Object] Handle SHT_CREL relocation sections when resolving relocation data (#141843)
Fixes #141680
Added:
llvm/test/tools/llvm-dwarfdump/X86/debug_info_crel.test
Modified:
llvm/lib/Object/RelocationResolver.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp
index a28f5943c320d..8cf748aa5681c 100644
--- a/llvm/lib/Object/RelocationResolver.cpp
+++ b/llvm/lib/Object/RelocationResolver.cpp
@@ -888,7 +888,8 @@ uint64_t resolveRelocation(RelocationResolver Resolver, const RelocationRef &R,
return Elf64BEObj->getRelSection(R.getRawDataRefImpl())->sh_type;
};
- if (GetRelSectionType() == ELF::SHT_RELA) {
+ if (GetRelSectionType() == ELF::SHT_RELA ||
+ GetRelSectionType() == ELF::SHT_CREL) {
Addend = getELFAddend(R);
// LoongArch and RISCV relocations use both LocData and Addend.
if (Obj->getArch() != Triple::loongarch32 &&
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_info_crel.test b/llvm/test/tools/llvm-dwarfdump/X86/debug_info_crel.test
new file mode 100644
index 0000000000000..f1a4dbc699166
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_info_crel.test
@@ -0,0 +1,5 @@
+# Test llvm-dwarfdump handles CREL relocation sections correctly.
+RUN: echo "void foo(){}" | clang++ --target=x86_64-pc-linux -Wa,--crel,--allow-experimental-crel -g -c -x c++ - -o %t
+RUN: llvm-dwarfdump --debug-info %t | FileCheck %s
+
+CHECK: DW_AT_producer ("clang version
More information about the llvm-commits
mailing list