[lld] r248731 - Don't include fully resolved relocations in the dynamic relocation table.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 13:18:40 PDT 2015
Author: rafael
Date: Mon Sep 28 15:18:40 2015
New Revision: 248731
URL: http://llvm.org/viewvc/llvm-project?rev=248731&view=rev
Log:
Don't include fully resolved relocations in the dynamic relocation table.
Added:
lld/trunk/test/elf2/Inputs/dynamic-reloc.s
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/elf2/dynamic-reloc.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=248731&r1=248730&r2=248731&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Sep 28 15:18:40 2015
@@ -243,7 +243,8 @@ void Writer<ELFT>::scanRelocs(
if (Body->isInGot())
continue;
GotSec.addEntry(Body);
- }
+ } else if (!isa<SharedSymbol<ELFT>>(Body))
+ continue;
Body->setUsedInDynamicReloc();
RelaDynSec.addReloc({C, RI});
}
Added: lld/trunk/test/elf2/Inputs/dynamic-reloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/Inputs/dynamic-reloc.s?rev=248731&view=auto
==============================================================================
--- lld/trunk/test/elf2/Inputs/dynamic-reloc.s (added)
+++ lld/trunk/test/elf2/Inputs/dynamic-reloc.s Mon Sep 28 15:18:40 2015
@@ -0,0 +1,2 @@
+.global main
+main:
Modified: lld/trunk/test/elf2/dynamic-reloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc.s?rev=248731&r1=248730&r2=248731&view=diff
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc.s (original)
+++ lld/trunk/test/elf2/dynamic-reloc.s Mon Sep 28 15:18:40 2015
@@ -1,7 +1,8 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc.s -o %t3.o
// RUN: lld -flavor gnu2 -shared %t2.o -o %t2.so
-// RUN: lld -flavor gnu2 %t.o %t2.so -o %t
+// RUN: lld -flavor gnu2 %t.o %t3.o %t2.so -o %t
// RUN: llvm-readobj -dynamic-table -r --expand-relocs -s %t | FileCheck %s
// REQUIRES: x86
@@ -56,3 +57,4 @@
.global _start
_start:
.quad bar + 0x42
+call main
More information about the llvm-commits
mailing list