Don't write preemptible symbol values to the .got.
It is not necessary and matches what bfd and gold do. This was a regression from r315658. llvm-svn: 321023
This commit is contained in:
parent
8c023a9cd9
commit
4c74feffd4
|
@ -846,7 +846,7 @@ template <class ELFT> static void addGotEntry(Symbol &Sym, bool Preemptible) {
|
|||
//
|
||||
// This is ugly -- the difference between REL and RELA should be
|
||||
// handled in a better way. It's a TODO.
|
||||
if (!Config->IsRela)
|
||||
if (!Config->IsRela && !Preemptible)
|
||||
InX::Got->Relocations.push_back({R_ABS, Target->GotRel, Off, 0, &Sym});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=i386-pc-linux
|
||||
# RUN: ld.lld %t.o -o %t.so -shared
|
||||
# RUN: llvm-readobj --relocations --symbols --sections --section-data %t.so | FileCheck %s
|
||||
# RUN: llvm-readobj --relocations --sections --section-data %t.so | FileCheck %s
|
||||
|
||||
# Check that the value of a preemptible symbol is written to the got
|
||||
# entry when using Elf_Rel. It is not clear why that is required, but
|
||||
# freebsd i386 seems to depend on it.
|
||||
# Check that the value of a preemptible symbol is not written to the
|
||||
# got entry when using Elf_Rel. It is not needed since the dynamic
|
||||
# linker will write the final value.
|
||||
|
||||
# CHECK: Name: .got
|
||||
# CHECK-NEXT: Type: SHT_PROGBITS
|
||||
|
@ -20,14 +20,11 @@
|
|||
# CHECK-NEXT: AddressAlignment:
|
||||
# CHECK-NEXT: EntrySize:
|
||||
# CHECK-NEXT: SectionData (
|
||||
# CHECK-NEXT: 0000: 00200000
|
||||
# CHECK-NEXT: 0000: 00000000
|
||||
# CHECK-NEXT: )
|
||||
|
||||
# CHECK: R_386_GLOB_DAT bar 0x0
|
||||
|
||||
# CHECK: Name: bar
|
||||
# CHECK-NEXT: Value: 0x2000
|
||||
|
||||
movl bar@GOT(%eax), %eax
|
||||
|
||||
.data
|
||||
|
|
Loading…
Reference in New Issue