Skip to content

Commit 821cd6a

Browse files
authored
[Object] Handle SHT_CREL relocation sections when resolving relocation data (#141843)
Fixes #141680
1 parent a0d699a commit 821cd6a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

llvm/lib/Object/RelocationResolver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,8 @@ uint64_t resolveRelocation(RelocationResolver Resolver, const RelocationRef &R,
888888
return Elf64BEObj->getRelSection(R.getRawDataRefImpl())->sh_type;
889889
};
890890

891-
if (GetRelSectionType() == ELF::SHT_RELA) {
891+
if (GetRelSectionType() == ELF::SHT_RELA ||
892+
GetRelSectionType() == ELF::SHT_CREL) {
892893
Addend = getELFAddend(R);
893894
// LoongArch and RISCV relocations use both LocData and Addend.
894895
if (Obj->getArch() != Triple::loongarch32 &&
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Test llvm-dwarfdump handles CREL relocation sections correctly.
2+
RUN: echo "void foo(){}" | clang++ --target=x86_64-pc-linux -Wa,--crel,--allow-experimental-crel -g -c -x c++ - -o %t
3+
RUN: llvm-dwarfdump --debug-info %t | FileCheck %s
4+
5+
CHECK: DW_AT_producer ("clang version

0 commit comments

Comments
 (0)