Skip to content

Commit 24b0700

Browse files
author
Sean Fertile
committed
Add PPC64_GLINK dynamic tag.
Add support for the PPC64_GLINK dynamic tag which is used in the ElfV2 abi. Differential Revision: https://reviews.llvm.org/D45574 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330038 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4467b4c commit 24b0700

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

include/llvm/BinaryFormat/DynamicTags.def

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#define MIPS_DYNAMIC_TAG_DEFINED
1717
#endif
1818

19+
#ifndef PPC64_DYNAMIC_TAG
20+
#define PPC64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value)
21+
#define PPC64_DYNAMIC_TAG_DEFINED
22+
#endif
23+
1924
#ifndef DYNAMIC_TAG_MARKER
2025
#define DYNAMIC_TAG_MARKER(name, value) DYNAMIC_TAG(name, value)
2126
#define DYNAMIC_TAG_MARKER_DEFINED
@@ -171,6 +176,10 @@ MIPS_DYNAMIC_TAG(MIPS_RWPLT, 0x70000034) // Points to the base
171176
MIPS_DYNAMIC_TAG(MIPS_RLD_MAP_REL, 0x70000035) // Relative offset of run time loader
172177
// map, used for debugging.
173178

179+
// PPC64 specific dynamic table entries.
180+
PPC64_DYNAMIC_TAG(PPC64_GLINK, 0x70000000) // Address of 32 bytes before the
181+
// first glink lazy resolver stub.
182+
174183
// Sun machine-independent extensions.
175184
DYNAMIC_TAG(AUXILIARY, 0x7FFFFFFD) // Shared object to load before self
176185
DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from
@@ -181,7 +190,13 @@ DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from
181190
#endif
182191
#ifdef MIPS_DYNAMIC_TAG_DEFINED
183192
#undef MIPS_DYNAMIC_TAG
193+
#undef MIPS_DYNAMIC_TAG_DEFINED
184194
#endif
185195
#ifdef HEXAGON_DYNAMIC_TAG_DEFINED
186196
#undef HEXAGON_DYNAMIC_TAG
197+
#undef HEXAGON_DYNAMIC_TAG_DEFINED
198+
#endif
199+
#ifdef PPC64_DYNAMIC_TAG_DEFINED
200+
#undef PPC64_DYNAMIC_TAG
201+
#undef PPC64_DYNAMIC_TAG_DEFINED
187202
#endif
67.9 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Check DT_PPC64_GLINK dynamic tag.
2+
3+
RUN: llvm-readobj -dynamic-table %p/Inputs/ppc64.exe | FileCheck %s
4+
5+
CHECK: Format: ELF64-ppc64
6+
CHECK: Arch: powerpc64le
7+
CHECK: AddressSize: 64bit
8+
9+
CHECK: DynamicSection [ (25 entries)
10+
CHECK-NEXT: Tag Type Name/Value
11+
CHECK: 0x0000000070000000 PPC64_GLINK 0x10000830

tools/llvm-readobj/ELFDumper.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,7 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
15511551
#include "llvm/BinaryFormat/DynamicTags.def"
15521552
#undef HEXAGON_DYNAMIC_TAG
15531553
}
1554+
15541555
case EM_MIPS:
15551556
switch (Type) {
15561557
#define MIPS_DYNAMIC_TAG(name, value) \
@@ -1559,12 +1560,22 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
15591560
#include "llvm/BinaryFormat/DynamicTags.def"
15601561
#undef MIPS_DYNAMIC_TAG
15611562
}
1563+
1564+
case EM_PPC64:
1565+
switch(Type) {
1566+
#define PPC64_DYNAMIC_TAG(name, value) \
1567+
case DT_##name: \
1568+
return #name;
1569+
#include "llvm/BinaryFormat/DynamicTags.def"
1570+
#undef PPC64_DYNAMIC_TAG
1571+
}
15621572
}
15631573
#undef DYNAMIC_TAG
15641574
switch (Type) {
15651575
// Now handle all dynamic tags except the architecture specific ones
15661576
#define MIPS_DYNAMIC_TAG(name, value)
15671577
#define HEXAGON_DYNAMIC_TAG(name, value)
1578+
#define PPC64_DYNAMIC_TAG(name, value)
15681579
// Also ignore marker tags such as DT_HIOS (maps to DT_VERNEEDNUM), etc.
15691580
#define DYNAMIC_TAG_MARKER(name, value)
15701581
#define DYNAMIC_TAG(name, value) \
@@ -1574,6 +1585,7 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
15741585
#undef DYNAMIC_TAG
15751586
#undef MIPS_DYNAMIC_TAG
15761587
#undef HEXAGON_DYNAMIC_TAG
1588+
#undef PPC64_DYNAMIC_TAG
15771589
#undef DYNAMIC_TAG_MARKER
15781590
default: return "unknown";
15791591
}

0 commit comments

Comments
 (0)