[PATCH] D62052: [ELF] -r: fix R_*_NONE to section symbols on Elf*_Rel targets
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 07:10:09 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD361036: [ELF] -r: fix R_*_NONE to section symbols on Elf*_Rel targets (authored by MaskRay, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D62052?vs=200027&id=200040#toc
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62052/new/
https://reviews.llvm.org/D62052
Files:
ELF/InputSection.cpp
test/ELF/relocation-none-arm.s
test/ELF/relocation-none-i386.s
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -470,7 +470,7 @@
if (RelTy::IsRela)
P->r_addend = Sym.getVA(Addend) - Section->getOutputSection()->Addr;
- else if (Config->Relocatable)
+ else if (Config->Relocatable && Type != Target->NoneRel)
Sec->Relocations.push_back({R_ABS, Type, Rel.r_offset, Addend, &Sym});
}
}
Index: test/ELF/relocation-none-i386.s
===================================================================
--- test/ELF/relocation-none-i386.s
+++ test/ELF/relocation-none-i386.s
@@ -8,6 +8,13 @@
# CHECK: .data
# CHECK: There are no relocations in this file.
+# RUN: ld.lld -r %t.o -o %t
+# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
+
+# RELOC: Section ({{.*}}) .rel.text {
+# RELOC-NEXT: 0x0 R_386_NONE .data 0x0
+# RELOC-NEXT: }
+
.globl _start
_start:
ret
Index: test/ELF/relocation-none-arm.s
===================================================================
--- test/ELF/relocation-none-arm.s
+++ test/ELF/relocation-none-arm.s
@@ -8,6 +8,13 @@
# CHECK: .data
# CHECK: There are no relocations in this file.
+# RUN: ld.lld -r %t.o -o %t
+# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
+
+# RELOC: Section ({{.*}}) .rel.text {
+# RELOC-NEXT: 0x0 R_ARM_NONE .data 0x0
+# RELOC-NEXT: }
+
.globl _start
_start:
nop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62052.200040.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/3dace7b6/attachment.bin>
More information about the llvm-commits
mailing list