summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2016-09-15 17:28:03 +0000
committeremaste <emaste@FreeBSD.org>2016-09-15 17:28:03 +0000
commit781d2e53732985932bcb1b7a462e95557a35f6ee (patch)
tree9f98dfd60ac68ca64b82cd0a31b73c52937b5210 /contrib/elftoolchain
parent2795fdfa265e1b30d06c9de100f163a9fba3e675 (diff)
downloadFreeBSD-src-781d2e53732985932bcb1b7a462e95557a35f6ee.zip
FreeBSD-src-781d2e53732985932bcb1b7a462e95557a35f6ee.tar.gz
MFC r305130: Update to ELF Tool Chain r3490
Improvements include: * readelf: report all relocation types in rel/rela for MIPS N64 * readelf: add ELFOSABI_ARM_AEABI * elfdump: add ELFOSABI_ARM_AEABI and ELFOSABI_ARM * Add recent RISC-V relocations * elfcopy: use elftc_timestamp, to support SOURCE_DATE_EPOCH MFC r305155: readelf: silence GCC 4.2.1 uninitialized variable warning Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r--contrib/elftoolchain/common/elfdefinitions.h7
-rw-r--r--contrib/elftoolchain/elfcopy/archive.c7
-rw-r--r--contrib/elftoolchain/elfcopy/ascii.c4
-rw-r--r--contrib/elftoolchain/elfcopy/pe.c7
-rw-r--r--contrib/elftoolchain/elfdump/elfdump.c4
-rw-r--r--contrib/elftoolchain/libelf/elf_flagdata.35
-rw-r--r--contrib/elftoolchain/libelftc/Makefile3
-rw-r--r--contrib/elftoolchain/libelftc/elftc_bfd_find_target.32
-rw-r--r--contrib/elftoolchain/libelftc/elftc_reloc_type_str.c3
-rw-r--r--contrib/elftoolchain/libelftc/elftc_timestamp.379
-rw-r--r--contrib/elftoolchain/libelftc/elftc_timestamp.c55
-rw-r--r--contrib/elftoolchain/libelftc/libelftc.h3
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_bfdtarget.c2
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c2
-rw-r--r--contrib/elftoolchain/readelf/readelf.14
-rw-r--r--contrib/elftoolchain/readelf/readelf.c65
16 files changed, 227 insertions, 25 deletions
diff --git a/contrib/elftoolchain/common/elfdefinitions.h b/contrib/elftoolchain/common/elfdefinitions.h
index ec22528..7460bb6 100644
--- a/contrib/elftoolchain/common/elfdefinitions.h
+++ b/contrib/elftoolchain/common/elfdefinitions.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $
+ * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $
*/
/*
@@ -2091,7 +2091,10 @@ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \
_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \
-_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45)
+_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) \
+_ELF_DEFINE_RELOC(R_RISCV_RVC_LUI, 46) \
+_ELF_DEFINE_RELOC(R_RISCV_GPREL_I, 47) \
+_ELF_DEFINE_RELOC(R_RISCV_GPREL_S, 48)
#define _ELF_DEFINE_SPARC_RELOCATIONS() \
_ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \
diff --git a/contrib/elftoolchain/elfcopy/archive.c b/contrib/elftoolchain/elfcopy/archive.c
index 97e2498..efdde726 100644
--- a/contrib/elftoolchain/elfcopy/archive.c
+++ b/contrib/elftoolchain/elfcopy/archive.c
@@ -38,7 +38,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $");
+ELFTC_VCSID("$Id: archive.c 3490 2016-08-31 00:12:22Z emaste $");
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
@@ -440,6 +440,7 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
struct archive *a;
struct archive_entry *entry;
struct ar_obj *obj;
+ time_t timestamp;
int nr;
if ((a = archive_write_new()) == NULL)
@@ -450,7 +451,9 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
/* Write the archive symbol table, even if it's empty. */
entry = archive_entry_new();
archive_entry_copy_pathname(entry, "/");
- archive_entry_set_mtime(entry, time(NULL), 0);
+ if (elftc_timestamp(&timestamp) != 0)
+ err(EXIT_FAILURE, "elftc_timestamp");
+ archive_entry_set_mtime(entry, timestamp, 0);
archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) +
ecp->s_sn_sz);
AC(archive_write_header(a, entry));
diff --git a/contrib/elftoolchain/elfcopy/ascii.c b/contrib/elftoolchain/elfcopy/ascii.c
index 6adecf8..4ba05c4 100644
--- a/contrib/elftoolchain/elfcopy/ascii.c
+++ b/contrib/elftoolchain/elfcopy/ascii.c
@@ -36,7 +36,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $");
+ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $");
static void append_data(struct section *s, const void *buf, size_t sz);
static char hex_digit(uint8_t n);
@@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp, int ifd)
sec_index = 1;
sec_addr = entry = 0;
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
- sz = 0; /* Silence GCC 5.3 uninitialized variable warning */
+ sz = 0;
if (line[0] == '\r' || line[0] == '\n')
continue;
if (line[0] == '$' && line[1] == '$') {
diff --git a/contrib/elftoolchain/elfcopy/pe.c b/contrib/elftoolchain/elfcopy/pe.c
index 586b21a..8deb809 100644
--- a/contrib/elftoolchain/elfcopy/pe.c
+++ b/contrib/elftoolchain/elfcopy/pe.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $");
+ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $");
/* Convert ELF object to Portable Executable (PE). */
void
@@ -54,6 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
PE_Buffer *pb;
const char *name;
size_t indx;
+ time_t timestamp;
int elferr;
if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64)
@@ -89,7 +90,9 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
break;
}
- pch.ch_timestamp = (uint32_t) time(NULL);
+ if (elftc_timestamp(&timestamp) != 0)
+ err(EXIT_FAILURE, "elftc_timestamp");
+ pch.ch_timestamp = (uint32_t) timestamp;
if (pe_update_coff_header(pe, &pch) < 0)
err(EXIT_FAILURE, "pe_update_coff_header() failed");
diff --git a/contrib/elftoolchain/elfdump/elfdump.c b/contrib/elftoolchain/elfdump/elfdump.c
index cf27ea6..2ce9469 100644
--- a/contrib/elftoolchain/elfdump/elfdump.c
+++ b/contrib/elftoolchain/elfdump/elfdump.c
@@ -50,7 +50,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $");
+ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@@ -332,6 +332,8 @@ static const char *ei_abis[256] = {
"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
"ELFOSABI_MODESTO", "ELFOSABI_OPENBSD",
[17] = "ELFOSABI_CLOUDABI",
+ [64] = "ELFOSABI_ARM_AEABI",
+ [97] = "ELFOSABI_ARM",
[255] = "ELFOSABI_STANDALONE"
};
diff --git a/contrib/elftoolchain/libelf/elf_flagdata.3 b/contrib/elftoolchain/libelf/elf_flagdata.3
index fc27109..de3cfd9 100644
--- a/contrib/elftoolchain/libelf/elf_flagdata.3
+++ b/contrib/elftoolchain/libelf/elf_flagdata.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy $
+.\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $
.\"
.Dd December 3, 2011
.Os
@@ -208,16 +208,13 @@ was called without a program header being allocated.
.Xr elf 3 ,
.Xr elf32_newehdr 3 ,
.Xr elf32_newphdr 3 ,
-.Xr elf32_newshdr 3 ,
.Xr elf64_newehdr 3 ,
.Xr elf64_newphdr 3 ,
-.Xr elf64_newshdr 3 ,
.Xr elf_newdata 3 ,
.Xr elf_update 3 ,
.Xr gelf 3 ,
.Xr gelf_newehdr 3 ,
.Xr gelf_newphdr 3 ,
-.Xr gelf_newshdr 3 ,
.Xr gelf_update_dyn 3 ,
.Xr gelf_update_move 3 ,
.Xr gelf_update_rel 3 ,
diff --git a/contrib/elftoolchain/libelftc/Makefile b/contrib/elftoolchain/libelftc/Makefile
index 6e38a87..910bbdb 100644
--- a/contrib/elftoolchain/libelftc/Makefile
+++ b/contrib/elftoolchain/libelftc/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $
+# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $
TOP= ${.CURDIR}/..
@@ -10,6 +10,7 @@ SRCS= elftc_bfdtarget.c \
elftc_reloc_type_str.c \
elftc_set_timestamps.c \
elftc_string_table.c \
+ elftc_timestamp.c \
elftc_version.c \
libelftc_bfdtarget.c \
libelftc_dem_arm.c \
diff --git a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
index c340c0c..2e4dbaa 100644
--- a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
+++ b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $
+.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $
.\"
.Dd November 30, 2011
.Os
diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
index a22a1be..19b23ad 100644
--- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
+++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
@@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type)
case 43: return "R_RISCV_ALIGN";
case 44: return "R_RISCV_RVC_BRANCH";
case 45: return "R_RISCV_RVC_JUMP";
+ case 46: return "R_RISCV_RVC_LUI";
+ case 47: return "R_RISCV_GPREL_I";
+ case 48: return "R_RISCV_GPREL_S";
}
break;
case EM_SPARC:
diff --git a/contrib/elftoolchain/libelftc/elftc_timestamp.3 b/contrib/elftoolchain/libelftc/elftc_timestamp.3
new file mode 100644
index 0000000..3c56f2f
--- /dev/null
+++ b/contrib/elftoolchain/libelftc/elftc_timestamp.3
@@ -0,0 +1,79 @@
+.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved.
+.\"
+.\" This documentation was written by Ed Maste under sponsorship of
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" This software is provided by the author and contributors ``as is'' and
+.\" any express or implied warranties, including, but not limited to, the
+.\" implied warranties of merchantability and fitness for a particular purpose
+.\" are disclaimed. In no event shall the author or contributors be liable
+.\" for any direct, indirect, incidental, special, exemplary, or consequential
+.\" damages (including, but not limited to, procurement of substitute goods
+.\" or services; loss of use, data, or profits; or business interruption)
+.\" however caused and on any theory of liability, whether in contract, strict
+.\" liability, or tort (including negligence or otherwise) arising in any way
+.\" out of the use of this software, even if advised of the possibility of
+.\" such damage.
+.\"
+.\" $Id$
+.\"
+.Dd August 24, 2016
+.Os
+.Dt ELFTC_TIMESTAMP 3
+.Sh NAME
+.Nm elftc_timestamp
+.Nd return the current or environment-provided timestamp
+.Sh LIBRARY
+.Lb libelftc
+.Sh SYNOPSIS
+.In libelftc.h
+.Ft int
+.Fo elftc_timestamp
+.Fa "time_t *timestamp"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn elftc_timestamp
+function returns a timestamp supplied by the
+.Ev SOURCE_DATE_EPOCH
+environment variable, or the current time provided by
+.Xr time 3
+if the environment variable is not set.
+.Pp
+The
+.Ar timestamp
+argument specifies a pointer to the location where the timestamp will be
+stored.
+.Sh RETURN VALUE
+Function
+.Fn elftc_timestamp
+returns 0 on success, and -1 in the event of an error.
+.Sh ERRORS
+The
+.Fn elftc_timestamp
+function may fail with the following errors:
+.Bl -tag -width ".Bq Er ERANGE"
+.It Bq Er EINVAL
+.Ev SOURCE_DATE_EPOCH
+contains invalid characters.
+.It Bq Er ERANGE
+.Ev SOURCE_DATE_EPOCH
+specifies a negative value or a value that cannot be stored in a
+time_t.
+.El
+The
+.Fn elftc_timestamp
+function may also fail for any of the reasons described in
+.Xr strtoll 3 .
+.Sh SEE ALSO
+.Xr strtoll 3 ,
+.Xr time 3
diff --git a/contrib/elftoolchain/libelftc/elftc_timestamp.c b/contrib/elftoolchain/libelftc/elftc_timestamp.c
new file mode 100644
index 0000000..ccf482f
--- /dev/null
+++ b/contrib/elftoolchain/libelftc/elftc_timestamp.c
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Ed Maste under sponsorship
+ * of the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <libelftc.h>
+
+int
+elftc_timestamp(time_t *timestamp)
+{
+ long long source_date_epoch;
+ char *env, *eptr;
+
+ if ((env = getenv("SOURCE_DATE_EPOCH")) != NULL) {
+ errno = 0;
+ source_date_epoch = strtoll(env, &eptr, 10);
+ if (*eptr != '\0')
+ errno = EINVAL;
+ if (source_date_epoch < 0)
+ errno = ERANGE;
+ if (errno != 0)
+ return (-1);
+ *timestamp = source_date_epoch;
+ return (0);
+ }
+ *timestamp = time(NULL);
+ return (0);
+}
diff --git a/contrib/elftoolchain/libelftc/libelftc.h b/contrib/elftoolchain/libelftc/libelftc.h
index 6c2b57a..a235097 100644
--- a/contrib/elftoolchain/libelftc/libelftc.h
+++ b/contrib/elftoolchain/libelftc/libelftc.h
@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
- * $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $
+ * $Id: libelftc.h 3489 2016-08-31 00:12:15Z emaste $
*/
#ifndef _LIBELFTC_H_
@@ -91,6 +91,7 @@ int elftc_string_table_remove(Elftc_String_Table *_table,
const char *_string);
const char *elftc_string_table_to_string(Elftc_String_Table *_table,
size_t offset);
+int elftc_timestamp(time_t *_timestamp);
const char *elftc_version(void);
#ifdef __cplusplus
}
diff --git a/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c b/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
index d6a031e..d87d4d8 100644
--- a/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
+++ b/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
@@ -30,7 +30,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $");
+ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $");
struct _Elftc_Bfd_Target _libelftc_targets[] = {
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
index cb73ad3..c3d3f4b 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
@@ -36,7 +36,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $");
+ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $");
/**
* @file cpp_demangle.c
diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1
index 701d500..0741238 100644
--- a/contrib/elftoolchain/readelf/readelf.1
+++ b/contrib/elftoolchain/readelf/readelf.1
@@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id: readelf.1 3219 2015-05-24 23:42:34Z kaiwang27 $
+.\" $Id: readelf.1 3486 2016-08-22 14:10:05Z emaste $
.\"
.Dd September 13, 2012
.Os
@@ -43,12 +43,12 @@
.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
.Op Fl r | Fl -relocs
.Op Fl t | Fl -section-details
-.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl v | Fl -version
.Oo
.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
.Oc
+.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl A | Fl -arch-specific
.Op Fl D | Fl -use-dynamic
.Op Fl H | Fl -help
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index 79fff4a..2bf668e 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/contrib/elftoolchain/readelf/readelf.c
@@ -47,7 +47,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $");
+ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $");
/* Backwards compatability for older FreeBSD releases. */
#ifndef STB_GNU_UNIQUE
@@ -440,6 +440,7 @@ elf_osabi(unsigned int abi)
case ELFOSABI_OPENVMS: return "OpenVMS";
case ELFOSABI_NSK: return "NSK";
case ELFOSABI_CLOUDABI: return "CloudABI";
+ case ELFOSABI_ARM_AEABI: return "ARM EABI";
case ELFOSABI_ARM: return "ARM";
case ELFOSABI_STANDALONE: return "StandAlone";
default:
@@ -2787,6 +2788,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname;
uint64_t symval;
int i, len;
+ uint32_t type;
+ uint8_t type2, type3;
if (s->link >= re->shnum)
return;
@@ -2796,8 +2799,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
- elftc_reloc_type_str(re->ehdr.e_machine, \
- ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
+ elftc_reloc_type_str(re->ehdr.e_machine, type), \
+ (uintmax_t)symval, symname
printf("\nRelocation section (%s):\n", s->name);
if (re->ec == ELFCLASS32)
@@ -2823,12 +2826,37 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
ELF64_R_TYPE(r.r_info));
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32);
} else {
+ type = ELF64_R_TYPE(r.r_info);
+ if (re->ehdr.e_machine == EM_MIPS) {
+ type2 = (type >> 8) & 0xFF;
+ type3 = (type >> 16) & 0xFF;
+ type = type & 0xFF;
+ } else {
+ type2 = type3 = 0;
+ }
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s\n", REL_CT64);
else
printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s\n", REL_CT64);
+ if (re->ehdr.e_machine == EM_MIPS) {
+ if (re->options & RE_WW) {
+ printf("%32s: %s\n", "Type2",
+ elftc_reloc_type_str(EM_MIPS,
+ type2));
+ printf("%32s: %s\n", "Type3",
+ elftc_reloc_type_str(EM_MIPS,
+ type3));
+ } else {
+ printf("%24s: %s\n", "Type2",
+ elftc_reloc_type_str(EM_MIPS,
+ type2));
+ printf("%24s: %s\n", "Type3",
+ elftc_reloc_type_str(EM_MIPS,
+ type3));
+ }
+ }
}
}
@@ -2843,6 +2871,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname;
uint64_t symval;
int i, len;
+ uint32_t type;
+ uint8_t type2, type3;
if (s->link >= re->shnum)
return;
@@ -2853,8 +2883,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
- elftc_reloc_type_str(re->ehdr.e_machine, \
- ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
+ elftc_reloc_type_str(re->ehdr.e_machine, type), \
+ (uintmax_t)symval, symname
printf("\nRelocation section with addend (%s):\n", s->name);
if (re->ec == ELFCLASS32)
@@ -2881,6 +2911,14 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32);
printf(" + %x\n", (uint32_t) r.r_addend);
} else {
+ type = ELF64_R_TYPE(r.r_info);
+ if (re->ehdr.e_machine == EM_MIPS) {
+ type2 = (type >> 8) & 0xFF;
+ type3 = (type >> 16) & 0xFF;
+ type = type & 0xFF;
+ } else {
+ type2 = type3 = 0;
+ }
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s", RELA_CT64);
@@ -2888,6 +2926,23 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s", RELA_CT64);
printf(" + %jx\n", (uintmax_t) r.r_addend);
+ if (re->ehdr.e_machine == EM_MIPS) {
+ if (re->options & RE_WW) {
+ printf("%32s: %s\n", "Type2",
+ elftc_reloc_type_str(EM_MIPS,
+ type2));
+ printf("%32s: %s\n", "Type3",
+ elftc_reloc_type_str(EM_MIPS,
+ type3));
+ } else {
+ printf("%24s: %s\n", "Type2",
+ elftc_reloc_type_str(EM_MIPS,
+ type2));
+ printf("%24s: %s\n", "Type3",
+ elftc_reloc_type_str(EM_MIPS,
+ type3));
+ }
+ }
}
}
OpenPOWER on IntegriCloud