summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-10-23 05:26:59 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-10-23 05:26:59 +0000
commit92f8ba51204cfae92ee405af1e1f333729f8a776 (patch)
treefd1374d8a95dcd43a9117c1d48dc8db38d346687 /gnu/usr.bin
parentd101021c91e6723d093b279fa2979e22fa704f32 (diff)
Teach readelf the arm64 dynamic relocation we use, as well as the
m88k-specific dynamic tags ok deraadt@ jsg@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/binutils-2.17/binutils/readelf.c23
-rw-r--r--gnu/usr.bin/binutils-2.17/include/elf/aarch64.h36
2 files changed, 59 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils-2.17/binutils/readelf.c b/gnu/usr.bin/binutils-2.17/binutils/readelf.c
index 413f03a43c5..5794e28f4cb 100644
--- a/gnu/usr.bin/binutils-2.17/binutils/readelf.c
+++ b/gnu/usr.bin/binutils-2.17/binutils/readelf.c
@@ -67,6 +67,7 @@
#define RELOC_MACROS_GEN_FUNC
+#include "elf/aarch64.h"
#include "elf/alpha.h"
#include "elf/arc.h"
#include "elf/arm.h"
@@ -615,6 +616,7 @@ guess_is_rela (unsigned long e_machine)
case EM_NIOS32:
case EM_ALTERA_NIOS2:
case EM_88K:
+ case EM_AARCH64:
return TRUE;
case EM_MMA:
@@ -1138,6 +1140,10 @@ dump_relocations (FILE *file,
case EM_88K:
rtype = elf_m88k_reloc_type (type);
break;
+
+ case EM_AARCH64:
+ rtype = elf_aarch64_reloc_type (type);
+ break;
}
if (rtype == NULL)
@@ -1425,6 +1431,20 @@ get_alpha_dynamic_type (unsigned long type)
}
static const char *
+get_m88k_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case DT_88K_ADDRBASE: return "88K_ADDRBASE";
+ case DT_88K_PLTSTART: return "88K_PLTSTART";
+ case DT_88K_PLTEND: return "88K_PLTEND";
+ case DT_88K_TDESC: return "88K_TDESC";
+ default:
+ return NULL;
+ }
+}
+
+static const char *
get_dynamic_type (unsigned long type)
{
static char buff[64];
@@ -1532,6 +1552,9 @@ get_dynamic_type (unsigned long type)
case EM_ALPHA:
result = get_alpha_dynamic_type (type);
break;
+ case EM_88K:
+ result = get_m88k_dynamic_type (type);
+ break;
default:
result = NULL;
break;
diff --git a/gnu/usr.bin/binutils-2.17/include/elf/aarch64.h b/gnu/usr.bin/binutils-2.17/include/elf/aarch64.h
new file mode 100644
index 00000000000..1b448195cfa
--- /dev/null
+++ b/gnu/usr.bin/binutils-2.17/include/elf/aarch64.h
@@ -0,0 +1,36 @@
+/* aarch64 ELF support for BFD.
+ * Copyright (c) 2017 Philip Guenther <guenther@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ELF_AARCH64_H
+#define _ELF_AARCH64_H
+
+#include "elf/reloc-macros.h"
+
+START_RELOC_NUMBERS (elf_aarch64_reloc_type )
+ RELOC_NUMBER (R_AARCH64_NONE, 256) /* No reloc */
+ RELOC_NUMBER (R_AARCH64_ABS64, 257) /* Direct 64 bit */
+ RELOC_NUMBER (R_AARCH64_COPY, 1024) /* Copy symbol at runtime */
+ RELOC_NUMBER (R_AARCH64_GLOB_DAT, 1025) /* Create GOT entry */
+ RELOC_NUMBER (R_AARCH64_JUMP_SLOT, 1026) /* Create PLT entry */
+ RELOC_NUMBER (R_AARCH64_RELATIVE, 1027) /* Adjust by object base */
+ RELOC_NUMBER (R_AARCH64_TLS_DTPREL64, 1028) /* Dynamic TLS offset */
+ RELOC_NUMBER (R_AARCH64_TLS_DTPMOD64, 1029) /* Dynamic TLS module */
+ RELOC_NUMBER (R_AARCH64_TLS_TPREL64, 1030) /* Thread pointer relative */
+ RELOC_NUMBER (R_AARCH64_TLSDESC, 1031) /* TLS descriptor */
+ RELOC_NUMBER (R_AARCH64_IRELATIVE, 1032) /* Indirect relative */
+END_RELOC_NUMBERS (R_AARCH64_max)
+
+#endif