svn commit: r305130 - in head: contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/elfdump contrib/elftoolchain/libelf contrib/elftoolchain/libelftc contrib/elftoolchain/r...
Ed Maste
emaste at FreeBSD.org
Wed Aug 31 15:05:07 UTC 2016
Author: emaste
Date: Wed Aug 31 15:05:04 2016
New Revision: 305130
URL: https://svnweb.freebsd.org/changeset/base/305130
Log:
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
Sponsored by: The FreeBSD Foundation
Added:
head/contrib/elftoolchain/libelftc/elftc_timestamp.3
- copied unchanged from r305126, vendor/elftoolchain/dist/libelftc/elftc_timestamp.3
head/contrib/elftoolchain/libelftc/elftc_timestamp.c
- copied unchanged from r305126, vendor/elftoolchain/dist/libelftc/elftc_timestamp.c
Modified:
head/contrib/elftoolchain/common/elfdefinitions.h
head/contrib/elftoolchain/elfcopy/archive.c
head/contrib/elftoolchain/elfcopy/ascii.c
head/contrib/elftoolchain/elfcopy/pe.c
head/contrib/elftoolchain/elfdump/elfdump.c
head/contrib/elftoolchain/libelf/elf_flagdata.3
head/contrib/elftoolchain/libelftc/Makefile
head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
head/contrib/elftoolchain/libelftc/libelftc.h
head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
head/contrib/elftoolchain/readelf/readelf.1
head/contrib/elftoolchain/readelf/readelf.c
head/lib/libelftc/Makefile
head/lib/libelftc/elftc_version.c
Directory Properties:
head/contrib/elftoolchain/ (props changed)
head/contrib/elftoolchain/elfdump/ (props changed)
Modified: head/contrib/elftoolchain/common/elfdefinitions.h
==============================================================================
--- head/contrib/elftoolchain/common/elfdefinitions.h Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/common/elfdefinitions.h Wed Aug 31 15:05:04 2016 (r305130)
@@ -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,
_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) \
Modified: head/contrib/elftoolchain/elfcopy/archive.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/archive.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/elfcopy/archive.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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 o
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 o
/* 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(×tamp) != 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));
Modified: head/contrib/elftoolchain/elfcopy/ascii.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/ascii.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/elfcopy/ascii.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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
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] == '$') {
Modified: head/contrib/elftoolchain/elfcopy/pe.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/pe.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/elfcopy/pe.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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,
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,
pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
break;
}
- pch.ch_timestamp = (uint32_t) time(NULL);
+ if (elftc_timestamp(×tamp) != 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");
Modified: head/contrib/elftoolchain/elfdump/elfdump.c
==============================================================================
--- head/contrib/elftoolchain/elfdump/elfdump.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/elfdump/elfdump.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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"
};
Modified: head/contrib/elftoolchain/libelf/elf_flagdata.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_flagdata.3 Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelf/elf_flagdata.3 Wed Aug 31 15:05:04 2016 (r305130)
@@ -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 bein
.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 ,
Modified: head/contrib/elftoolchain/libelftc/Makefile
==============================================================================
--- head/contrib/elftoolchain/libelftc/Makefile Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/Makefile Wed Aug 31 15:05:04 2016 (r305130)
@@ -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 \
Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Wed Aug 31 15:05:04 2016 (r305130)
@@ -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
Modified: head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach,
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:
Copied: head/contrib/elftoolchain/libelftc/elftc_timestamp.3 (from r305126, vendor/elftoolchain/dist/libelftc/elftc_timestamp.3)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/elftoolchain/libelftc/elftc_timestamp.3 Wed Aug 31 15:05:04 2016 (r305130, copy of r305126, vendor/elftoolchain/dist/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
Copied: head/contrib/elftoolchain/libelftc/elftc_timestamp.c (from r305126, vendor/elftoolchain/dist/libelftc/elftc_timestamp.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/elftoolchain/libelftc/elftc_timestamp.c Wed Aug 31 15:05:04 2016 (r305130, copy of r305126, vendor/elftoolchain/dist/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);
+}
Modified: head/contrib/elftoolchain/libelftc/libelftc.h
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc.h Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/libelftc.h Wed Aug 31 15:05:04 2016 (r305130)
@@ -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_Str
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
}
Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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[] = {
Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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
Modified: head/contrib/elftoolchain/readelf/readelf.1
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.1 Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/readelf/readelf.1 Wed Aug 31 15:05:04 2016 (r305130)
@@ -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
Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/contrib/elftoolchain/readelf/readelf.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -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 sect
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 sect
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,35 @@ dump_rel(struct readelf *re, struct sect
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;
+ }
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 +2869,8 @@ dump_rela(struct readelf *re, struct sec
const char *symname;
uint64_t symval;
int i, len;
+ uint32_t type;
+ uint8_t type2, type3;
if (s->link >= re->shnum)
return;
@@ -2853,8 +2881,8 @@ dump_rela(struct readelf *re, struct sec
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 +2909,12 @@ dump_rela(struct readelf *re, struct sec
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;
+ }
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s", RELA_CT64);
@@ -2888,6 +2922,23 @@ dump_rela(struct readelf *re, struct sec
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));
+ }
+ }
}
}
Modified: head/lib/libelftc/Makefile
==============================================================================
--- head/lib/libelftc/Makefile Wed Aug 31 14:49:58 2016 (r305129)
+++ head/lib/libelftc/Makefile Wed Aug 31 15:05:04 2016 (r305130)
@@ -16,6 +16,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 \
Modified: head/lib/libelftc/elftc_version.c
==============================================================================
--- head/lib/libelftc/elftc_version.c Wed Aug 31 14:49:58 2016 (r305129)
+++ head/lib/libelftc/elftc_version.c Wed Aug 31 15:05:04 2016 (r305130)
@@ -6,5 +6,5 @@
const char *
elftc_version(void)
{
- return "elftoolchain r3477M";
+ return "elftoolchain r3490M";
}
More information about the svn-src-head
mailing list