summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2018-04-13 16:42:48 +0000
committerSean Fertile <sfertile@ca.ibm.com>2018-04-13 16:42:48 +0000
commiteaa1607b489a91a3ccdc45c82749778a24ccb5d3 (patch)
treedb7e2f728c0ec620e0a1a3ce9fcde11a0b96c769
parent9ec9f444cc19bc08067c884ddea494dfd5b53c9c (diff)
downloadbcm5719-llvm-eaa1607b489a91a3ccdc45c82749778a24ccb5d3.tar.gz
bcm5719-llvm-eaa1607b489a91a3ccdc45c82749778a24ccb5d3.zip
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 llvm-svn: 330038
-rw-r--r--llvm/include/llvm/BinaryFormat/DynamicTags.def15
-rwxr-xr-xllvm/test/tools/llvm-readobj/Inputs/ppc64.exebin0 -> 69520 bytes
-rw-r--r--llvm/test/tools/llvm-readobj/ppc64-glink.test11
-rw-r--r--llvm/tools/llvm-readobj/ELFDumper.cpp12
4 files changed, 38 insertions, 0 deletions
diff --git a/llvm/include/llvm/BinaryFormat/DynamicTags.def b/llvm/include/llvm/BinaryFormat/DynamicTags.def
index c39f38a0c30..34c888d2759 100644
--- a/llvm/include/llvm/BinaryFormat/DynamicTags.def
+++ b/llvm/include/llvm/BinaryFormat/DynamicTags.def
@@ -16,6 +16,11 @@
#define MIPS_DYNAMIC_TAG_DEFINED
#endif
+#ifndef PPC64_DYNAMIC_TAG
+#define PPC64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value)
+#define PPC64_DYNAMIC_TAG_DEFINED
+#endif
+
#ifndef DYNAMIC_TAG_MARKER
#define DYNAMIC_TAG_MARKER(name, value) DYNAMIC_TAG(name, value)
#define DYNAMIC_TAG_MARKER_DEFINED
@@ -171,6 +176,10 @@ MIPS_DYNAMIC_TAG(MIPS_RWPLT, 0x70000034) // Points to the base
MIPS_DYNAMIC_TAG(MIPS_RLD_MAP_REL, 0x70000035) // Relative offset of run time loader
// map, used for debugging.
+// PPC64 specific dynamic table entries.
+PPC64_DYNAMIC_TAG(PPC64_GLINK, 0x70000000) // Address of 32 bytes before the
+ // first glink lazy resolver stub.
+
// Sun machine-independent extensions.
DYNAMIC_TAG(AUXILIARY, 0x7FFFFFFD) // Shared object to load before self
DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from
@@ -181,7 +190,13 @@ DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from
#endif
#ifdef MIPS_DYNAMIC_TAG_DEFINED
#undef MIPS_DYNAMIC_TAG
+#undef MIPS_DYNAMIC_TAG_DEFINED
#endif
#ifdef HEXAGON_DYNAMIC_TAG_DEFINED
#undef HEXAGON_DYNAMIC_TAG
+#undef HEXAGON_DYNAMIC_TAG_DEFINED
+#endif
+#ifdef PPC64_DYNAMIC_TAG_DEFINED
+#undef PPC64_DYNAMIC_TAG
+#undef PPC64_DYNAMIC_TAG_DEFINED
#endif
diff --git a/llvm/test/tools/llvm-readobj/Inputs/ppc64.exe b/llvm/test/tools/llvm-readobj/Inputs/ppc64.exe
new file mode 100755
index 00000000000..0db6147ca70
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/Inputs/ppc64.exe
Binary files differ
diff --git a/llvm/test/tools/llvm-readobj/ppc64-glink.test b/llvm/test/tools/llvm-readobj/ppc64-glink.test
new file mode 100644
index 00000000000..9602a5af8ed
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/ppc64-glink.test
@@ -0,0 +1,11 @@
+# Check DT_PPC64_GLINK dynamic tag.
+
+RUN: llvm-readobj -dynamic-table %p/Inputs/ppc64.exe | FileCheck %s
+
+CHECK: Format: ELF64-ppc64
+CHECK: Arch: powerpc64le
+CHECK: AddressSize: 64bit
+
+CHECK: DynamicSection [ (25 entries)
+CHECK-NEXT: Tag Type Name/Value
+CHECK: 0x0000000070000000 PPC64_GLINK 0x10000830
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 6ad9d07f7c2..0adacf9bf5b 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1551,6 +1551,7 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
#include "llvm/BinaryFormat/DynamicTags.def"
#undef HEXAGON_DYNAMIC_TAG
}
+
case EM_MIPS:
switch (Type) {
#define MIPS_DYNAMIC_TAG(name, value) \
@@ -1559,12 +1560,22 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
#include "llvm/BinaryFormat/DynamicTags.def"
#undef MIPS_DYNAMIC_TAG
}
+
+ case EM_PPC64:
+ switch(Type) {
+#define PPC64_DYNAMIC_TAG(name, value) \
+ case DT_##name: \
+ return #name;
+#include "llvm/BinaryFormat/DynamicTags.def"
+#undef PPC64_DYNAMIC_TAG
+ }
}
#undef DYNAMIC_TAG
switch (Type) {
// Now handle all dynamic tags except the architecture specific ones
#define MIPS_DYNAMIC_TAG(name, value)
#define HEXAGON_DYNAMIC_TAG(name, value)
+#define PPC64_DYNAMIC_TAG(name, value)
// Also ignore marker tags such as DT_HIOS (maps to DT_VERNEEDNUM), etc.
#define DYNAMIC_TAG_MARKER(name, value)
#define DYNAMIC_TAG(name, value) \
@@ -1574,6 +1585,7 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
#undef DYNAMIC_TAG
#undef MIPS_DYNAMIC_TAG
#undef HEXAGON_DYNAMIC_TAG
+#undef PPC64_DYNAMIC_TAG
#undef DYNAMIC_TAG_MARKER
default: return "unknown";
}
OpenPOWER on IntegriCloud