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