[lld] r268945 - Document and test the first few .got.plt entries.
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 18:42:52 PDT 2016
On Mon, May 9, 2016 at 11:12 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Mon May 9 13:12:15 2016
> New Revision: 268945
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268945&view=rev
> Log:
> Document and test the first few .got.plt entries.
>
> Added:
> lld/trunk/test/ELF/got-plt-header.s
> Modified:
> lld/trunk/ELF/Target.cpp
> lld/trunk/ELF/Target.h
>
> Modified: lld/trunk/ELF/Target.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=268945&r1=268944&r2=268945&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Target.cpp (original)
> +++ lld/trunk/ELF/Target.cpp Mon May 9 13:12:15 2016
> @@ -531,6 +531,10 @@ RelExpr X86_64TargetInfo::getRelExpr(uin
> }
>
> void X86_64TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
> + // The first entry holds the value of _DYNAMIC. It is not clear why
> that is
> + // required, but it is documented in the psabi and the glibc dynamic
> linker
> + // seems to use it (not that this is relevant for linking ld.so, not any
> + // other program).
>
Could you reword "not that this is relevant for linking ld.so, not any
other program"? There's something awkward about the two "not"'s.
-- Sean Silva
> write64le(Buf, Out<ELF64LE>::Dynamic->getVA());
> }
>
>
> Modified: lld/trunk/ELF/Target.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=268945&r1=268944&r2=268945&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Target.h (original)
> +++ lld/trunk/ELF/Target.h Mon May 9 13:12:15 2016
> @@ -78,7 +78,11 @@ public:
> uint32_t TlsOffsetRel;
> unsigned PltEntrySize = 8;
> unsigned PltZeroSize = 0;
> +
> + // At least on x86_64 positions 1 and 2 are used by the first plt entry
> + // to support lazy loading.
> unsigned GotPltHeaderEntriesNum = 3;
> +
> uint32_t ThunkSize = 0;
> bool UseLazyBinding = false;
>
>
> Added: lld/trunk/test/ELF/got-plt-header.s
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/got-plt-header.s?rev=268945&view=auto
>
> ==============================================================================
> --- lld/trunk/test/ELF/got-plt-header.s (added)
> +++ lld/trunk/test/ELF/got-plt-header.s Mon May 9 13:12:15 2016
> @@ -0,0 +1,30 @@
> +// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
> +// RUN: ld.lld %t.o -o %t.so -shared
> +// RUN: llvm-readobj -s -section-data %t.so | FileCheck %s
> +
> + call foo at plt
> +
> +// Check that the first .got.plt entry has the address of the dynamic
> table.
> +
> +// CHECK: Type: SHT_DYNAMIC
> +// CHECK-NEXT: Flags [
> +// CHECK-NEXT: SHF_ALLOC
> +// CHECK-NEXT: SHF_WRITE
> +// CHECK-NEXT: ]
> +// CHECK-NEXT: Address: 0x2000
> +
> +// 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: 0x3000
> +// CHECK-NEXT: Offset: 0x3000
> +// CHECK-NEXT: Size: 32
> +// CHECK-NEXT: Link: 0
> +// CHECK-NEXT: Info: 0
> +// CHECK-NEXT: AddressAlignment: 8
> +// CHECK-NEXT: EntrySize: 0
> +// CHECK-NEXT: SectionData (
> +// CHECK-NEXT: 0000: 00200000 00000000 00000000 00000000
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160509/fe92ac1d/attachment.html>
More information about the llvm-commits
mailing list