mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-05 00:49:43 +00:00
Document and test the first few .got.plt entries.
llvm-svn: 268945
This commit is contained in:
parent
e34ead8269
commit
4ee6cb3a70
@ -531,6 +531,10 @@ RelExpr X86_64TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
|
||||
}
|
||||
|
||||
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).
|
||||
write64le(Buf, Out<ELF64LE>::Dynamic->getVA());
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
30
lld/test/ELF/got-plt-header.s
Normal file
30
lld/test/ELF/got-plt-header.s
Normal file
@ -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@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
|
Loading…
x
Reference in New Issue
Block a user