Import ELF Tool Chain snapshot at revision 3490

From http://svn.code.sf.net/p/elftoolchain/code/
This commit is contained in:
Ed Maste 2016-08-31 13:50:23 +00:00
parent e2f022b8a2
commit 665a3a9a79
16 changed files with 263 additions and 34 deletions

View File

@ -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) \

View File

@ -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));

View File

@ -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,6 +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;
if (line[0] == '\r' || line[0] == '\n')
continue;
if (line[0] == '$' && line[1] == '$') {

View File

@ -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");

View File

@ -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"
};

View File

@ -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 ,

View File

@ -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 \

View File

@ -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
@ -89,6 +89,7 @@ Known descriptor names and their properties include:
.It Li elf64-ia64-big Ta ELF Ta MSB Ta 64
.It Li elf64-ia64-little Ta ELF Ta LSB Ta 64
.It Li elf64-little Ta ELF Ta LSB Ta 64
.It Li elf64-littleaarch64 Ta ELF Ta LSB Ta 64
.It Li elf64-littlemips Ta ELF Ta LSB Ta 64
.It Li elf64-powerpc Ta ELF Ta MSB Ta 64
.It Li elf64-powerpcle Ta ELF Ta LSB Ta 64

View File

@ -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:

View File

@ -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

View File

@ -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);
}

View File

@ -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
}

View File

@ -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[] = {
@ -249,6 +249,14 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
.bt_elfclass = ELFCLASS64,
},
{
.bt_name = "elf64-littleaarch64",
.bt_type = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
.bt_elfclass = ELFCLASS64,
.bt_machine = EM_AARCH64,
},
{
.bt_name = "elf64-littlemips",
.bt_type = ETF_ELF,

View File

@ -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
@ -2551,7 +2551,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
case 'w':
/* wchar_t */
if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;

View File

@ -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

View File

@ -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 $");
/*
* readelf(1) options.
@ -334,7 +334,7 @@ static const char *note_type_openbsd(unsigned int nt);
static const char *note_type_unknown(unsigned int nt);
static const char *note_type_xen(unsigned int nt);
static const char *option_kind(uint8_t kind);
static const char *phdr_type(unsigned int ptype);
static const char *phdr_type(unsigned int mach, unsigned int ptype);
static const char *ppc_abi_fp(uint64_t fp);
static const char *ppc_abi_vector(uint64_t vec);
static void readelf_usage(int status);
@ -431,6 +431,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:
@ -613,10 +614,24 @@ elf_ver(unsigned int ver)
}
static const char *
phdr_type(unsigned int ptype)
phdr_type(unsigned int mach, unsigned int ptype)
{
static char s_ptype[32];
if (ptype >= PT_LOPROC && ptype <= PT_HIPROC) {
switch (mach) {
case EM_ARM:
switch (ptype) {
case PT_ARM_ARCHEXT: return "ARM_ARCHEXT";
case PT_ARM_EXIDX: return "ARM_EXIDX";
}
break;
}
snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x",
ptype - PT_LOPROC);
return (s_ptype);
}
switch (ptype) {
case PT_NULL: return "NULL";
case PT_LOAD: return "LOAD";
@ -630,10 +645,7 @@ phdr_type(unsigned int ptype)
case PT_GNU_STACK: return "GNU_STACK";
case PT_GNU_RELRO: return "GNU_RELRO";
default:
if (ptype >= PT_LOPROC && ptype <= PT_HIPROC)
snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x",
ptype - PT_LOPROC);
else if (ptype >= PT_LOOS && ptype <= PT_HIOS)
if (ptype >= PT_LOOS && ptype <= PT_HIOS)
snprintf(s_ptype, sizeof(s_ptype), "LOOS+%#x",
ptype - PT_LOOS);
else
@ -650,6 +662,15 @@ section_type(unsigned int mach, unsigned int stype)
if (stype >= SHT_LOPROC && stype <= SHT_HIPROC) {
switch (mach) {
case EM_ARM:
switch (stype) {
case SHT_ARM_EXIDX: return "ARM_EXIDX";
case SHT_ARM_PREEMPTMAP: return "ARM_PREEMPTMAP";
case SHT_ARM_ATTRIBUTES: return "ARM_ATTRIBUTES";
case SHT_ARM_DEBUGOVERLAY: return "ARM_DEBUGOVERLAY";
case SHT_ARM_OVERLAYSECTION: return "ARM_OVERLAYSECTION";
}
break;
case EM_X86_64:
switch (stype) {
case SHT_X86_64_UNWIND: return "X86_64_UNWIND";
@ -2264,9 +2285,10 @@ dump_phdr(struct readelf *re)
#define PH_HDR "Type", "Offset", "VirtAddr", "PhysAddr", "FileSiz", \
"MemSiz", "Flg", "Align"
#define PH_CT phdr_type(phdr.p_type), (uintmax_t)phdr.p_offset, \
(uintmax_t)phdr.p_vaddr, (uintmax_t)phdr.p_paddr, \
(uintmax_t)phdr.p_filesz, (uintmax_t)phdr.p_memsz, \
#define PH_CT phdr_type(re->ehdr.e_machine, phdr.p_type), \
(uintmax_t)phdr.p_offset, (uintmax_t)phdr.p_vaddr, \
(uintmax_t)phdr.p_paddr, (uintmax_t)phdr.p_filesz, \
(uintmax_t)phdr.p_memsz, \
phdr.p_flags & PF_R ? 'R' : ' ', \
phdr.p_flags & PF_W ? 'W' : ' ', \
phdr.p_flags & PF_X ? 'E' : ' ', \
@ -2757,6 +2779,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;
@ -2766,8 +2790,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)
@ -2793,12 +2817,35 @@ 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;
}
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));
}
}
}
}
@ -2813,6 +2860,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;
@ -2823,8 +2872,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)
@ -2851,6 +2900,12 @@ 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;
}
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s", RELA_CT64);
@ -2858,6 +2913,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));
}
}
}
}