[lld] r327248 - For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 07:27:57 PDT 2018


I've put some details in pr36555. In summary the location of the
_GLOBAL_OFFSET_TABLE_ for Arm needs to be the base of the .got and not
the .got.plt. In ld and gold the symbol is defined with respect to the
InputSection .got.plt, but due to .got.plt and .got being combined
into a single .got output section with .got.plt first the
_GLOBAL_OFFSET_TABLE_ will be defined at the base of the .got and the
test program is relying on that. I'll resubmit the patch next week.

On 16 March 2018 at 09:58, Peter Smith <peter.smith at linaro.org> wrote:
> Thanks for letting me know, and for the test case. I'll take a look
> and see what I can do. I'm going to be at a conference in Hong Kong
> next week, travelling today so it may be sometime next week before I
> can update.
>
> Peter
>
> On 16 March 2018 at 01:09, Peter Collingbourne <peter at pcc.me.uk> wrote:
>> Hi Peter,
>>
>> Unfortunately I had to revert this change in r327688 because it breaks ARM
>> code that uses a combination of R_ARM_REL32 on _GLOBAL_OFFSET_TABLE_ and
>> R_ARM_GOT32 relocations to obtain the address of a GOT entry. Reproducer
>> (extracted from
>> https://cs.chromium.org/chromium/src/third_party/ffmpeg/libavutil/arm/asm.S?l=204
>> ):
>>
>> .globl foo_addr
>> .thumb_func
>> foo_addr:
>> ldr r0, .Lpicoff0
>> .Lpic:
>> add r0, pc
>> ldr r1, .Lpicoff1
>> ldr r0, [r1, r0]
>> bx lr
>> .p2align 2
>> .Lpicoff0:
>> .word _GLOBAL_OFFSET_TABLE_ - (.Lpic + 4)
>> .Lpicoff1:
>> .word foo(GOT)
>>
>> This function is expected to return the address of foo, but this no longer
>> works with your change.
>>
>> Peter
>>
>> On Sun, Mar 11, 2018 at 1:58 PM, Peter Smith via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>>
>>> Author: psmith
>>> Date: Sun Mar 11 13:58:18 2018
>>> New Revision: 327248
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=327248&view=rev
>>> Log:
>>> For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at
>>> the start of the .got.plt section so that _GLOBAL_OFFSET_TABLE_[0] =
>>> reserved value that is by convention the address of the dynamic section.
>>> Previously we had defined _GLOBAL_OFFSET_TABLE_ as either the start or end
>>> of the .got section with the intention that the .got.plt section would
>>> follow the .got. However this does not always hold with the current
>>> default section ordering so _GLOBAL_OFFSET_TABLE_[0] may not be consistent
>>> with the reserved first entry of the .got.plt.
>>>
>>> X86, X86_64, Arm and AArch64 will use the .got.plt. Mips and Power use
>>> .got
>>>
>>> Fixes PR36555
>>>
>>> Differential Revision: https://reviews.llvm.org/D44259
>>>
>>> Modified:
>>>     lld/trunk/ELF/Arch/Mips.cpp
>>>     lld/trunk/ELF/Arch/PPC.cpp
>>>     lld/trunk/ELF/Arch/X86.cpp
>>>     lld/trunk/ELF/Arch/X86_64.cpp
>>>     lld/trunk/ELF/SyntheticSections.cpp
>>>     lld/trunk/ELF/SyntheticSections.h
>>>     lld/trunk/ELF/Target.h
>>>     lld/trunk/ELF/Writer.cpp
>>>     lld/trunk/test/ELF/arm-got-relative.s
>>>     lld/trunk/test/ELF/dynamic-got.s
>>>     lld/trunk/test/ELF/global-offset-table-position-aarch64.s
>>>     lld/trunk/test/ELF/global-offset-table-position-arm.s
>>>     lld/trunk/test/ELF/global-offset-table-position-i386.s
>>>     lld/trunk/test/ELF/global-offset-table-position.s
>>>     lld/trunk/test/ELF/global_offset_table_shared.s
>>>     lld/trunk/test/ELF/got32x-i386.s
>>>     lld/trunk/test/ELF/i386-gotpc.s
>>>
>>> Modified: lld/trunk/ELF/Arch/Mips.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Mips.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Arch/Mips.cpp (original)
>>> +++ lld/trunk/ELF/Arch/Mips.cpp Sun Mar 11 13:58:18 2018
>>> @@ -50,6 +50,7 @@ template <class ELFT> MIPS<ELFT>::MIPS()
>>>    DefaultMaxPageSize = 65536;
>>>    GotEntrySize = sizeof(typename ELFT::uint);
>>>    GotPltEntrySize = sizeof(typename ELFT::uint);
>>> +  GotBaseSymInGotPlt = false;
>>>    PltEntrySize = 16;
>>>    PltHeaderSize = 32;
>>>    CopyRel = R_MIPS_COPY;
>>>
>>> Modified: lld/trunk/ELF/Arch/PPC.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Arch/PPC.cpp (original)
>>> +++ lld/trunk/ELF/Arch/PPC.cpp Sun Mar 11 13:58:18 2018
>>> @@ -21,13 +21,18 @@ using namespace lld::elf;
>>>  namespace {
>>>  class PPC final : public TargetInfo {
>>>  public:
>>> -  PPC() { GotBaseSymOff = 0x8000; }
>>> +  PPC();
>>>    void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const
>>> override;
>>>    RelExpr getRelExpr(RelType Type, const Symbol &S,
>>>                       const uint8_t *Loc) const override;
>>>  };
>>>  } // namespace
>>>
>>> +PPC::PPC() {
>>> +  GotBaseSymOff = 0x8000;
>>> +  GotBaseSymInGotPlt = false;
>>> +}
>>> +
>>>  RelExpr PPC::getRelExpr(RelType Type, const Symbol &S,
>>>                          const uint8_t *Loc) const {
>>>    switch (Type) {
>>>
>>> Modified: lld/trunk/ELF/Arch/X86.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/X86.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Arch/X86.cpp (original)
>>> +++ lld/trunk/ELF/Arch/X86.cpp Sun Mar 11 13:58:18 2018
>>> @@ -46,7 +46,6 @@ public:
>>>  } // namespace
>>>
>>>  X86::X86() {
>>> -  GotBaseSymOff = -1;
>>>    CopyRel = R_386_COPY;
>>>    GotRel = R_386_GLOB_DAT;
>>>    PltRel = R_386_JUMP_SLOT;
>>>
>>> Modified: lld/trunk/ELF/Arch/X86_64.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/X86_64.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Arch/X86_64.cpp (original)
>>> +++ lld/trunk/ELF/Arch/X86_64.cpp Sun Mar 11 13:58:18 2018
>>> @@ -51,7 +51,6 @@ private:
>>>  } // namespace
>>>
>>>  template <class ELFT> X86_64<ELFT>::X86_64() {
>>> -  GotBaseSymOff = -1;
>>>    CopyRel = R_X86_64_COPY;
>>>    GotRel = R_X86_64_GLOB_DAT;
>>>    PltRel = R_X86_64_JUMP_SLOT;
>>>
>>> Modified: lld/trunk/ELF/SyntheticSections.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/SyntheticSections.cpp (original)
>>> +++ lld/trunk/ELF/SyntheticSections.cpp Sun Mar 11 13:58:18 2018
>>> @@ -626,8 +626,9 @@ void GotSection::finalizeContents() { Si
>>>  bool GotSection::empty() const {
>>>    // We need to emit a GOT even if it's empty if there's a relocation
>>> that is
>>>    // relative to GOT(such as GOTOFFREL) or there's a symbol that points
>>> to a GOT
>>> -  // (i.e. _GLOBAL_OFFSET_TABLE_).
>>> -  return NumEntries == 0 && !HasGotOffRel && !ElfSym::GlobalOffsetTable;
>>> +  // (i.e. _GLOBAL_OFFSET_TABLE_) that the target defines relative to the
>>> .got.
>>> +  return NumEntries == 0 && !HasGotOffRel &&
>>> +         !(ElfSym::GlobalOffsetTable && !Target->GotBaseSymInGotPlt);
>>>  }
>>>
>>>  void GotSection::writeTo(uint8_t *Buf) {
>>> @@ -898,6 +899,14 @@ void GotPltSection::writeTo(uint8_t *Buf
>>>    }
>>>  }
>>>
>>> +bool GotPltSection::empty() const {
>>> +  // We need to emit a GOT.PLT even if it's empty if there's a symbol
>>> that
>>> +  // references the _GLOBAL_OFFSET_TABLE_ and the Target defines the
>>> symbol
>>> +  // relative to the .got.plt section.
>>> +  return Entries.empty() &&
>>> +         !(ElfSym::GlobalOffsetTable && Target->GotBaseSymInGotPlt);
>>> +}
>>> +
>>>  // On ARM the IgotPltSection is part of the GotSection, on other Targets
>>> it is
>>>  // part of the .got.plt
>>>  IgotPltSection::IgotPltSection()
>>>
>>> Modified: lld/trunk/ELF/SyntheticSections.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/SyntheticSections.h (original)
>>> +++ lld/trunk/ELF/SyntheticSections.h Sun Mar 11 13:58:18 2018
>>> @@ -269,7 +269,7 @@ public:
>>>    void addEntry(Symbol &Sym);
>>>    size_t getSize() const override;
>>>    void writeTo(uint8_t *Buf) override;
>>> -  bool empty() const override { return Entries.empty(); }
>>> +  bool empty() const override;
>>>
>>>  private:
>>>    std::vector<const Symbol *> Entries;
>>>
>>> Modified: lld/trunk/ELF/Target.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Target.h (original)
>>> +++ lld/trunk/ELF/Target.h Sun Mar 11 13:58:18 2018
>>> @@ -71,9 +71,10 @@ public:
>>>
>>>    uint64_t getImageBase();
>>>
>>> -  // Offset of _GLOBAL_OFFSET_TABLE_ from base of .got section. Use -1
>>> for
>>> -  // end of .got
>>> +  // Offset of _GLOBAL_OFFSET_TABLE_ from base of .got or .got.plt
>>> section.
>>>    uint64_t GotBaseSymOff = 0;
>>> +  // True if _GLOBAL_OFFSET_TABLE_ is relative to .got.plt, false if
>>> .got.
>>> +  bool GotBaseSymInGotPlt = true;
>>>
>>>    // On systems with range extensions we place collections of Thunks at
>>>    // regular spacings that enable the majority of branches reach the
>>> Thunks.
>>>
>>> Modified: lld/trunk/ELF/Writer.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/ELF/Writer.cpp (original)
>>> +++ lld/trunk/ELF/Writer.cpp Sun Mar 11 13:58:18 2018
>>> @@ -868,11 +868,12 @@ void Writer<ELFT>::forEachRelSec(std::fu
>>>  // defining these symbols explicitly in the linker script.
>>>  template <class ELFT> void Writer<ELFT>::setReservedSymbolSections() {
>>>    if (ElfSym::GlobalOffsetTable) {
>>> -    // The _GLOBAL_OFFSET_TABLE_ symbol is defined by target convention
>>> to
>>> -    // be at some offset from the base of the .got section, usually 0 or
>>> the end
>>> -    // of the .got
>>> -    InputSection *GotSection = InX::MipsGot ?
>>> cast<InputSection>(InX::MipsGot)
>>> -                                            :
>>> cast<InputSection>(InX::Got);
>>> +    // The _GLOBAL_OFFSET_TABLE_ symbol is defined by target convention
>>> usually
>>> +    // to the start of the .got or .got.plt section.
>>> +    InputSection *GotSection = InX::GotPlt;
>>> +    if (!Target->GotBaseSymInGotPlt)
>>> +      GotSection = InX::MipsGot ? cast<InputSection>(InX::MipsGot)
>>> +                                : cast<InputSection>(InX::Got);
>>>      ElfSym::GlobalOffsetTable->Section = GotSection;
>>>    }
>>>
>>>
>>> Modified: lld/trunk/test/ELF/arm-got-relative.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-got-relative.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/arm-got-relative.s (original)
>>> +++ lld/trunk/test/ELF/arm-got-relative.s Sun Mar 11 13:58:18 2018
>>> @@ -28,17 +28,17 @@ function:
>>>   bx lr
>>>
>>>  // CHECK: Dynamic Relocations {
>>> -// CHECK-NEXT:  0x2048 R_ARM_GLOB_DAT function 0x0
>>> +// CHECK-NEXT:  0x3048 R_ARM_GLOB_DAT function 0x0
>>>
>>>  // CHECK: Name: _GLOBAL_OFFSET_TABLE_
>>> -// CHECK-NEXT:    Value: 0x2048
>>> +// CHECK-NEXT:    Value: 0x2000
>>>  // CHECK-NEXT:    Size:
>>>  // CHECK-NEXT:    Binding: Local
>>>  // CHECK-NEXT:    Type: None
>>>  // CHECK-NEXT:    Other [
>>>  // CHECK-NEXT:      STV_HIDDEN
>>>  // CHECK-NEXT:    ]
>>> -// CHECK-NEXT:    Section: .got
>>> +// CHECK-NEXT:    Section: .got.plt
>>>
>>>  // CODE: Disassembly of section .text:
>>>  // CODE-NEXT: _start:
>>> @@ -47,7 +47,7 @@ function:
>>>  // CODE-NEXT:    1008:        03 00 8f e0    add     r0, pc, r3
>>>  // CODE-NEXT:    100c:        1e ff 2f e1    bx      lr
>>>  // CODE:$d.1:
>>> -// (_GLOBAL_OFFSET_TABLE_ = 0x2048) - (0x1008 + 8) 0x1038
>>> -// CODE-NEXT:    1010:        38 10 00 00
>>> +// (_GLOBAL_OFFSET_TABLE_ = 0x2000) - (0x1008 + 8) = 0xff0
>>> +// CODE-NEXT:    1010:        f0 0f 00 00
>>>  // (Got(function) - GotBase = 0x0
>>>  // CODE-NEXT:    1014:        00 00 00 00
>>>
>>> Modified: lld/trunk/test/ELF/dynamic-got.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-got.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/dynamic-got.s (original)
>>> +++ lld/trunk/test/ELF/dynamic-got.s Sun Mar 11 13:58:18 2018
>>> @@ -3,6 +3,23 @@
>>>  // RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
>>>  // RUN: llvm-readobj -s -l -section-data -r %t.so | FileCheck %s
>>>
>>> +// CHECK:     Name: .got.plt
>>> +// CHECK-NEXT:     Type: SHT_PROGBITS
>>> +// CHECK-NEXT:     Flags [
>>> +// CHECK-NEXT:       SHF_ALLOC
>>> +// CHECK-NEXT:       SHF_WRITE
>>> +// CHECK-NEXT:     ]
>>> +// CHECK-NEXT:     Address:
>>> +// CHECK-NEXT:     Offset:
>>> +// CHECK-NEXT:     Size:
>>> +// CHECK-NEXT:     Link:
>>> +// CHECK-NEXT:     Info:
>>> +// CHECK-NEXT:     AddressAlignment:
>>> +// CHECK-NEXT:     EntrySize:
>>> +// CHECK-NEXT:     SectionData (
>>> +// CHECK-NEXT:       0000: 00300000 00000000 00000000
>>> +// CHECK-NEXT:     )
>>> +
>>>  // CHECK:      Name: .got
>>>  // CHECK-NEXT: Type: SHT_PROGBITS
>>>  // CHECK-NEXT: Flags [
>>> @@ -17,19 +34,19 @@
>>>  // CHECK-NEXT: AddressAlignment:
>>>  // CHECK-NEXT: EntrySize:
>>>  // CHECK-NEXT: SectionData (
>>> -// CHECK-NEXT:   0000: 00200000                |
>>> +// CHECK-NEXT:   0000: 00300000
>>>  // CHECK-NEXT: )
>>>
>>>  // CHECK:      Relocations [
>>>  // CHECK-NEXT:   Section ({{.*}}) .rel.dyn {
>>> -// CHECK-NEXT:     0x2050 R_386_RELATIVE - 0x0
>>> +// CHECK-NEXT:     0x3050 R_386_RELATIVE - 0x0
>>>  // CHECK-NEXT:   }
>>>  // CHECK-NEXT: ]
>>>
>>>  // CHECK:      Type: PT_DYNAMIC
>>> -// CHECK-NEXT: Offset: 0x2000
>>> -// CHECK-NEXT: VirtualAddress: 0x2000
>>> -// CHECK-NEXT: PhysicalAddress: 0x2000
>>> +// CHECK-NEXT: Offset: 0x3000
>>> +// CHECK-NEXT: VirtualAddress: 0x3000
>>> +// CHECK-NEXT: PhysicalAddress: 0x3000
>>>
>>>          calll   .L0$pb
>>>  .L0$pb:
>>>
>>> Modified: lld/trunk/test/ELF/global-offset-table-position-aarch64.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global-offset-table-position-aarch64.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/global-offset-table-position-aarch64.s (original)
>>> +++ lld/trunk/test/ELF/global-offset-table-position-aarch64.s Sun Mar 11
>>> 13:58:18 2018
>>> @@ -20,11 +20,11 @@ _start:
>>>  .long _GLOBAL_OFFSET_TABLE_ - .
>>>
>>>  // CHECK: Name: _GLOBAL_OFFSET_TABLE_ (11)
>>> -// CHECK-NEXT:     Value: 0x30090
>>> +// CHECK-NEXT:     Value: 0x20008
>>>  // CHECK-NEXT:     Size: 0
>>>  // CHECK-NEXT:     Binding: Local (0x0)
>>>  // CHECK-NEXT:     Type: None (0x0)
>>>  // CHECK-NEXT:     Other [ (0x2)
>>>  // CHECK-NEXT:       STV_HIDDEN (0x2)
>>>  // CHECK-NEXT:     ]
>>> -// CHECK-NEXT:     Section: .got
>>> +// CHECK-NEXT:     Section: .got.plt
>>>
>>> Modified: lld/trunk/test/ELF/global-offset-table-position-arm.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global-offset-table-position-arm.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/global-offset-table-position-arm.s (original)
>>> +++ lld/trunk/test/ELF/global-offset-table-position-arm.s Sun Mar 11
>>> 13:58:18 2018
>>> @@ -3,7 +3,8 @@
>>>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>>>  // REQUIRES: arm
>>>
>>> -// The ARM _GLOBAL_OFFSET_TABLE_ should be defined at the start of the
>>> .got
>>> +// The ARM _GLOBAL_OFFSET_TABLE_ should be defined at the start of the
>>> +// .got.plt section.
>>>  .globl  a
>>>  .type   a,%object
>>>  .comm   a,4,4
>>> @@ -25,11 +26,11 @@ _start:
>>>  .data
>>>
>>>  // CHECK:     Name: _GLOBAL_OFFSET_TABLE_
>>> -// CHECK-NEXT:     Value: 0x3068
>>> +// CHECK-NEXT:     Value: 0x2000
>>>  // CHECK-NEXT:     Size: 0
>>>  // CHECK-NEXT:     Binding: Local
>>>  // CHECK-NEXT:     Type: None
>>>  // CHECK-NEXT:     Other [ (0x2)
>>>  // CHECK-NEXT:       STV_HIDDEN (0x2)
>>>  // CHECK-NEXT:     ]
>>> -// CHECK-NEXT:     Section: .got
>>> +// CHECK-NEXT:     Section: .got.plt
>>>
>>> Modified: lld/trunk/test/ELF/global-offset-table-position-i386.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global-offset-table-position-i386.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/global-offset-table-position-i386.s (original)
>>> +++ lld/trunk/test/ELF/global-offset-table-position-i386.s Sun Mar 11
>>> 13:58:18 2018
>>> @@ -3,7 +3,8 @@
>>>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>>>  // REQUIRES: x86
>>>
>>> -// The X86 _GLOBAL_OFFSET_TABLE_ is defined at the end of the .got
>>> section.
>>> +// The X86 _GLOBAL_OFFSET_TABLE_ is defined at the start of the .got.plt
>>> +// section.
>>>  .globl  a
>>>  .type   a, at object
>>>  .comm   a,4,4
>>> @@ -21,11 +22,11 @@ addl    $_GLOBAL_OFFSET_TABLE_, %eax
>>>  calll   f at PLT
>>>
>>>  // CHECK:     Name: _GLOBAL_OFFSET_TABLE_ (1)
>>> -// CHECK-NEXT:     Value: 0x306C
>>> +// CHECK-NEXT:     Value: 0x2000
>>>  // CHECK-NEXT:     Size: 0
>>>  // CHECK-NEXT:     Binding: Local (0x0)
>>>  // CHECK-NEXT:     Type: None (0x0)
>>>  // CHECK-NEXT:     Other [ (0x2)
>>>  // CHECK-NEXT:       STV_HIDDEN (0x2)
>>>  // CHECK-NEXT:     ]
>>> -// CHECK-NEXT:     Section: .got (0xA)
>>> +// CHECK-NEXT:     Section: .got.plt
>>>
>>> Modified: lld/trunk/test/ELF/global-offset-table-position.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global-offset-table-position.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/global-offset-table-position.s (original)
>>> +++ lld/trunk/test/ELF/global-offset-table-position.s Sun Mar 11 13:58:18
>>> 2018
>>> @@ -3,7 +3,8 @@
>>>  // RUN: llvm-readobj -t %t2 | FileCheck %s
>>>  // REQUIRES: x86
>>>
>>> -// The X86_64 _GLOBAL_OFFSET_TABLE_ is defined at the end of the .got
>>> section.
>>> +// The X86_64 _GLOBAL_OFFSET_TABLE_ is defined at the start of the
>>> .got.plt
>>> +// section.
>>>  .globl  a
>>>  .type   a, at object
>>>  .comm   a,4,4
>>> @@ -21,11 +22,11 @@ callq       f at PLT
>>>  .long _GLOBAL_OFFSET_TABLE_ - .
>>>
>>>  // CHECK:     Name: _GLOBAL_OFFSET_TABLE_
>>> -// CHECK-NEXT:     Value: 0x30D8
>>> +// CHECK-NEXT:     Value: 0x2008
>>>  // CHECK-NEXT:     Size: 0
>>>  // CHECK-NEXT:     Binding: Local
>>>  // CHECK-NEXT:     Type: None (0x0)
>>>  // CHECK-NEXT:     Other [
>>>  // CHECK-NEXT:       STV_HIDDEN
>>>  // CHECK-NEXT:     ]
>>> -// CHECK-NEXT:     Section: .got
>>> +// CHECK-NEXT:     Section: .got.plt
>>>
>>> Modified: lld/trunk/test/ELF/global_offset_table_shared.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global_offset_table_shared.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/global_offset_table_shared.s (original)
>>> +++ lld/trunk/test/ELF/global_offset_table_shared.s Sun Mar 11 13:58:18
>>> 2018
>>> @@ -4,11 +4,11 @@
>>>  .long _GLOBAL_OFFSET_TABLE_ - .
>>>
>>>  // CHECK:      Name: _GLOBAL_OFFSET_TABLE_
>>> -// CHECK-NEXT: Value: 0x2060
>>> +// CHECK-NEXT: Value: 0x2000
>>>  // CHECK-NEXT: Size: 0
>>>  // CHECK-NEXT: Binding: Local
>>>  // CHECK-NEXT: Type: None
>>>  // CHECK-NEXT: Other [ (0x2)
>>>  // CHECK-NEXT: STV_HIDDEN (0x2)
>>>  // CHECK-NEXT:    ]
>>> -// CHECK-NEXT: Section: .got
>>> +// CHECK-NEXT: Section: .got.plt
>>>
>>> Modified: lld/trunk/test/ELF/got32x-i386.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/got32x-i386.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/got32x-i386.s (original)
>>> +++ lld/trunk/test/ELF/got32x-i386.s Sun Mar 11 13:58:18 2018
>>> @@ -33,13 +33,13 @@
>>>
>>>  ## 73728 == 0x12000 == ADDR(.got)
>>>  # CHECK:       _start:
>>> -# CHECK-NEXT:   11001: 8b 05 {{.*}} movl 73728, %eax
>>> -# CHECK-NEXT:   11007: 8b 1d {{.*}} movl 73728, %ebx
>>> +# CHECK-NEXT:   11001: 8b 05 {{.*}} movl 77824, %eax
>>> +# CHECK-NEXT:   11007: 8b 1d {{.*}} movl 77824, %ebx
>>>  # CHECK-NEXT:   1100d: 8b 80 {{.*}} movl -4(%eax), %eax
>>>  # CHECK-NEXT:   11013: 8b 83 {{.*}} movl -4(%ebx), %eax
>>>  # CHECK: Sections:
>>>  # CHECK:  Name Size     Address
>>> -# CHECK:  .got 00000004 0000000000012000
>>> +# CHECK:  .got 00000004 0000000000013000
>>>
>>>  # RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1 -pie 2>&1 | \
>>>  # RUN:   FileCheck %s --check-prefix=ERR
>>>
>>> Modified: lld/trunk/test/ELF/i386-gotpc.s
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-gotpc.s?rev=327248&r1=327247&r2=327248&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/test/ELF/i386-gotpc.s (original)
>>> +++ lld/trunk/test/ELF/i386-gotpc.s Sun Mar 11 13:58:18 2018
>>> @@ -6,15 +6,23 @@
>>>
>>>  movl $_GLOBAL_OFFSET_TABLE_, %eax
>>>
>>> +// CHECK:     Name: .got.plt
>>> +// CHECK-NEXT: Type: SHT_PROGBITS
>>> +// CHECK-NEXT: Flags [
>>> +// CHECK-NEXT:   SHF_ALLOC
>>> +// CHECK-NEXT:   SHF_WRITE
>>> +// CHECK-NEXT: ]
>>> +// CHECK-NEXT: Address: 0x2000
>>> +
>>>  // CHECK:      Name: .got
>>>  // CHECK-NEXT: Type: SHT_PROGBITS
>>>  // CHECK-NEXT: Flags [
>>>  // CHECK-NEXT:   SHF_ALLOC
>>>  // CHECK-NEXT:   SHF_WRITE
>>>  // CHECK-NEXT: ]
>>> -// CHECK-NEXT: Address: 0x2030
>>> +// CHECK-NEXT: Address: 0x3030
>>>
>>>  // DISASM:      Disassembly of section .text:
>>>  // DISASM-NEXT: .text:
>>> -// DISASM-NEXT:    1000: {{.*}}         movl    $4144, %eax
>>> -//                                              0x2030 - 0x1000 = 4144
>>> +// DISASM-NEXT:    1000: {{.*}}         movl    $8240, %eax
>>> +//                                              0x3030 - 0x1000 = 0x2030
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>>
>>
>> --
>> --
>> Peter


More information about the llvm-commits mailing list