Update to ELF Tool Chain r3475
Improvements include: * Add support for reporting and handling a number of new constants in various tools, including: * CloudABI OSABI * DT_TLSDESC_* * i386, MIPS, SPARC and amd64 relocations * C++ demangler bug fixes * Man page updates * Improved input validation in several tools This update also reduces diffs against upstream as a number of fixes included in upstream were previously cherry-picked into FreeBSD. Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
e1afa8a663
@ -40,7 +40,7 @@
|
||||
#include "uthash.h"
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: addr2line.c 3273 2015-12-11 21:38:57Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
struct Func {
|
||||
char *name;
|
||||
@ -284,7 +284,7 @@ collect_func(Dwarf_Debug dbg, Dwarf_Die die, struct Func *parent, struct CU *cu)
|
||||
&de) == DW_DLV_OK)
|
||||
goto add_func;
|
||||
|
||||
/* Skip if no name assoicated with this DIE. */
|
||||
/* Skip if no name associated with this DIE. */
|
||||
goto cont_search;
|
||||
|
||||
add_func:
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: brandelf.c 3354 2016-01-18 21:50:15Z jkoshy $");
|
||||
ELFTC_VCSID("$Id: brandelf.c 3440 2016-04-07 14:51:47Z emaste $");
|
||||
|
||||
static int elftype(const char *);
|
||||
static const char *iselftype(int);
|
||||
@ -62,6 +62,7 @@ static struct ELFtypes elftypes[] = {
|
||||
{ "AIX", ELFOSABI_AIX },
|
||||
{ "ARM", ELFOSABI_ARM },
|
||||
{ "AROS", ELFOSABI_AROS },
|
||||
{ "CloudABI", ELFOSABI_CLOUDABI },
|
||||
{ "FreeBSD", ELFOSABI_FREEBSD },
|
||||
{ "GNU", ELFOSABI_GNU },
|
||||
{ "HP/UX", ELFOSABI_HPUX},
|
||||
|
@ -23,11 +23,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: _elftc.h 3244 2015-08-31 19:53:08Z emaste $
|
||||
* $Id: _elftc.h 3446 2016-05-03 01:31:17Z emaste $
|
||||
*/
|
||||
|
||||
/**
|
||||
** Miscellanous definitions needed by multiple components.
|
||||
** Miscellaneous definitions needed by multiple components.
|
||||
**/
|
||||
|
||||
#ifndef _ELFTC_H
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: elfdefinitions.h 3392 2016-02-05 19:51:22Z emaste $
|
||||
* $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -184,6 +184,10 @@ _ELF_DEFINE_DT(DT_ADDRRNGLO, 0x6FFFFE00UL, \
|
||||
"start of range using the d_ptr field") \
|
||||
_ELF_DEFINE_DT(DT_GNU_HASH, 0x6FFFFEF5UL, \
|
||||
"GNU style hash tables") \
|
||||
_ELF_DEFINE_DT(DT_TLSDESC_PLT, 0x6FFFFEF6UL, \
|
||||
"location of PLT entry for TLS descriptor resolver calls") \
|
||||
_ELF_DEFINE_DT(DT_TLSDESC_GOT, 0x6FFFFEF7UL, \
|
||||
"location of GOT entry used by TLS descriptor resolver PLT entry") \
|
||||
_ELF_DEFINE_DT(DT_GNU_CONFLICT, 0x6FFFFEF8UL, \
|
||||
"address of conflict section") \
|
||||
_ELF_DEFINE_DT(DT_GNU_LIBLIST, 0x6FFFFEF9UL, \
|
||||
@ -269,7 +273,7 @@ _ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC, 0x7000001BUL, \
|
||||
_ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC_NO, 0x7000001CUL, \
|
||||
"number of entries in DT_MIPS_DELTA_RELOC") \
|
||||
_ELF_DEFINE_DT(DT_MIPS_DELTA_SYM, 0x7000001DUL, \
|
||||
"Delta symbols refered by Delta relocations") \
|
||||
"Delta symbols referred by Delta relocations") \
|
||||
_ELF_DEFINE_DT(DT_MIPS_DELTA_SYM_NO, 0x7000001EUL, \
|
||||
"number of entries in DT_MIPS_DELTA_SYM") \
|
||||
_ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM, 0x70000020UL, \
|
||||
@ -540,6 +544,7 @@ _ELF_DEFINE_EABI(ELFOSABI_NSK, 14, \
|
||||
_ELF_DEFINE_EABI(ELFOSABI_AROS, 15, "Amiga Research OS") \
|
||||
_ELF_DEFINE_EABI(ELFOSABI_FENIXOS, 16, \
|
||||
"The FenixOS highly scalable multi-core OS") \
|
||||
_ELF_DEFINE_EABI(ELFOSABI_CLOUDABI, 17, "Nuxi CloudABI") \
|
||||
_ELF_DEFINE_EABI(ELFOSABI_ARM_AEABI, 64, \
|
||||
"ARM specific symbol versioning extensions") \
|
||||
_ELF_DEFINE_EABI(ELFOSABI_ARM, 97, "ARM ABI") \
|
||||
@ -1193,7 +1198,7 @@ _ELF_DEFINE_SHT(SHT_MIPS_ABIFLAGS, 0x7000002AUL, \
|
||||
"ABI flags") \
|
||||
_ELF_DEFINE_SHT(SHT_SPARC_GOTDATA, 0x70000000UL, \
|
||||
"SPARC-specific data") \
|
||||
_ELF_DEFINE_SHT(SHT_AMD64_UNWIND, 0x70000001UL, \
|
||||
_ELF_DEFINE_SHT(SHT_X86_64_UNWIND, 0x70000001UL, \
|
||||
"unwind tables for the AMD64") \
|
||||
_ELF_DEFINE_SHT(SHT_ORDERED, 0x7FFFFFFFUL, \
|
||||
"sort entries in the section") \
|
||||
@ -1212,6 +1217,7 @@ enum {
|
||||
};
|
||||
|
||||
/* Aliases for section types. */
|
||||
#define SHT_AMD64_UNWIND SHT_X86_64_UNWIND
|
||||
#define SHT_GNU_verdef SHT_SUNW_verdef
|
||||
#define SHT_GNU_verneed SHT_SUNW_verneed
|
||||
#define SHT_GNU_versym SHT_SUNW_versym
|
||||
@ -1255,6 +1261,7 @@ _ELF_DEFINE_STT(STT_FILE, 4, "source file") \
|
||||
_ELF_DEFINE_STT(STT_COMMON, 5, "uninitialized common block") \
|
||||
_ELF_DEFINE_STT(STT_TLS, 6, "thread local storage") \
|
||||
_ELF_DEFINE_STT(STT_LOOS, 10, "start of OS-specific types") \
|
||||
_ELF_DEFINE_STT(STT_GNU_IFUNC, 10, "indirect function") \
|
||||
_ELF_DEFINE_STT(STT_HIOS, 12, "end of OS-specific types") \
|
||||
_ELF_DEFINE_STT(STT_LOPROC, 13, \
|
||||
"start of processor-specific types") \
|
||||
@ -1402,10 +1409,37 @@ _ELF_DEFINE_RELOC(R_386_RELATIVE, 8) \
|
||||
_ELF_DEFINE_RELOC(R_386_GOTOFF, 9) \
|
||||
_ELF_DEFINE_RELOC(R_386_GOTPC, 10) \
|
||||
_ELF_DEFINE_RELOC(R_386_32PLT, 11) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_TPOFF, 14) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_IE, 15) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GOTIE, 16) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LE, 17) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GD, 18) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDM, 19) \
|
||||
_ELF_DEFINE_RELOC(R_386_16, 20) \
|
||||
_ELF_DEFINE_RELOC(R_386_PC16, 21) \
|
||||
_ELF_DEFINE_RELOC(R_386_8, 22) \
|
||||
_ELF_DEFINE_RELOC(R_386_PC8, 23)
|
||||
_ELF_DEFINE_RELOC(R_386_PC8, 23) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GD_32, 24) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GD_PUSH, 25) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GD_CALL, 26) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GD_POP, 27) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDM_32, 28) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDM_PUSH, 29) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDM_CALL, 30) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDM_POP, 31) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LDO_32, 32) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_IE_32, 33) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_LE_32, 34) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_DTPMOD32, 35) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_DTPOFF32, 36) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_TPOFF32, 37) \
|
||||
_ELF_DEFINE_RELOC(R_386_SIZE32, 38) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_GOTDESC, 39) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_DESC_CALL, 40) \
|
||||
_ELF_DEFINE_RELOC(R_386_TLS_DESC, 41) \
|
||||
_ELF_DEFINE_RELOC(R_386_IRELATIVE, 42) \
|
||||
_ELF_DEFINE_RELOC(R_386_GOT32X, 43)
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
@ -1795,11 +1829,18 @@ _ELF_DEFINE_RELOC(R_MIPS_GOT16, 9) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_PC16, 10) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_CALL16, 11) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GPREL32, 12) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_SHIFT5, 16) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_SHIFT6, 17) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_64, 18) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOTHI16, 21) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOTLO16, 22) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOT_DISP, 19) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOT_PAGE, 20) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOT_OFST, 21) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOT_HI16, 22) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_GOT_LO16, 23) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_SUB, 24) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_CALLHI16, 30) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_CALLLO16, 31) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_JALR, 37) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD32, 38) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL32, 39) \
|
||||
_ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD64, 40) \
|
||||
@ -2095,6 +2136,7 @@ _ELF_DEFINE_RELOC(R_SPARC_PC_HM10, 38) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_PC_LM22, 39) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_WDISP16, 40) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_WDISP19, 41) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_GLOB_JMP, 42) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_7, 43) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_5, 44) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_6, 45) \
|
||||
@ -2108,6 +2150,30 @@ _ELF_DEFINE_RELOC(R_SPARC_L44, 52) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_REGISTER, 53) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_UA64, 54) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_UA16, 55) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_HI22, 56) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_LO10, 57) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_ADD, 58) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_CALL, 59) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_HI22, 60) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_LO10, 61) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_ADD, 62) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_CALL, 63) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_HIX22, 64) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_LOX10, 65) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_ADD, 66) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_HI22, 67) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LO10, 68) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LD, 69) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LDX, 70) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_ADD, 71) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LE_HIX22, 72) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_LE_LOX10, 73) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPMOD32, 74) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPMOD64, 75) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPOFF32, 76) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPOFF64, 77) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_TPOFF32, 78) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_TLS_TPOFF64, 79) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_GOTDATA_HIX22, 80) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_GOTDATA_LOX10, 81) \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_GOTDATA_OP_HIX22, 82) \
|
||||
@ -2153,7 +2219,10 @@ _ELF_DEFINE_RELOC(R_X86_64_SIZE64, 33) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_GOTPC32_TLSDESC, 34) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_TLSDESC_CALL, 35) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_TLSDESC, 36) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37)
|
||||
_ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_RELATIVE64, 38) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_GOTPCRELX, 41) \
|
||||
_ELF_DEFINE_RELOC(R_X86_64_REX_GOTPCRELX, 42)
|
||||
|
||||
#define _ELF_DEFINE_RELOCATIONS() \
|
||||
_ELF_DEFINE_386_RELOCATIONS() \
|
||||
@ -2424,7 +2493,7 @@ _ELF_DEFINE_ODK(ODK_HWOR, 8, "hardware OR patch applied") \
|
||||
_ELF_DEFINE_ODK(ODK_GP_GROUP, 9, \
|
||||
"GP group to use for text/data sections") \
|
||||
_ELF_DEFINE_ODK(ODK_IDENT, 10, "ID information") \
|
||||
_ELF_DEFINE_ODK(ODK_PAGESIZE, 11, "page size infomation")
|
||||
_ELF_DEFINE_ODK(ODK_PAGESIZE, 11, "page size information")
|
||||
|
||||
#undef _ELF_DEFINE_ODK
|
||||
#define _ELF_DEFINE_ODK(N, V, DESCR) N = V ,
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: cxxfilt.c 3356 2016-01-22 22:31:38Z jkoshy $");
|
||||
ELFTC_VCSID("$Id: cxxfilt.c 3454 2016-05-07 17:11:05Z kaiwang27 $");
|
||||
|
||||
#define STRBUFSZ 8192
|
||||
|
||||
@ -112,35 +112,18 @@ find_format(const char *fstr)
|
||||
}
|
||||
|
||||
static char *
|
||||
demangle(char *name, int strict, size_t *pos)
|
||||
demangle(char *name)
|
||||
{
|
||||
static char dem[STRBUFSZ];
|
||||
char nb[STRBUFSZ];
|
||||
size_t p, t;
|
||||
|
||||
if (stripus && *name == '_') {
|
||||
strncpy(nb, name + 1, sizeof(nb) - 1);
|
||||
t = 1;
|
||||
} else {
|
||||
strncpy(nb, name, sizeof(nb) - 1);
|
||||
t = 0;
|
||||
}
|
||||
nb[sizeof(nb) - 1] = '\0';
|
||||
if (stripus && *name == '_')
|
||||
name++;
|
||||
|
||||
p = strlen(nb);
|
||||
if (p == 0)
|
||||
return NULL;
|
||||
if (strlen(name) == 0)
|
||||
return (NULL);
|
||||
|
||||
while (elftc_demangle(nb, dem, sizeof(dem), (unsigned) format) < 0) {
|
||||
if (!strict && p > 1) {
|
||||
nb[--p] = '\0';
|
||||
continue;
|
||||
} else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (pos != NULL)
|
||||
*pos = t ? p + 1 : p;
|
||||
if (elftc_demangle(name, dem, sizeof(dem), (unsigned) format) < 0)
|
||||
return (NULL);
|
||||
|
||||
return (dem);
|
||||
}
|
||||
@ -149,7 +132,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *dem, buf[STRBUFSZ];
|
||||
size_t i, p, s;
|
||||
size_t p;
|
||||
int c, n, opt;
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "_nps:V", longopts, NULL)) !=
|
||||
@ -184,8 +167,8 @@ main(int argc, char **argv)
|
||||
|
||||
if (*argv != NULL) {
|
||||
for (n = 0; n < argc; n++) {
|
||||
if ((dem = demangle(argv[n], 1, NULL)) == NULL)
|
||||
fprintf(stderr, "Failed: %s\n", argv[n]);
|
||||
if ((dem = demangle(argv[n])) == NULL)
|
||||
printf("%s\n", argv[n]);
|
||||
else
|
||||
printf("%s\n", dem);
|
||||
}
|
||||
@ -193,23 +176,18 @@ main(int argc, char **argv)
|
||||
p = 0;
|
||||
for (;;) {
|
||||
c = fgetc(stdin);
|
||||
if (c == EOF || !isprint(c) || strchr(" \t\n", c)) {
|
||||
if (c == EOF || !(isalnum(c) || strchr(".$_", c))) {
|
||||
if (p > 0) {
|
||||
buf[p] = '\0';
|
||||
if ((dem = demangle(buf, 0, &s)) ==
|
||||
NULL)
|
||||
if ((dem = demangle(buf)) == NULL)
|
||||
printf("%s", buf);
|
||||
else {
|
||||
else
|
||||
printf("%s", dem);
|
||||
for (i = s; i < p; i++)
|
||||
putchar(buf[i]);
|
||||
}
|
||||
p = 0;
|
||||
}
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (isprint(c) || strchr(" \t\n", c))
|
||||
putchar(c);
|
||||
putchar(c);
|
||||
} else {
|
||||
if ((size_t) p >= sizeof(buf) - 1)
|
||||
warnx("buffer overflowed");
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: ascii.c 3177 2015-03-30 18:19:41Z emaste $");
|
||||
ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
static void append_data(struct section *s, const void *buf, size_t sz);
|
||||
static char hex_digit(uint8_t n);
|
||||
@ -187,7 +187,7 @@ create_srec(struct elfcopy *ecp, int ifd, int ofd, const char *ofn)
|
||||
if (elferr != 0)
|
||||
warnx("elf_nextscn failed: %s", elf_errmsg(elferr));
|
||||
|
||||
/* Generate S{7,8,9} end of block recrod. */
|
||||
/* Generate S{7,8,9} end of block record. */
|
||||
if (gelf_getehdr(e, &eh) == NULL)
|
||||
errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
|
||||
elf_errmsg(-1));
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: binary.c 3270 2015-12-11 18:48:56Z emaste $");
|
||||
ELFTC_VCSID("$Id: binary.c 3445 2016-04-20 19:08:30Z emaste $");
|
||||
|
||||
/*
|
||||
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
|
||||
|
@ -21,9 +21,9 @@
|
||||
.\" out of the use of this software, even if advised of the possibility of
|
||||
.\" such damage.
|
||||
.\"
|
||||
.\" $Id: elfcopy.1 3381 2016-01-30 19:39:47Z jkoshy $
|
||||
.\" $Id: elfcopy.1 3426 2016-03-05 13:32:28Z emaste $
|
||||
.\"
|
||||
.Dd January 29, 2016
|
||||
.Dd March 5, 2016
|
||||
.Os
|
||||
.Dt ELFCOPY 1
|
||||
.Sh NAME
|
||||
@ -67,7 +67,10 @@
|
||||
.Op Fl -change-section-vma Ar section Ns {+|-|=} Ns Ar val
|
||||
.Op Fl -extract-dwo
|
||||
.Op Fl -gap-fill Ns = Ns Ar val
|
||||
.Op Fl -globalize-symbol Ns = Ns ar symbolname
|
||||
.Op Fl -globalize-symbols Ns = Ns Ar filename
|
||||
.Op Fl -localize-hidden
|
||||
.Op Fl -localize-symbols Ns = Ns Ar filename
|
||||
.Op Fl -no-adjust-warnings | Fl -no-change-warnings
|
||||
.Op Fl -only-keep-debug
|
||||
.Op Fl -pad-to Ns = Ns Ar address
|
||||
@ -239,9 +242,21 @@ Copy only .dwo debug sections to the output file.
|
||||
Fill the gaps between sections with the byte value specified by
|
||||
the argument
|
||||
.Ar val .
|
||||
.It Fl -globalize-symbol Ns = Ns Ar symbolname
|
||||
Make the symbol named by argument
|
||||
.Ar symbolname
|
||||
global, so that it is visible outside of the file in which it is defined.
|
||||
.It Fl -globalize-symbols Ns = Ns Ar filename
|
||||
Make each symbol listed in the file specified by
|
||||
.Ar filename
|
||||
global.
|
||||
.It Fl -localize-hidden
|
||||
Make all hidden symbols local to the output file.
|
||||
This includes symbols with internal visiblity.
|
||||
.It Fl -localize-symbols Ns = Ns Ar filename
|
||||
Make each symbol listed in the file specified by
|
||||
.Ar filename
|
||||
local to the output file.
|
||||
.It Fl -no-adjust-warnings | Fl -no-change-warnings
|
||||
Do not issue a warning if the section specified by the options
|
||||
.Fl -change-section-address ,
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: elfcopy.h 3310 2016-01-10 09:10:54Z kaiwang27 $
|
||||
* $Id: elfcopy.h 3446 2016-05-03 01:31:17Z emaste $
|
||||
*/
|
||||
|
||||
#include <sys/queue.h>
|
||||
@ -178,7 +178,7 @@ struct elfcopy {
|
||||
Elftc_Bfd_Target_Flavor otf; /* flavour of output object */
|
||||
const char *otgt; /* output target name */
|
||||
int oec; /* elfclass of output object */
|
||||
unsigned char oed; /* endianess of output object */
|
||||
unsigned char oed; /* endianness of output object */
|
||||
int oem; /* EM_XXX of output object */
|
||||
int abi; /* OSABI of output object */
|
||||
Elf *ein; /* ELF descriptor of input object */
|
||||
@ -238,7 +238,7 @@ struct elfcopy {
|
||||
uint64_t *secndx; /* section index map. */
|
||||
uint64_t *symndx; /* symbol index map. */
|
||||
unsigned char *v_rel; /* symbols needed by relocation. */
|
||||
unsigned char *v_grp; /* symbols refered by section group. */
|
||||
unsigned char *v_grp; /* symbols referred by section group. */
|
||||
unsigned char *v_secsym; /* sections with section symbol. */
|
||||
STAILQ_HEAD(, segment) v_seg; /* list of segments. */
|
||||
STAILQ_HEAD(, sec_action) v_sac;/* list of section operations. */
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: main.c 3399 2016-02-12 18:07:56Z emaste $");
|
||||
ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
enum options
|
||||
{
|
||||
@ -209,6 +209,7 @@ static struct {
|
||||
{"openbsd", ELFOSABI_OPENBSD},
|
||||
{"openvms", ELFOSABI_OPENVMS},
|
||||
{"nsk", ELFOSABI_NSK},
|
||||
{"cloudabi", ELFOSABI_CLOUDABI},
|
||||
{"arm", ELFOSABI_ARM},
|
||||
{"standalone", ELFOSABI_STANDALONE},
|
||||
{NULL, 0}
|
||||
@ -235,7 +236,7 @@ static void strip_main(struct elfcopy *ecp, int argc, char **argv);
|
||||
static void strip_usage(void);
|
||||
|
||||
/*
|
||||
* An ELF object usually has a sturcture described by the
|
||||
* An ELF object usually has a structure described by the
|
||||
* diagram below.
|
||||
* _____________
|
||||
* | |
|
||||
@ -1446,7 +1447,7 @@ Usage: %s [options] infile [outfile]\n\
|
||||
sections.\n\
|
||||
--only-keep-debug Copy only debugging information.\n\
|
||||
--output-target=FORMAT Use the specified format for the output.\n\
|
||||
--pad-to=ADDRESS Pad the output object upto the given address.\n\
|
||||
--pad-to=ADDRESS Pad the output object up to the given address.\n\
|
||||
--prefix-alloc-sections=STRING\n\
|
||||
Prefix the section names of all the allocated\n\
|
||||
sections with STRING.\n\
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: sections.c 3346 2016-01-17 20:09:15Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: sections.c 3443 2016-04-15 18:57:54Z kaiwang27 $");
|
||||
|
||||
static void add_gnu_debuglink(struct elfcopy *ecp);
|
||||
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: segments.c 3397 2016-02-12 14:35:19Z emaste $");
|
||||
ELFTC_VCSID("$Id: segments.c 3449 2016-05-03 13:59:29Z emaste $");
|
||||
|
||||
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
|
||||
|
||||
@ -468,8 +468,7 @@ setup_phdr(struct elfcopy *ecp)
|
||||
{
|
||||
struct segment *seg;
|
||||
GElf_Phdr iphdr;
|
||||
size_t iphnum;
|
||||
int i;
|
||||
size_t iphnum, i;
|
||||
|
||||
if (elf_getphnum(ecp->ein, &iphnum) == 0)
|
||||
errx(EXIT_FAILURE, "elf_getphnum failed: %s",
|
||||
@ -485,7 +484,7 @@ setup_phdr(struct elfcopy *ecp)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; (size_t)i < iphnum; i++) {
|
||||
for (i = 0; i < iphnum; i++) {
|
||||
if (gelf_getphdr(ecp->ein, i, &iphdr) != &iphdr)
|
||||
errx(EXIT_FAILURE, "gelf_getphdr failed: %s",
|
||||
elf_errmsg(-1));
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: symbols.c 3376 2016-01-26 18:41:39Z emaste $");
|
||||
ELFTC_VCSID("$Id: symbols.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
/* Backwards compatibility for systems with older ELF definitions. */
|
||||
#ifndef STB_GNU_UNIQUE
|
||||
@ -168,7 +168,7 @@ is_needed_symbol(struct elfcopy *ecp, int i, GElf_Sym *s)
|
||||
if (BIT_ISSET(ecp->v_rel, i))
|
||||
return (1);
|
||||
|
||||
/* Symbols refered by COMDAT sections are needed. */
|
||||
/* Symbols referred by COMDAT sections are needed. */
|
||||
if (BIT_ISSET(ecp->v_grp, i))
|
||||
return (1);
|
||||
|
||||
@ -258,7 +258,7 @@ is_remove_symbol(struct elfcopy *ecp, size_t sc, int i, GElf_Sym *s,
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark symbols refered by relocation entries.
|
||||
* Mark symbols referred by relocation entries.
|
||||
*/
|
||||
static void
|
||||
mark_reloc_symbols(struct elfcopy *ecp, size_t sc)
|
||||
@ -1165,7 +1165,7 @@ lookup_symop_list(struct elfcopy *ecp, const char *name, unsigned int op)
|
||||
if ((s->op & op) == 0)
|
||||
continue;
|
||||
if (name == NULL || !strcmp(name, s->name))
|
||||
return (s);
|
||||
return (s);
|
||||
if ((ecp->flags & WILDCARD) == 0)
|
||||
continue;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
||||
|
||||
#include "_libdwarf.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libdwarf_abbrev.c 3136 2014-12-24 16:04:38Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: libdwarf_abbrev.c 3420 2016-02-27 02:14:05Z emaste $");
|
||||
|
||||
int
|
||||
_dwarf_abbrev_add(Dwarf_CU cu, uint64_t entry, uint64_t tag, uint8_t children,
|
||||
@ -115,9 +115,7 @@ _dwarf_abbrev_parse(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Unsigned *offset,
|
||||
assert(abp != NULL);
|
||||
|
||||
ds = _dwarf_find_section(dbg, ".debug_abbrev");
|
||||
assert(ds != NULL);
|
||||
|
||||
if (*offset >= ds->ds_size)
|
||||
if (ds == NULL || *offset >= ds->ds_size)
|
||||
return (DW_DLE_NO_ENTRY);
|
||||
|
||||
aboff = *offset;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "_libdwarf.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libdwarf_elf_init.c 3161 2015-02-15 21:43:36Z emaste $");
|
||||
ELFTC_VCSID("$Id: libdwarf_elf_init.c 3475 2016-05-18 18:11:26Z emaste $");
|
||||
|
||||
static const char *debug_name[] = {
|
||||
".debug_abbrev",
|
||||
@ -50,55 +50,81 @@ static const char *debug_name[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
_dwarf_elf_write_reloc(Dwarf_Debug dbg, Elf_Data *symtab_data, int endian,
|
||||
void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend,
|
||||
int is_rel)
|
||||
_dwarf_elf_apply_rel_reloc(Dwarf_Debug dbg, void *buf, uint64_t bufsize,
|
||||
Elf_Data *rel_data, Elf_Data *symtab_data, int endian)
|
||||
{
|
||||
Dwarf_Unsigned type;
|
||||
GElf_Rel rel;
|
||||
GElf_Sym sym;
|
||||
int size;
|
||||
size_t symndx;
|
||||
uint64_t offset;
|
||||
uint64_t addend;
|
||||
int size, j;
|
||||
|
||||
if (gelf_getsym(symtab_data, GELF_R_SYM(r_info), &sym) == NULL)
|
||||
return;
|
||||
if ((size = _dwarf_get_reloc_size(dbg, GELF_R_TYPE(r_info))) == 0)
|
||||
return; /* Unknown or non-absolute relocation. */
|
||||
if (is_rel) {
|
||||
uint64_t roffset = offset;
|
||||
j = 0;
|
||||
while (gelf_getrel(rel_data, j++, &rel) != NULL) {
|
||||
symndx = GELF_R_SYM(rel.r_info);
|
||||
type = GELF_R_TYPE(rel.r_info);
|
||||
|
||||
if (gelf_getsym(symtab_data, symndx, &sym) == NULL)
|
||||
continue;
|
||||
|
||||
size = _dwarf_get_reloc_size(dbg, type);
|
||||
if (size == 0)
|
||||
continue; /* Unknown or non-absolute relocation. */
|
||||
|
||||
offset = rel.r_offset;
|
||||
if (offset + size >= bufsize)
|
||||
continue;
|
||||
|
||||
if (endian == ELFDATA2MSB)
|
||||
r_addend = _dwarf_read_msb(buf, &roffset, size);
|
||||
addend = _dwarf_read_msb(buf, &offset, size);
|
||||
else
|
||||
r_addend = _dwarf_read_lsb(buf, &roffset, size);
|
||||
addend = _dwarf_read_lsb(buf, &offset, size);
|
||||
|
||||
offset = rel.r_offset;
|
||||
if (endian == ELFDATA2MSB)
|
||||
_dwarf_write_msb(buf, &offset, sym.st_value + addend,
|
||||
size);
|
||||
else
|
||||
_dwarf_write_lsb(buf, &offset, sym.st_value + addend,
|
||||
size);
|
||||
}
|
||||
if (endian == ELFDATA2MSB)
|
||||
_dwarf_write_msb(buf, &offset, sym.st_value + r_addend, size);
|
||||
else
|
||||
_dwarf_write_lsb(buf, &offset, sym.st_value + r_addend, size);
|
||||
}
|
||||
|
||||
static void
|
||||
_dwarf_elf_apply_rel_reloc(Dwarf_Debug dbg, void *buf, Elf_Data *rel_data,
|
||||
Elf_Data *symtab_data, int endian)
|
||||
{
|
||||
GElf_Rel rel;
|
||||
int j;
|
||||
|
||||
j = 0;
|
||||
while (gelf_getrel(rel_data, j++, &rel) != NULL)
|
||||
_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
|
||||
rel.r_offset, rel.r_info, 0, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_dwarf_elf_apply_rela_reloc(Dwarf_Debug dbg, void *buf, Elf_Data *rel_data,
|
||||
Elf_Data *symtab_data, int endian)
|
||||
_dwarf_elf_apply_rela_reloc(Dwarf_Debug dbg, void *buf, uint64_t bufsize,
|
||||
Elf_Data *rel_data, Elf_Data *symtab_data, int endian)
|
||||
{
|
||||
Dwarf_Unsigned type;
|
||||
GElf_Rela rela;
|
||||
int j;
|
||||
GElf_Sym sym;
|
||||
size_t symndx;
|
||||
uint64_t offset;
|
||||
int size, j;
|
||||
|
||||
j = 0;
|
||||
while (gelf_getrela(rel_data, j++, &rela) != NULL)
|
||||
_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
|
||||
rela.r_offset, rela.r_info, rela.r_addend, 0);
|
||||
while (gelf_getrela(rel_data, j++, &rela) != NULL) {
|
||||
symndx = GELF_R_SYM(rela.r_info);
|
||||
type = GELF_R_TYPE(rela.r_info);
|
||||
|
||||
if (gelf_getsym(symtab_data, symndx, &sym) == NULL)
|
||||
continue;
|
||||
|
||||
offset = rela.r_offset;
|
||||
size = _dwarf_get_reloc_size(dbg, type);
|
||||
if (size == 0)
|
||||
continue; /* Unknown or non-absolute relocation. */
|
||||
if (offset + size >= bufsize)
|
||||
continue;
|
||||
|
||||
if (endian == ELFDATA2MSB)
|
||||
_dwarf_write_msb(buf, &offset,
|
||||
sym.st_value + rela.r_addend, size);
|
||||
else
|
||||
_dwarf_write_lsb(buf, &offset,
|
||||
sym.st_value + rela.r_addend, size);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -150,10 +176,12 @@ _dwarf_elf_relocate(Dwarf_Debug dbg, Elf *elf, Dwarf_Elf_Data *ed, size_t shndx,
|
||||
memcpy(ed->ed_alloc, ed->ed_data->d_buf,
|
||||
ed->ed_data->d_size);
|
||||
if (sh.sh_type == SHT_REL)
|
||||
_dwarf_elf_apply_rel_reloc(dbg, ed->ed_alloc,
|
||||
_dwarf_elf_apply_rel_reloc(dbg,
|
||||
ed->ed_alloc, ed->ed_data->d_size,
|
||||
rel, symtab_data, eh.e_ident[EI_DATA]);
|
||||
else
|
||||
_dwarf_elf_apply_rela_reloc(dbg, ed->ed_alloc,
|
||||
_dwarf_elf_apply_rela_reloc(dbg,
|
||||
ed->ed_alloc, ed->ed_data->d_size,
|
||||
rel, symtab_data, eh.e_ident[EI_DATA]);
|
||||
|
||||
return (DW_DLE_NONE);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: _libelf_config.h 3396 2016-02-10 21:50:05Z emaste $
|
||||
* $Id: _libelf_config.h 3400 2016-02-12 18:38:49Z emaste $
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__) || defined(__DragonFly__)
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "_libelf.h"
|
||||
|
||||
ELFTC_VCSID("$Id: elf_data.c 3258 2015-11-20 18:59:43Z emaste $");
|
||||
ELFTC_VCSID("$Id: elf_data.c 3466 2016-05-11 18:35:44Z emaste $");
|
||||
|
||||
Elf_Data *
|
||||
elf_getdata(Elf_Scn *s, Elf_Data *ed)
|
||||
@ -94,7 +94,7 @@ elf_getdata(Elf_Scn *s, Elf_Data *ed)
|
||||
|
||||
if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST ||
|
||||
elftype > ELF_T_LAST || (sh_type != SHT_NOBITS &&
|
||||
sh_offset + sh_size > (uint64_t) e->e_rawsize)) {
|
||||
(sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset))) {
|
||||
LIBELF_SET_ERROR(SECTION, 0);
|
||||
return (NULL);
|
||||
}
|
||||
@ -254,7 +254,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *ed)
|
||||
}
|
||||
|
||||
if (sh_type != SHT_NOBITS &&
|
||||
sh_offset + sh_size > (uint64_t) e->e_rawsize) {
|
||||
(sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset)) {
|
||||
LIBELF_SET_ERROR(SECTION, 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "_libelf.h"
|
||||
#include "_libelf_ar.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelf_ar.c 3174 2015-03-27 17:13:41Z emaste $");
|
||||
ELFTC_VCSID("$Id: libelf_ar.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
#define LIBELF_NALLOC_SIZE 16
|
||||
|
||||
@ -64,7 +64,7 @@ ELFTC_VCSID("$Id: libelf_ar.c 3174 2015-03-27 17:13:41Z emaste $");
|
||||
* table where the actual file name of the object starts. Strings in
|
||||
* the string table are padded to start on even addresses.
|
||||
*
|
||||
* In the BSD format, file names can be upto 16 characters. File
|
||||
* In the BSD format, file names can be up to 16 characters. File
|
||||
* names shorter than 16 characters are padded to 16 characters using
|
||||
* (ASCII) space characters. File names with embedded spaces and file
|
||||
* names longer than 16 characters are stored immediately after the
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "_libelf.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelf_convert.m4 3174 2015-03-27 17:13:41Z emaste $");
|
||||
ELFTC_VCSID("$Id: libelf_convert.m4 3429 2016-03-12 04:12:39Z emaste $");
|
||||
|
||||
/* WARNING: GENERATED FROM __file__. */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile 3292 2016-01-06 21:46:32Z jkoshy $
|
||||
# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $
|
||||
|
||||
TOP= ${.CURDIR}/..
|
||||
|
||||
@ -7,6 +7,7 @@ LIB= elftc
|
||||
SRCS= elftc_bfdtarget.c \
|
||||
elftc_copyfile.c \
|
||||
elftc_demangle.c \
|
||||
elftc_reloc_type_str.c \
|
||||
elftc_set_timestamps.c \
|
||||
elftc_string_table.c \
|
||||
elftc_version.c \
|
||||
@ -34,6 +35,7 @@ MAN= elftc.3 \
|
||||
elftc_bfd_find_target.3 \
|
||||
elftc_copyfile.3 \
|
||||
elftc_demangle.3 \
|
||||
elftc_reloc_type_str.3 \
|
||||
elftc_set_timestamps.3 \
|
||||
elftc_string_table_create.3 \
|
||||
elftc_version.3
|
||||
|
72
contrib/elftoolchain/libelftc/elftc_reloc_type_str.3
Normal file
72
contrib/elftoolchain/libelftc/elftc_reloc_type_str.3
Normal file
@ -0,0 +1,72 @@
|
||||
.\" 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 February 19, 2016
|
||||
.Os
|
||||
.Dt ELFTC_RELOC_TYPE_STR 3
|
||||
.Sh NAME
|
||||
.Nm elftc_reloc_type_str
|
||||
.Nd return the type name for an ELF relocation
|
||||
.Sh LIBRARY
|
||||
.Lb libelftc
|
||||
.Sh SYNOPSIS
|
||||
.In libelftc.h
|
||||
.Ft const char *
|
||||
.Fo elftc_reloc_type_str
|
||||
.Fa "unsigned int mach"
|
||||
.Fa "unsigned int type"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
Function
|
||||
.Fn elftc_reloc_type_str
|
||||
returns the name for specified relocation type.
|
||||
.Pp
|
||||
Argument
|
||||
.Ar mach
|
||||
specifies the machine (architecture) type.
|
||||
Argument
|
||||
.Ar type
|
||||
specifies the relocation value.
|
||||
.Sh RETURN VALUE
|
||||
Function
|
||||
.Fn elftc_program_version
|
||||
returns a pointer to a string constant, or to an internal character buffer
|
||||
if the relocation type is unknown.
|
||||
.Sh EXAMPLES
|
||||
To print ARM relocation type 7, use:
|
||||
.Bd -literal -offset indent
|
||||
#include <sys/types.h>
|
||||
#include <libelftc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
(void) printf("%s\en", elftc_reloc_type_str(EM_ARM, 7));
|
||||
.Ed
|
||||
.Sh ERRORS
|
||||
Function
|
||||
.Fn elftc_reloc_type_str
|
||||
always succeeds.
|
684
contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
Normal file
684
contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
Normal file
@ -0,0 +1,684 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2015 Kai Wang
|
||||
* Copyright (c) 2016 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were 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 <libelftc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
const char *
|
||||
elftc_reloc_type_str(unsigned int mach, unsigned int type)
|
||||
{
|
||||
static char s_type[32];
|
||||
|
||||
switch(mach) {
|
||||
case EM_386:
|
||||
case EM_IAMCU:
|
||||
switch(type) {
|
||||
case 0: return "R_386_NONE";
|
||||
case 1: return "R_386_32";
|
||||
case 2: return "R_386_PC32";
|
||||
case 3: return "R_386_GOT32";
|
||||
case 4: return "R_386_PLT32";
|
||||
case 5: return "R_386_COPY";
|
||||
case 6: return "R_386_GLOB_DAT";
|
||||
case 7: return "R_386_JUMP_SLOT";
|
||||
case 8: return "R_386_RELATIVE";
|
||||
case 9: return "R_386_GOTOFF";
|
||||
case 10: return "R_386_GOTPC";
|
||||
case 11: return "R_386_32PLT"; /* Not in psabi */
|
||||
case 14: return "R_386_TLS_TPOFF";
|
||||
case 15: return "R_386_TLS_IE";
|
||||
case 16: return "R_386_TLS_GOTIE";
|
||||
case 17: return "R_386_TLS_LE";
|
||||
case 18: return "R_386_TLS_GD";
|
||||
case 19: return "R_386_TLS_LDM";
|
||||
case 20: return "R_386_16";
|
||||
case 21: return "R_386_PC16";
|
||||
case 22: return "R_386_8";
|
||||
case 23: return "R_386_PC8";
|
||||
case 24: return "R_386_TLS_GD_32";
|
||||
case 25: return "R_386_TLS_GD_PUSH";
|
||||
case 26: return "R_386_TLS_GD_CALL";
|
||||
case 27: return "R_386_TLS_GD_POP";
|
||||
case 28: return "R_386_TLS_LDM_32";
|
||||
case 29: return "R_386_TLS_LDM_PUSH";
|
||||
case 30: return "R_386_TLS_LDM_CALL";
|
||||
case 31: return "R_386_TLS_LDM_POP";
|
||||
case 32: return "R_386_TLS_LDO_32";
|
||||
case 33: return "R_386_TLS_IE_32";
|
||||
case 34: return "R_386_TLS_LE_32";
|
||||
case 35: return "R_386_TLS_DTPMOD32";
|
||||
case 36: return "R_386_TLS_DTPOFF32";
|
||||
case 37: return "R_386_TLS_TPOFF32";
|
||||
case 38: return "R_386_SIZE32";
|
||||
case 39: return "R_386_TLS_GOTDESC";
|
||||
case 40: return "R_386_TLS_DESC_CALL";
|
||||
case 41: return "R_386_TLS_DESC";
|
||||
case 42: return "R_386_IRELATIVE";
|
||||
case 43: return "R_386_GOT32X";
|
||||
}
|
||||
break;
|
||||
case EM_AARCH64:
|
||||
switch(type) {
|
||||
case 0: return "R_AARCH64_NONE";
|
||||
case 257: return "R_AARCH64_ABS64";
|
||||
case 258: return "R_AARCH64_ABS32";
|
||||
case 259: return "R_AARCH64_ABS16";
|
||||
case 260: return "R_AARCH64_PREL64";
|
||||
case 261: return "R_AARCH64_PREL32";
|
||||
case 262: return "R_AARCH64_PREL16";
|
||||
case 263: return "R_AARCH64_MOVW_UABS_G0";
|
||||
case 264: return "R_AARCH64_MOVW_UABS_G0_NC";
|
||||
case 265: return "R_AARCH64_MOVW_UABS_G1";
|
||||
case 266: return "R_AARCH64_MOVW_UABS_G1_NC";
|
||||
case 267: return "R_AARCH64_MOVW_UABS_G2";
|
||||
case 268: return "R_AARCH64_MOVW_UABS_G2_NC";
|
||||
case 269: return "R_AARCH64_MOVW_UABS_G3";
|
||||
case 270: return "R_AARCH64_MOVW_SABS_G0";
|
||||
case 271: return "R_AARCH64_MOVW_SABS_G1";
|
||||
case 272: return "R_AARCH64_MOVW_SABS_G2";
|
||||
case 273: return "R_AARCH64_LD_PREL_LO19";
|
||||
case 274: return "R_AARCH64_ADR_PREL_LO21";
|
||||
case 275: return "R_AARCH64_ADR_PREL_PG_HI21";
|
||||
case 276: return "R_AARCH64_ADR_PREL_PG_HI21_NC";
|
||||
case 277: return "R_AARCH64_ADD_ABS_LO12_NC";
|
||||
case 278: return "R_AARCH64_LDST8_ABS_LO12_NC";
|
||||
case 279: return "R_AARCH64_TSTBR14";
|
||||
case 280: return "R_AARCH64_CONDBR19";
|
||||
case 282: return "R_AARCH64_JUMP26";
|
||||
case 283: return "R_AARCH64_CALL26";
|
||||
case 284: return "R_AARCH64_LDST16_ABS_LO12_NC";
|
||||
case 285: return "R_AARCH64_LDST32_ABS_LO12_NC";
|
||||
case 286: return "R_AARCH64_LDST64_ABS_LO12_NC";
|
||||
case 287: return "R_AARCH64_MOVW_PREL_G0";
|
||||
case 288: return "R_AARCH64_MOVW_PREL_G0_NC";
|
||||
case 289: return "R_AARCH64_MOVW_PREL_G1";
|
||||
case 290: return "R_AARCH64_MOVW_PREL_G1_NC";
|
||||
case 291: return "R_AARCH64_MOVW_PREL_G2";
|
||||
case 292: return "R_AARCH64_MOVW_PREL_G2_NC";
|
||||
case 293: return "R_AARCH64_MOVW_PREL_G3";
|
||||
case 299: return "R_AARCH64_LDST128_ABS_LO12_NC";
|
||||
case 300: return "R_AARCH64_MOVW_GOTOFF_G0";
|
||||
case 301: return "R_AARCH64_MOVW_GOTOFF_G0_NC";
|
||||
case 302: return "R_AARCH64_MOVW_GOTOFF_G1";
|
||||
case 303: return "R_AARCH64_MOVW_GOTOFF_G1_NC";
|
||||
case 304: return "R_AARCH64_MOVW_GOTOFF_G2";
|
||||
case 305: return "R_AARCH64_MOVW_GOTOFF_G2_NC";
|
||||
case 306: return "R_AARCH64_MOVW_GOTOFF_G3";
|
||||
case 307: return "R_AARCH64_GOTREL64";
|
||||
case 308: return "R_AARCH64_GOTREL32";
|
||||
case 309: return "R_AARCH64_GOT_LD_PREL19";
|
||||
case 310: return "R_AARCH64_LD64_GOTOFF_LO15";
|
||||
case 311: return "R_AARCH64_ADR_GOT_PAGE";
|
||||
case 312: return "R_AARCH64_LD64_GOT_LO12_NC";
|
||||
case 313: return "R_AARCH64_LD64_GOTPAGE_LO15";
|
||||
case 560: return "R_AARCH64_TLSDESC_LD_PREL19";
|
||||
case 561: return "R_AARCH64_TLSDESC_ADR_PREL21";
|
||||
case 562: return "R_AARCH64_TLSDESC_ADR_PAGE21";
|
||||
case 563: return "R_AARCH64_TLSDESC_LD64_LO12";
|
||||
case 564: return "R_AARCH64_TLSDESC_ADD_LO12";
|
||||
case 565: return "R_AARCH64_TLSDESC_OFF_G1";
|
||||
case 566: return "R_AARCH64_TLSDESC_OFF_G0_NC";
|
||||
case 567: return "R_AARCH64_TLSDESC_LDR";
|
||||
case 568: return "R_AARCH64_TLSDESC_ADD";
|
||||
case 569: return "R_AARCH64_TLSDESC_CALL";
|
||||
case 1024: return "R_AARCH64_COPY";
|
||||
case 1025: return "R_AARCH64_GLOB_DAT";
|
||||
case 1026: return "R_AARCH64_JUMP_SLOT";
|
||||
case 1027: return "R_AARCH64_RELATIVE";
|
||||
case 1028: return "R_AARCH64_TLS_DTPREL64";
|
||||
case 1029: return "R_AARCH64_TLS_DTPMOD64";
|
||||
case 1030: return "R_AARCH64_TLS_TPREL64";
|
||||
case 1031: return "R_AARCH64_TLSDESC";
|
||||
case 1032: return "R_AARCH64_IRELATIVE";
|
||||
}
|
||||
break;
|
||||
case EM_ARM:
|
||||
switch(type) {
|
||||
case 0: return "R_ARM_NONE";
|
||||
case 1: return "R_ARM_PC24"; /* Deprecated */
|
||||
case 2: return "R_ARM_ABS32";
|
||||
case 3: return "R_ARM_REL32";
|
||||
case 4: return "R_ARM_LDR_PC_G0"; /* Also R_ARM_PC13 */
|
||||
case 5: return "R_ARM_ABS16";
|
||||
case 6: return "R_ARM_ABS12";
|
||||
case 7: return "R_ARM_THM_ABS5";
|
||||
case 8: return "R_ARM_ABS8";
|
||||
case 9: return "R_ARM_SBREL32";
|
||||
case 10: return "R_ARM_THM_CALL"; /* Also R_ARM_THM_PC22 */
|
||||
case 11: return "R_ARM_THM_PC8";
|
||||
case 12: return "R_ARM_BREL_ADJ"; /* Also R_ARM_AMP_VCALL9 */
|
||||
case 13: return "R_ARM_TLS_DESC"; /* Also R_ARM_SWI24 */
|
||||
case 14: return "R_ARM_THM_SWI8"; /* Obsolete */
|
||||
case 15: return "R_ARM_XPC25"; /* Obsolete */
|
||||
case 16: return "R_ARM_THM_XPC22"; /* Obsolete */
|
||||
case 17: return "R_ARM_TLS_DTPMOD32";
|
||||
case 18: return "R_ARM_TLS_DTPOFF32";
|
||||
case 19: return "R_ARM_TLS_TPOFF32";
|
||||
case 20: return "R_ARM_COPY";
|
||||
case 21: return "R_ARM_GLOB_DAT";
|
||||
case 22: return "R_ARM_JUMP_SLOT";
|
||||
case 23: return "R_ARM_RELATIVE";
|
||||
case 24: return "R_ARM_GOTOFF32"; /* Also R_ARM_GOTOFF */
|
||||
case 25: return "R_ARM_BASE_PREL"; /* GNU R_ARM_GOTPC */
|
||||
case 26: return "R_ARM_GOT_BREL"; /* GNU R_ARM_GOT32 */
|
||||
case 27: return "R_ARM_PLT32"; /* Deprecated */
|
||||
case 28: return "R_ARM_CALL";
|
||||
case 29: return "R_ARM_JUMP24";
|
||||
case 30: return "R_ARM_THM_JUMP24";
|
||||
case 31: return "R_ARM_BASE_ABS";
|
||||
case 32: return "R_ARM_ALU_PCREL_7_0"; /* Obsolete */
|
||||
case 33: return "R_ARM_ALU_PCREL_15_8"; /* Obsolete */
|
||||
case 34: return "R_ARM_ALU_PCREL_23_15"; /* Obsolete */
|
||||
case 35: return "R_ARM_LDR_SBREL_11_0_NC"; /* Deprecated */
|
||||
case 36: return "R_ARM_ALU_SBREL_19_12_NC"; /* Deprecated */
|
||||
case 37: return "R_ARM_ALU_SBREL_27_20_CK"; /* Deprecated */
|
||||
case 38: return "R_ARM_TARGET1";
|
||||
case 39: return "R_ARM_SBREL31"; /* Deprecated. */
|
||||
case 40: return "R_ARM_V4BX";
|
||||
case 41: return "R_ARM_TARGET2";
|
||||
case 42: return "R_ARM_PREL31";
|
||||
case 43: return "R_ARM_MOVW_ABS_NC";
|
||||
case 44: return "R_ARM_MOVT_ABS";
|
||||
case 45: return "R_ARM_MOVW_PREL_NC";
|
||||
case 46: return "R_ARM_MOVT_PREL";
|
||||
case 47: return "R_ARM_THM_MOVW_ABS_NC";
|
||||
case 48: return "R_ARM_THM_MOVT_ABS";
|
||||
case 49: return "R_ARM_THM_MOVW_PREL_NC";
|
||||
case 50: return "R_ARM_THM_MOVT_PREL";
|
||||
case 51: return "R_ARM_THM_JUMP19";
|
||||
case 52: return "R_ARM_THM_JUMP6";
|
||||
case 53: return "R_ARM_THM_ALU_PREL_11_0";
|
||||
case 54: return "R_ARM_THM_PC12";
|
||||
case 55: return "R_ARM_ABS32_NOI";
|
||||
case 56: return "R_ARM_REL32_NOI";
|
||||
case 57: return "R_ARM_ALU_PC_G0_NC";
|
||||
case 58: return "R_ARM_ALU_PC_G0";
|
||||
case 59: return "R_ARM_ALU_PC_G1_NC";
|
||||
case 60: return "R_ARM_ALU_PC_G1";
|
||||
case 61: return "R_ARM_ALU_PC_G2";
|
||||
case 62: return "R_ARM_LDR_PC_G1";
|
||||
case 63: return "R_ARM_LDR_PC_G2";
|
||||
case 64: return "R_ARM_LDRS_PC_G0";
|
||||
case 65: return "R_ARM_LDRS_PC_G1";
|
||||
case 66: return "R_ARM_LDRS_PC_G2";
|
||||
case 67: return "R_ARM_LDC_PC_G0";
|
||||
case 68: return "R_ARM_LDC_PC_G1";
|
||||
case 69: return "R_ARM_LDC_PC_G2";
|
||||
case 70: return "R_ARM_ALU_SB_G0_NC";
|
||||
case 71: return "R_ARM_ALU_SB_G0";
|
||||
case 72: return "R_ARM_ALU_SB_G1_NC";
|
||||
case 73: return "R_ARM_ALU_SB_G1";
|
||||
case 74: return "R_ARM_ALU_SB_G2";
|
||||
case 75: return "R_ARM_LDR_SB_G0";
|
||||
case 76: return "R_ARM_LDR_SB_G1";
|
||||
case 77: return "R_ARM_LDR_SB_G2";
|
||||
case 78: return "R_ARM_LDRS_SB_G0";
|
||||
case 79: return "R_ARM_LDRS_SB_G1";
|
||||
case 80: return "R_ARM_LDRS_SB_G2";
|
||||
case 81: return "R_ARM_LDC_SB_G0";
|
||||
case 82: return "R_ARM_LDC_SB_G1";
|
||||
case 83: return "R_ARM_LDC_SB_G2";
|
||||
case 84: return "R_ARM_MOVW_BREL_NC";
|
||||
case 85: return "R_ARM_MOVT_BREL";
|
||||
case 86: return "R_ARM_MOVW_BREL";
|
||||
case 87: return "R_ARM_THM_MOVW_BREL_NC";
|
||||
case 88: return "R_ARM_THM_MOVT_BREL";
|
||||
case 89: return "R_ARM_THM_MOVW_BREL";
|
||||
case 90: return "R_ARM_TLS_GOTDESC";
|
||||
case 91: return "R_ARM_TLS_CALL";
|
||||
case 92: return "R_ARM_TLS_DESCSEQ";
|
||||
case 93: return "R_ARM_THM_TLS_CALL";
|
||||
case 94: return "R_ARM_PLT32_ABS";
|
||||
case 95: return "R_ARM_GOT_ABS";
|
||||
case 96: return "R_ARM_GOT_PREL";
|
||||
case 97: return "R_ARM_GOT_BREL12";
|
||||
case 98: return "R_ARM_GOTOFF12";
|
||||
case 99: return "R_ARM_GOTRELAX";
|
||||
case 100: return "R_ARM_GNU_VTENTRY";
|
||||
case 101: return "R_ARM_GNU_VTINHERIT";
|
||||
case 102: return "R_ARM_THM_JUMP11"; /* Also R_ARM_THM_PC11 */
|
||||
case 103: return "R_ARM_THM_JUMP8"; /* Also R_ARM_THM_PC9 */
|
||||
case 104: return "R_ARM_TLS_GD32";
|
||||
case 105: return "R_ARM_TLS_LDM32";
|
||||
case 106: return "R_ARM_TLS_LDO32";
|
||||
case 107: return "R_ARM_TLS_IE32";
|
||||
case 108: return "R_ARM_TLS_LE32";
|
||||
case 109: return "R_ARM_TLS_LDO12";
|
||||
case 110: return "R_ARM_TLS_LE12";
|
||||
case 111: return "R_ARM_TLS_IE12GP";
|
||||
/* 112-127 R_ARM_PRIVATE_<n> */
|
||||
case 128: return "R_ARM_ME_TOO"; /* Obsolete */
|
||||
case 129: return "R_ARM_THM_TLS_DESCSEQ16";
|
||||
case 130: return "R_ARM_THM_TLS_DESCSEQ32";
|
||||
case 131: return "R_ARM_THM_GOT_BREL12";
|
||||
case 132: return "R_ARM_THM_ALU_ABS_G0_NC";
|
||||
case 133: return "R_ARM_THM_ALU_ABS_G1_NC";
|
||||
case 134: return "R_ARM_THM_ALU_ABS_G2_NC";
|
||||
case 135: return "R_ARM_THM_ALU_ABS_G3";
|
||||
/* 136-159 Reserved for future allocation. */
|
||||
case 160: return "R_ARM_IRELATIVE";
|
||||
/* 161-255 Reserved for future allocation. */
|
||||
case 249: return "R_ARM_RXPC25";
|
||||
case 250: return "R_ARM_RSBREL32";
|
||||
case 251: return "R_ARM_THM_RPC22";
|
||||
case 252: return "R_ARM_RREL32";
|
||||
case 253: return "R_ARM_RABS32";
|
||||
case 254: return "R_ARM_RPC24";
|
||||
case 255: return "R_ARM_RBASE";
|
||||
}
|
||||
break;
|
||||
case EM_IA_64:
|
||||
switch(type) {
|
||||
case 0: return "R_IA_64_NONE";
|
||||
case 33: return "R_IA_64_IMM14";
|
||||
case 34: return "R_IA_64_IMM22";
|
||||
case 35: return "R_IA_64_IMM64";
|
||||
case 36: return "R_IA_64_DIR32MSB";
|
||||
case 37: return "R_IA_64_DIR32LSB";
|
||||
case 38: return "R_IA_64_DIR64MSB";
|
||||
case 39: return "R_IA_64_DIR64LSB";
|
||||
case 42: return "R_IA_64_GPREL22";
|
||||
case 43: return "R_IA_64_GPREL64I";
|
||||
case 44: return "R_IA_64_GPREL32MSB";
|
||||
case 45: return "R_IA_64_GPREL32LSB";
|
||||
case 46: return "R_IA_64_GPREL64MSB";
|
||||
case 47: return "R_IA_64_GPREL64LSB";
|
||||
case 50: return "R_IA_64_LTOFF22";
|
||||
case 51: return "R_IA_64_LTOFF64I";
|
||||
case 58: return "R_IA_64_PLTOFF22";
|
||||
case 59: return "R_IA_64_PLTOFF64I";
|
||||
case 62: return "R_IA_64_PLTOFF64MSB";
|
||||
case 63: return "R_IA_64_PLTOFF64LSB";
|
||||
case 67: return "R_IA_64_FPTR64I";
|
||||
case 68: return "R_IA_64_FPTR32MSB";
|
||||
case 69: return "R_IA_64_FPTR32LSB";
|
||||
case 70: return "R_IA_64_FPTR64MSB";
|
||||
case 71: return "R_IA_64_FPTR64LSB";
|
||||
case 72: return "R_IA_64_PCREL60B";
|
||||
case 73: return "R_IA_64_PCREL21B";
|
||||
case 74: return "R_IA_64_PCREL21M";
|
||||
case 75: return "R_IA_64_PCREL21F";
|
||||
case 76: return "R_IA_64_PCREL32MSB";
|
||||
case 77: return "R_IA_64_PCREL32LSB";
|
||||
case 78: return "R_IA_64_PCREL64MSB";
|
||||
case 79: return "R_IA_64_PCREL64LSB";
|
||||
case 82: return "R_IA_64_LTOFF_FPTR22";
|
||||
case 83: return "R_IA_64_LTOFF_FPTR64I";
|
||||
case 84: return "R_IA_64_LTOFF_FPTR32MSB";
|
||||
case 85: return "R_IA_64_LTOFF_FPTR32LSB";
|
||||
case 86: return "R_IA_64_LTOFF_FPTR64MSB";
|
||||
case 87: return "R_IA_64_LTOFF_FPTR64LSB";
|
||||
case 92: return "R_IA_64_SEGREL32MSB";
|
||||
case 93: return "R_IA_64_SEGREL32LSB";
|
||||
case 94: return "R_IA_64_SEGREL64MSB";
|
||||
case 95: return "R_IA_64_SEGREL64LSB";
|
||||
case 100: return "R_IA_64_SECREL32MSB";
|
||||
case 101: return "R_IA_64_SECREL32LSB";
|
||||
case 102: return "R_IA_64_SECREL64MSB";
|
||||
case 103: return "R_IA_64_SECREL64LSB";
|
||||
case 108: return "R_IA_64_REL32MSB";
|
||||
case 109: return "R_IA_64_REL32LSB";
|
||||
case 110: return "R_IA_64_REL64MSB";
|
||||
case 111: return "R_IA_64_REL64LSB";
|
||||
case 116: return "R_IA_64_LTV32MSB";
|
||||
case 117: return "R_IA_64_LTV32LSB";
|
||||
case 118: return "R_IA_64_LTV64MSB";
|
||||
case 119: return "R_IA_64_LTV64LSB";
|
||||
case 121: return "R_IA_64_PCREL21BI";
|
||||
case 122: return "R_IA_64_PCREL22";
|
||||
case 123: return "R_IA_64_PCREL64I";
|
||||
case 128: return "R_IA_64_IPLTMSB";
|
||||
case 129: return "R_IA_64_IPLTLSB";
|
||||
case 133: return "R_IA_64_SUB";
|
||||
case 134: return "R_IA_64_LTOFF22X";
|
||||
case 135: return "R_IA_64_LDXMOV";
|
||||
case 145: return "R_IA_64_TPREL14";
|
||||
case 146: return "R_IA_64_TPREL22";
|
||||
case 147: return "R_IA_64_TPREL64I";
|
||||
case 150: return "R_IA_64_TPREL64MSB";
|
||||
case 151: return "R_IA_64_TPREL64LSB";
|
||||
case 154: return "R_IA_64_LTOFF_TPREL22";
|
||||
case 166: return "R_IA_64_DTPMOD64MSB";
|
||||
case 167: return "R_IA_64_DTPMOD64LSB";
|
||||
case 170: return "R_IA_64_LTOFF_DTPMOD22";
|
||||
case 177: return "R_IA_64_DTPREL14";
|
||||
case 178: return "R_IA_64_DTPREL22";
|
||||
case 179: return "R_IA_64_DTPREL64I";
|
||||
case 180: return "R_IA_64_DTPREL32MSB";
|
||||
case 181: return "R_IA_64_DTPREL32LSB";
|
||||
case 182: return "R_IA_64_DTPREL64MSB";
|
||||
case 183: return "R_IA_64_DTPREL64LSB";
|
||||
case 186: return "R_IA_64_LTOFF_DTPREL22";
|
||||
}
|
||||
break;
|
||||
case EM_MIPS:
|
||||
switch(type) {
|
||||
case 0: return "R_MIPS_NONE";
|
||||
case 1: return "R_MIPS_16";
|
||||
case 2: return "R_MIPS_32";
|
||||
case 3: return "R_MIPS_REL32";
|
||||
case 4: return "R_MIPS_26";
|
||||
case 5: return "R_MIPS_HI16";
|
||||
case 6: return "R_MIPS_LO16";
|
||||
case 7: return "R_MIPS_GPREL16";
|
||||
case 8: return "R_MIPS_LITERAL";
|
||||
case 9: return "R_MIPS_GOT16";
|
||||
case 10: return "R_MIPS_PC16";
|
||||
case 11: return "R_MIPS_CALL16";
|
||||
case 12: return "R_MIPS_GPREL32";
|
||||
case 16: return "R_MIPS_SHIFT5";
|
||||
case 17: return "R_MIPS_SHIFT6";
|
||||
case 18: return "R_MIPS_64";
|
||||
case 19: return "R_MIPS_GOT_DISP";
|
||||
case 20: return "R_MIPS_GOT_PAGE";
|
||||
case 21: return "R_MIPS_GOT_OFST";
|
||||
case 22: return "R_MIPS_GOT_HI16";
|
||||
case 23: return "R_MIPS_GOT_LO16";
|
||||
case 24: return "R_MIPS_SUB";
|
||||
case 30: return "R_MIPS_CALLHI16";
|
||||
case 31: return "R_MIPS_CALLLO16";
|
||||
case 37: return "R_MIPS_JALR";
|
||||
case 38: return "R_MIPS_TLS_DTPMOD32";
|
||||
case 39: return "R_MIPS_TLS_DTPREL32";
|
||||
case 40: return "R_MIPS_TLS_DTPMOD64";
|
||||
case 41: return "R_MIPS_TLS_DTPREL64";
|
||||
case 42: return "R_MIPS_TLS_GD";
|
||||
case 43: return "R_MIPS_TLS_LDM";
|
||||
case 44: return "R_MIPS_TLS_DTPREL_HI16";
|
||||
case 45: return "R_MIPS_TLS_DTPREL_LO16";
|
||||
case 46: return "R_MIPS_TLS_GOTTPREL";
|
||||
case 47: return "R_MIPS_TLS_TPREL32";
|
||||
case 48: return "R_MIPS_TLS_TPREL64";
|
||||
case 49: return "R_MIPS_TLS_TPREL_HI16";
|
||||
case 50: return "R_MIPS_TLS_TPREL_LO16";
|
||||
}
|
||||
break;
|
||||
case EM_PPC:
|
||||
switch(type) {
|
||||
case 0: return "R_PPC_NONE";
|
||||
case 1: return "R_PPC_ADDR32";
|
||||
case 2: return "R_PPC_ADDR24";
|
||||
case 3: return "R_PPC_ADDR16";
|
||||
case 4: return "R_PPC_ADDR16_LO";
|
||||
case 5: return "R_PPC_ADDR16_HI";
|
||||
case 6: return "R_PPC_ADDR16_HA";
|
||||
case 7: return "R_PPC_ADDR14";
|
||||
case 8: return "R_PPC_ADDR14_BRTAKEN";
|
||||
case 9: return "R_PPC_ADDR14_BRNTAKEN";
|
||||
case 10: return "R_PPC_REL24";
|
||||
case 11: return "R_PPC_REL14";
|
||||
case 12: return "R_PPC_REL14_BRTAKEN";
|
||||
case 13: return "R_PPC_REL14_BRNTAKEN";
|
||||
case 14: return "R_PPC_GOT16";
|
||||
case 15: return "R_PPC_GOT16_LO";
|
||||
case 16: return "R_PPC_GOT16_HI";
|
||||
case 17: return "R_PPC_GOT16_HA";
|
||||
case 18: return "R_PPC_PLTREL24";
|
||||
case 19: return "R_PPC_COPY";
|
||||
case 20: return "R_PPC_GLOB_DAT";
|
||||
case 21: return "R_PPC_JMP_SLOT";
|
||||
case 22: return "R_PPC_RELATIVE";
|
||||
case 23: return "R_PPC_LOCAL24PC";
|
||||
case 24: return "R_PPC_UADDR32";
|
||||
case 25: return "R_PPC_UADDR16";
|
||||
case 26: return "R_PPC_REL32";
|
||||
case 27: return "R_PPC_PLT32";
|
||||
case 28: return "R_PPC_PLTREL32";
|
||||
case 29: return "R_PPC_PLT16_LO";
|
||||
case 30: return "R_PPC_PLT16_HI";
|
||||
case 31: return "R_PPC_PLT16_HA";
|
||||
case 32: return "R_PPC_SDAREL16";
|
||||
case 33: return "R_PPC_SECTOFF";
|
||||
case 34: return "R_PPC_SECTOFF_LO";
|
||||
case 35: return "R_PPC_SECTOFF_HI";
|
||||
case 36: return "R_PPC_SECTOFF_HA";
|
||||
case 67: return "R_PPC_TLS";
|
||||
case 68: return "R_PPC_DTPMOD32";
|
||||
case 69: return "R_PPC_TPREL16";
|
||||
case 70: return "R_PPC_TPREL16_LO";
|
||||
case 71: return "R_PPC_TPREL16_HI";
|
||||
case 72: return "R_PPC_TPREL16_HA";
|
||||
case 73: return "R_PPC_TPREL32";
|
||||
case 74: return "R_PPC_DTPREL16";
|
||||
case 75: return "R_PPC_DTPREL16_LO";
|
||||
case 76: return "R_PPC_DTPREL16_HI";
|
||||
case 77: return "R_PPC_DTPREL16_HA";
|
||||
case 78: return "R_PPC_DTPREL32";
|
||||
case 79: return "R_PPC_GOT_TLSGD16";
|
||||
case 80: return "R_PPC_GOT_TLSGD16_LO";
|
||||
case 81: return "R_PPC_GOT_TLSGD16_HI";
|
||||
case 82: return "R_PPC_GOT_TLSGD16_HA";
|
||||
case 83: return "R_PPC_GOT_TLSLD16";
|
||||
case 84: return "R_PPC_GOT_TLSLD16_LO";
|
||||
case 85: return "R_PPC_GOT_TLSLD16_HI";
|
||||
case 86: return "R_PPC_GOT_TLSLD16_HA";
|
||||
case 87: return "R_PPC_GOT_TPREL16";
|
||||
case 88: return "R_PPC_GOT_TPREL16_LO";
|
||||
case 89: return "R_PPC_GOT_TPREL16_HI";
|
||||
case 90: return "R_PPC_GOT_TPREL16_HA";
|
||||
case 101: return "R_PPC_EMB_NADDR32";
|
||||
case 102: return "R_PPC_EMB_NADDR16";
|
||||
case 103: return "R_PPC_EMB_NADDR16_LO";
|
||||
case 104: return "R_PPC_EMB_NADDR16_HI";
|
||||
case 105: return "R_PPC_EMB_NADDR16_HA";
|
||||
case 106: return "R_PPC_EMB_SDAI16";
|
||||
case 107: return "R_PPC_EMB_SDA2I16";
|
||||
case 108: return "R_PPC_EMB_SDA2REL";
|
||||
case 109: return "R_PPC_EMB_SDA21";
|
||||
case 110: return "R_PPC_EMB_MRKREF";
|
||||
case 111: return "R_PPC_EMB_RELSEC16";
|
||||
case 112: return "R_PPC_EMB_RELST_LO";
|
||||
case 113: return "R_PPC_EMB_RELST_HI";
|
||||
case 114: return "R_PPC_EMB_RELST_HA";
|
||||
case 115: return "R_PPC_EMB_BIT_FLD";
|
||||
case 116: return "R_PPC_EMB_RELSDA";
|
||||
}
|
||||
break;
|
||||
case EM_RISCV:
|
||||
switch(type) {
|
||||
case 0: return "R_RISCV_NONE";
|
||||
case 1: return "R_RISCV_32";
|
||||
case 2: return "R_RISCV_64";
|
||||
case 3: return "R_RISCV_RELATIVE";
|
||||
case 4: return "R_RISCV_COPY";
|
||||
case 5: return "R_RISCV_JUMP_SLOT";
|
||||
case 6: return "R_RISCV_TLS_DTPMOD32";
|
||||
case 7: return "R_RISCV_TLS_DTPMOD64";
|
||||
case 8: return "R_RISCV_TLS_DTPREL32";
|
||||
case 9: return "R_RISCV_TLS_DTPREL64";
|
||||
case 10: return "R_RISCV_TLS_TPREL32";
|
||||
case 11: return "R_RISCV_TLS_TPREL64";
|
||||
case 16: return "R_RISCV_BRANCH";
|
||||
case 17: return "R_RISCV_JAL";
|
||||
case 18: return "R_RISCV_CALL";
|
||||
case 19: return "R_RISCV_CALL_PLT";
|
||||
case 20: return "R_RISCV_GOT_HI20";
|
||||
case 21: return "R_RISCV_TLS_GOT_HI20";
|
||||
case 22: return "R_RISCV_TLS_GD_HI20";
|
||||
case 23: return "R_RISCV_PCREL_HI20";
|
||||
case 24: return "R_RISCV_PCREL_LO12_I";
|
||||
case 25: return "R_RISCV_PCREL_LO12_S";
|
||||
case 26: return "R_RISCV_HI20";
|
||||
case 27: return "R_RISCV_LO12_I";
|
||||
case 28: return "R_RISCV_LO12_S";
|
||||
case 29: return "R_RISCV_TPREL_HI20";
|
||||
case 30: return "R_RISCV_TPREL_LO12_I";
|
||||
case 31: return "R_RISCV_TPREL_LO12_S";
|
||||
case 32: return "R_RISCV_TPREL_ADD";
|
||||
case 33: return "R_RISCV_ADD8";
|
||||
case 34: return "R_RISCV_ADD16";
|
||||
case 35: return "R_RISCV_ADD32";
|
||||
case 36: return "R_RISCV_ADD64";
|
||||
case 37: return "R_RISCV_SUB8";
|
||||
case 38: return "R_RISCV_SUB16";
|
||||
case 39: return "R_RISCV_SUB32";
|
||||
case 40: return "R_RISCV_SUB64";
|
||||
case 41: return "R_RISCV_GNU_VTINHERIT";
|
||||
case 42: return "R_RISCV_GNU_VTENTRY";
|
||||
case 43: return "R_RISCV_ALIGN";
|
||||
case 44: return "R_RISCV_RVC_BRANCH";
|
||||
case 45: return "R_RISCV_RVC_JUMP";
|
||||
}
|
||||
break;
|
||||
case EM_SPARC:
|
||||
case EM_SPARCV9:
|
||||
switch(type) {
|
||||
case 0: return "R_SPARC_NONE";
|
||||
case 1: return "R_SPARC_8";
|
||||
case 2: return "R_SPARC_16";
|
||||
case 3: return "R_SPARC_32";
|
||||
case 4: return "R_SPARC_DISP8";
|
||||
case 5: return "R_SPARC_DISP16";
|
||||
case 6: return "R_SPARC_DISP32";
|
||||
case 7: return "R_SPARC_WDISP30";
|
||||
case 8: return "R_SPARC_WDISP22";
|
||||
case 9: return "R_SPARC_HI22";
|
||||
case 10: return "R_SPARC_22";
|
||||
case 11: return "R_SPARC_13";
|
||||
case 12: return "R_SPARC_LO10";
|
||||
case 13: return "R_SPARC_GOT10";
|
||||
case 14: return "R_SPARC_GOT13";
|
||||
case 15: return "R_SPARC_GOT22";
|
||||
case 16: return "R_SPARC_PC10";
|
||||
case 17: return "R_SPARC_PC22";
|
||||
case 18: return "R_SPARC_WPLT30";
|
||||
case 19: return "R_SPARC_COPY";
|
||||
case 20: return "R_SPARC_GLOB_DAT";
|
||||
case 21: return "R_SPARC_JMP_SLOT";
|
||||
case 22: return "R_SPARC_RELATIVE";
|
||||
case 23: return "R_SPARC_UA32";
|
||||
case 24: return "R_SPARC_PLT32";
|
||||
case 25: return "R_SPARC_HIPLT22";
|
||||
case 26: return "R_SPARC_LOPLT10";
|
||||
case 27: return "R_SPARC_PCPLT32";
|
||||
case 28: return "R_SPARC_PCPLT22";
|
||||
case 29: return "R_SPARC_PCPLT10";
|
||||
case 30: return "R_SPARC_10";
|
||||
case 31: return "R_SPARC_11";
|
||||
case 32: return "R_SPARC_64";
|
||||
case 33: return "R_SPARC_OLO10";
|
||||
case 34: return "R_SPARC_HH22";
|
||||
case 35: return "R_SPARC_HM10";
|
||||
case 36: return "R_SPARC_LM22";
|
||||
case 37: return "R_SPARC_PC_HH22";
|
||||
case 38: return "R_SPARC_PC_HM10";
|
||||
case 39: return "R_SPARC_PC_LM22";
|
||||
case 40: return "R_SPARC_WDISP16";
|
||||
case 41: return "R_SPARC_WDISP19";
|
||||
case 42: return "R_SPARC_GLOB_JMP";
|
||||
case 43: return "R_SPARC_7";
|
||||
case 44: return "R_SPARC_5";
|
||||
case 45: return "R_SPARC_6";
|
||||
case 46: return "R_SPARC_DISP64";
|
||||
case 47: return "R_SPARC_PLT64";
|
||||
case 48: return "R_SPARC_HIX22";
|
||||
case 49: return "R_SPARC_LOX10";
|
||||
case 50: return "R_SPARC_H44";
|
||||
case 51: return "R_SPARC_M44";
|
||||
case 52: return "R_SPARC_L44";
|
||||
case 53: return "R_SPARC_REGISTER";
|
||||
case 54: return "R_SPARC_UA64";
|
||||
case 55: return "R_SPARC_UA16";
|
||||
case 56: return "R_SPARC_TLS_GD_HI22";
|
||||
case 57: return "R_SPARC_TLS_GD_LO10";
|
||||
case 58: return "R_SPARC_TLS_GD_ADD";
|
||||
case 59: return "R_SPARC_TLS_GD_CALL";
|
||||
case 60: return "R_SPARC_TLS_LDM_HI22";
|
||||
case 61: return "R_SPARC_TLS_LDM_LO10";
|
||||
case 62: return "R_SPARC_TLS_LDM_ADD";
|
||||
case 63: return "R_SPARC_TLS_LDM_CALL";
|
||||
case 64: return "R_SPARC_TLS_LDO_HIX22";
|
||||
case 65: return "R_SPARC_TLS_LDO_LOX10";
|
||||
case 66: return "R_SPARC_TLS_LDO_ADD";
|
||||
case 67: return "R_SPARC_TLS_IE_HI22";
|
||||
case 68: return "R_SPARC_TLS_IE_LO10";
|
||||
case 69: return "R_SPARC_TLS_IE_LD";
|
||||
case 70: return "R_SPARC_TLS_IE_LDX";
|
||||
case 71: return "R_SPARC_TLS_IE_ADD";
|
||||
case 72: return "R_SPARC_TLS_LE_HIX22";
|
||||
case 73: return "R_SPARC_TLS_LE_LOX10";
|
||||
case 74: return "R_SPARC_TLS_DTPMOD32";
|
||||
case 75: return "R_SPARC_TLS_DTPMOD64";
|
||||
case 76: return "R_SPARC_TLS_DTPOFF32";
|
||||
case 77: return "R_SPARC_TLS_DTPOFF64";
|
||||
case 78: return "R_SPARC_TLS_TPOFF32";
|
||||
case 79: return "R_SPARC_TLS_TPOFF64";
|
||||
}
|
||||
break;
|
||||
case EM_X86_64:
|
||||
switch(type) {
|
||||
case 0: return "R_X86_64_NONE";
|
||||
case 1: return "R_X86_64_64";
|
||||
case 2: return "R_X86_64_PC32";
|
||||
case 3: return "R_X86_64_GOT32";
|
||||
case 4: return "R_X86_64_PLT32";
|
||||
case 5: return "R_X86_64_COPY";
|
||||
case 6: return "R_X86_64_GLOB_DAT";
|
||||
case 7: return "R_X86_64_JUMP_SLOT";
|
||||
case 8: return "R_X86_64_RELATIVE";
|
||||
case 9: return "R_X86_64_GOTPCREL";
|
||||
case 10: return "R_X86_64_32";
|
||||
case 11: return "R_X86_64_32S";
|
||||
case 12: return "R_X86_64_16";
|
||||
case 13: return "R_X86_64_PC16";
|
||||
case 14: return "R_X86_64_8";
|
||||
case 15: return "R_X86_64_PC8";
|
||||
case 16: return "R_X86_64_DTPMOD64";
|
||||
case 17: return "R_X86_64_DTPOFF64";
|
||||
case 18: return "R_X86_64_TPOFF64";
|
||||
case 19: return "R_X86_64_TLSGD";
|
||||
case 20: return "R_X86_64_TLSLD";
|
||||
case 21: return "R_X86_64_DTPOFF32";
|
||||
case 22: return "R_X86_64_GOTTPOFF";
|
||||
case 23: return "R_X86_64_TPOFF32";
|
||||
case 24: return "R_X86_64_PC64";
|
||||
case 25: return "R_X86_64_GOTOFF64";
|
||||
case 26: return "R_X86_64_GOTPC32";
|
||||
case 27: return "R_X86_64_GOT64";
|
||||
case 28: return "R_X86_64_GOTPCREL64";
|
||||
case 29: return "R_X86_64_GOTPC64";
|
||||
case 30: return "R_X86_64_GOTPLT64";
|
||||
case 31: return "R_X86_64_PLTOFF64";
|
||||
case 32: return "R_X86_64_SIZE32";
|
||||
case 33: return "R_X86_64_SIZE64";
|
||||
case 34: return "R_X86_64_GOTPC32_TLSDESC";
|
||||
case 35: return "R_X86_64_TLSDESC_CALL";
|
||||
case 36: return "R_X86_64_TLSDESC";
|
||||
case 37: return "R_X86_64_IRELATIVE";
|
||||
case 38: return "R_X86_64_RELATIVE64";
|
||||
case 41: return "R_X86_64_GOTPCRELX";
|
||||
case 42: return "R_X86_64_REX_GOTPCRELX";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
|
||||
return (s_type);
|
||||
}
|
@ -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 3309 2016-01-10 09:10:51Z kaiwang27 $
|
||||
* $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $
|
||||
*/
|
||||
|
||||
#ifndef _LIBELFTC_H_
|
||||
@ -75,6 +75,7 @@ unsigned int elftc_bfd_target_machine(Elftc_Bfd_Target *_tgt);
|
||||
int elftc_copyfile(int _srcfd, int _dstfd);
|
||||
int elftc_demangle(const char *_mangledname, char *_buffer,
|
||||
size_t _bufsize, unsigned int _flags);
|
||||
const char *elftc_reloc_type_str(unsigned int mach, unsigned int type);
|
||||
int elftc_set_timestamps(const char *_filename, struct stat *_sb);
|
||||
Elftc_String_Table *elftc_string_table_create(int _hint);
|
||||
void elftc_string_table_destroy(Elftc_String_Table *_table);
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "_libelftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelftc_dem_arm.c 2065 2011-10-26 15:24:47Z jkoshy $");
|
||||
ELFTC_VCSID("$Id: libelftc_dem_arm.c 3447 2016-05-03 13:32:23Z emaste $");
|
||||
|
||||
/**
|
||||
* @file cpp_demangle_arm.c
|
||||
@ -1171,8 +1171,8 @@ read_type(struct demangle_data *d)
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ELFTC_ISDIGIT(*d->p))
|
||||
return (read_class(d));
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "_libelftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 2065 2011-10-26 15:24:47Z jkoshy $");
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3447 2016-05-03 13:32:23Z emaste $");
|
||||
|
||||
/**
|
||||
* @file cpp_demangle_gnu2.c
|
||||
@ -135,7 +135,7 @@ cpp_demangle_gnu2(const char *org)
|
||||
case ENCODE_OP_TI :
|
||||
case ENCODE_OP_VT :
|
||||
goto flat;
|
||||
};
|
||||
}
|
||||
|
||||
if (*d.p == 'F')
|
||||
++d.p;
|
||||
@ -315,7 +315,7 @@ is_cpp_mangled_gnu2(const char *org)
|
||||
rtn |= true;
|
||||
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1308,8 +1308,8 @@ read_type(struct demangle_data *d)
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ELFTC_ISDIGIT(*d->p))
|
||||
return (read_class(d));
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "_libelftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3291 2016-01-04 02:36:38Z emaste $");
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $");
|
||||
|
||||
/**
|
||||
* @file cpp_demangle.c
|
||||
@ -553,7 +553,7 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
||||
free(buf);
|
||||
++e_idx;
|
||||
break;
|
||||
};
|
||||
}
|
||||
--idx;
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
|
||||
return (cpp_demangle_push_str(ddata, "true", 4));
|
||||
default:
|
||||
return (0);
|
||||
};
|
||||
}
|
||||
|
||||
case 'd':
|
||||
++ddata->cur;
|
||||
@ -764,7 +764,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
|
||||
|
||||
default:
|
||||
return (0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1039,14 +1039,14 @@ cpp_demangle_read_expression(struct cpp_demangle_data *ddata)
|
||||
/* operator sizeof */
|
||||
ddata->cur += 2;
|
||||
return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6));
|
||||
};
|
||||
}
|
||||
|
||||
switch (*ddata->cur) {
|
||||
case 'L':
|
||||
return (cpp_demangle_read_expr_primary(ddata));
|
||||
case 'T':
|
||||
return (cpp_demangle_read_tmpl_param(ddata));
|
||||
};
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1421,7 +1421,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
||||
if (*ddata->cur == '\0')
|
||||
return (0);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return (cpp_demangle_read_name(ddata));
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ cpp_demangle_read_name(struct cpp_demangle_data *ddata)
|
||||
return (cpp_demangle_read_nested_name(ddata));
|
||||
case 'Z':
|
||||
return (cpp_demangle_read_local_name(ddata));
|
||||
};
|
||||
}
|
||||
|
||||
if (!vector_str_init(&v))
|
||||
return (0);
|
||||
@ -1594,7 +1594,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
|
||||
case 'K':
|
||||
ddata->mem_cst = true;
|
||||
break;
|
||||
};
|
||||
}
|
||||
++ddata->cur;
|
||||
}
|
||||
|
||||
@ -1622,7 +1622,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
|
||||
default:
|
||||
if (!cpp_demangle_read_uqname(ddata))
|
||||
goto clean;
|
||||
};
|
||||
}
|
||||
|
||||
if ((subst_str = vector_str_substr(output, p_idx,
|
||||
output->size - 1, &subst_str_len)) == NULL)
|
||||
@ -1947,7 +1947,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
|
||||
case SIMPLE_HASH('S', 't'):
|
||||
/* std:: */
|
||||
return (cpp_demangle_read_subst_std(ddata));
|
||||
};
|
||||
}
|
||||
|
||||
if (*(++ddata->cur) == '\0')
|
||||
return (0);
|
||||
@ -2095,7 +2095,7 @@ cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *ddata)
|
||||
return (cpp_demangle_read_expr_primary(ddata));
|
||||
case 'X':
|
||||
return (cpp_demangle_read_expression(ddata));
|
||||
};
|
||||
}
|
||||
|
||||
return (cpp_demangle_read_type(ddata, 0));
|
||||
}
|
||||
@ -2576,7 +2576,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
|
||||
goto clean;
|
||||
++ddata->cur;
|
||||
goto rtn;
|
||||
};
|
||||
}
|
||||
|
||||
if (!cpp_demangle_read_name(ddata))
|
||||
goto clean;
|
||||
@ -3040,7 +3040,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
|
||||
return (0);
|
||||
ddata->cur += 2;
|
||||
return (1);
|
||||
};
|
||||
}
|
||||
|
||||
/* vendor extened operator */
|
||||
if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) {
|
||||
@ -3086,7 +3086,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
|
||||
return (0);
|
||||
ddata->cur +=2;
|
||||
return (1);
|
||||
};
|
||||
}
|
||||
|
||||
/* source name */
|
||||
if (ELFTC_ISDIGIT(*ddata->cur) != 0)
|
||||
@ -3449,7 +3449,7 @@ hex_to_dec(char c)
|
||||
return (15);
|
||||
default:
|
||||
return (-1);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This script generates a project-wide version identifier for use by
|
||||
# the `elftc_version()' API.
|
||||
#
|
||||
# $Id: make-toolchain-version 3299 2016-01-09 19:58:46Z jkoshy $
|
||||
# $Id: make-toolchain-version 3414 2016-02-16 22:55:28Z jkoshy $
|
||||
|
||||
#
|
||||
# Defaults.
|
||||
@ -64,19 +64,25 @@ done
|
||||
curdir=`pwd`
|
||||
cd ${top} || usage "ERROR: Cannot change directory to \"${top}\"."
|
||||
|
||||
if [ -d .svn -o -d ../.svn ]; then # FreeBSD and SF.Net sources.
|
||||
versionstring=" svn:"$(svnversion)
|
||||
elif [ -d CVS ]; then # NetBSD.
|
||||
if [ -d CVS ]; then # Look for CVS (NetBSD).
|
||||
versionstring=" cvs:unknown"
|
||||
else # DragonFlyBSD.
|
||||
versionstring=" git:"$(git describe --all --dirty --long 2> /dev/null)
|
||||
|
||||
# Cannot determine an in-tree version number.
|
||||
if [ $? -ne 0 ]; then
|
||||
versionstring=""
|
||||
else # Try git (DragonFlyBSD).
|
||||
gitversion="$(git describe --all --dirty --long 2> /dev/null)"
|
||||
if [ -n "${gitversion}" ]; then
|
||||
versionstring=" git:${gitversion}"
|
||||
else # Assume an SVN checkout (SourceForge or FreeBSD).
|
||||
svnversion="$(svnversion)"
|
||||
if [ -n "${svnversion}" ]; then
|
||||
versionstring=" svn:$(svnversion)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${versionstring}" ]; then
|
||||
echo "ERROR: cannot determine a revision number." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${curdir} || usage "Cannot change back to ${curdir}."
|
||||
|
||||
#
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "_libpe.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libpe_section.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: libpe_section.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
PE_Scn *
|
||||
libpe_alloc_scn(PE *pe)
|
||||
@ -486,7 +486,7 @@ libpe_write_sections(PE *pe, off_t off)
|
||||
/*
|
||||
* Padding between sections. (padding always written
|
||||
* in case the the section headers or sections are
|
||||
* moved or shrinked.)
|
||||
* moved or shrunk.)
|
||||
*/
|
||||
assert(off <= sh->sh_rawptr);
|
||||
if (off < sh->sh_rawptr)
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pe.h 3312 2016-01-10 09:23:51Z kaiwang27 $
|
||||
* $Id: pe.h 3441 2016-04-07 15:04:20Z emaste $
|
||||
*/
|
||||
|
||||
#ifndef _PE_H_
|
||||
@ -88,6 +88,9 @@ typedef struct _PE_RichHdr {
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x1f0 /* Power PC LE */
|
||||
#define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1 /* Power PC floating point */
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x166 /* MIPS R4000 LE */
|
||||
#define IMAGE_FILE_MACHINE_RISCV32 0x5032 /* RISC-V 32-bit */
|
||||
#define IMAGE_FILE_MACHINE_RISCV64 0x5064 /* RISC-V 64-bit */
|
||||
#define IMAGE_FILE_MACHINE_RISCV128 0x5128 /* RISC-V 128-bit */
|
||||
#define IMAGE_FILE_MACHINE_SH3 0x1a2 /* Hitachi SH3 */
|
||||
#define IMAGE_FILE_MACHINE_SH3DSP 0x1a3 /* Hitachi SH3 DSP */
|
||||
#define IMAGE_FILE_MACHINE_SH4 0x1a6 /* Hitachi SH4 */
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: nm.c 3179 2015-03-31 19:38:56Z emaste $");
|
||||
ELFTC_VCSID("$Id: nm.c 3472 2016-05-17 20:11:16Z emaste $");
|
||||
|
||||
/* symbol information list */
|
||||
STAILQ_HEAD(sym_head, sym_entry);
|
||||
@ -790,7 +790,8 @@ is_sec_debug(const char *shname)
|
||||
};
|
||||
const char **p;
|
||||
|
||||
assert(shname != NULL && "shname is NULL");
|
||||
if (shname == NULL)
|
||||
return (false);
|
||||
|
||||
for (p = dbg_sec; *p; p++) {
|
||||
if (!strncmp(shname, *p, strlen(*p)))
|
||||
@ -1716,7 +1717,7 @@ sym_elem_print_all_sysv(char type, const char *sec, const GElf_Sym *sym,
|
||||
case STT_NOTYPE:
|
||||
default:
|
||||
printf("%18s|", "NOTYPE");
|
||||
};
|
||||
}
|
||||
|
||||
if (sym->st_size != 0)
|
||||
nm_opts.size_print_fn(sym);
|
||||
@ -1945,7 +1946,7 @@ sym_list_print_each(struct sym_entry *ep, struct sym_print_data *p,
|
||||
return;
|
||||
sec = p->s_table[ep->sym->st_shndx];
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
nm_opts.elem_print_fn(type, sec, ep->sym, ep->name);
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: readelf.c 3395 2016-02-10 16:29:44Z emaste $");
|
||||
ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $");
|
||||
|
||||
/* Backwards compatability for older FreeBSD releases. */
|
||||
#ifndef STB_GNU_UNIQUE
|
||||
@ -346,7 +346,6 @@ static const char *option_kind(uint8_t kind);
|
||||
static const char *phdr_type(unsigned int ptype);
|
||||
static const char *ppc_abi_fp(uint64_t fp);
|
||||
static const char *ppc_abi_vector(uint64_t vec);
|
||||
static const char *r_type(unsigned int mach, unsigned int type);
|
||||
static void readelf_usage(int status);
|
||||
static void readelf_version(void);
|
||||
static void search_loclist_at(struct readelf *re, Dwarf_Die die,
|
||||
@ -357,7 +356,8 @@ static void set_cu_context(struct readelf *re, Dwarf_Half psize,
|
||||
Dwarf_Half osize, Dwarf_Half ver);
|
||||
static const char *st_bind(unsigned int sbind);
|
||||
static const char *st_shndx(unsigned int shndx);
|
||||
static const char *st_type(unsigned int mach, unsigned int stype);
|
||||
static const char *st_type(unsigned int mach, unsigned int os,
|
||||
unsigned int stype);
|
||||
static const char *st_vis(unsigned int svis);
|
||||
static const char *top_tag(unsigned int tag);
|
||||
static void unload_sections(struct readelf *re);
|
||||
@ -439,6 +439,7 @@ elf_osabi(unsigned int abi)
|
||||
case ELFOSABI_OPENBSD: return "OpenBSD";
|
||||
case ELFOSABI_OPENVMS: return "OpenVMS";
|
||||
case ELFOSABI_NSK: return "NSK";
|
||||
case ELFOSABI_CLOUDABI: return "CloudABI";
|
||||
case ELFOSABI_ARM: return "ARM";
|
||||
case ELFOSABI_STANDALONE: return "StandAlone";
|
||||
default:
|
||||
@ -660,7 +661,7 @@ section_type(unsigned int mach, unsigned int stype)
|
||||
switch (mach) {
|
||||
case EM_X86_64:
|
||||
switch (stype) {
|
||||
case SHT_AMD64_UNWIND: return "AMD64_UNWIND";
|
||||
case SHT_X86_64_UNWIND: return "X86_64_UNWIND";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -930,6 +931,8 @@ dt_type(unsigned int mach, unsigned int dtype)
|
||||
case DT_SYMINSZ: return "SYMINSZ";
|
||||
case DT_SYMINENT: return "SYMINENT";
|
||||
case DT_GNU_HASH: return "GNU_HASH";
|
||||
case DT_TLSDESC_PLT: return "DT_TLSDESC_PLT";
|
||||
case DT_TLSDESC_GOT: return "DT_TLSDESC_GOT";
|
||||
case DT_GNU_CONFLICT: return "GNU_CONFLICT";
|
||||
case DT_GNU_LIBLIST: return "GNU_LIBLIST";
|
||||
case DT_CONFIG: return "CONFIG";
|
||||
@ -981,7 +984,7 @@ st_bind(unsigned int sbind)
|
||||
}
|
||||
|
||||
static const char *
|
||||
st_type(unsigned int mach, unsigned int stype)
|
||||
st_type(unsigned int mach, unsigned int os, unsigned int stype)
|
||||
{
|
||||
static char s_stype[32];
|
||||
|
||||
@ -994,10 +997,13 @@ st_type(unsigned int mach, unsigned int stype)
|
||||
case STT_COMMON: return "COMMON";
|
||||
case STT_TLS: return "TLS";
|
||||
default:
|
||||
if (stype >= STT_LOOS && stype <= STT_HIOS)
|
||||
if (stype >= STT_LOOS && stype <= STT_HIOS) {
|
||||
if ((os == ELFOSABI_GNU || os == ELFOSABI_FREEBSD) &&
|
||||
stype == STT_GNU_IFUNC)
|
||||
return "IFUNC";
|
||||
snprintf(s_stype, sizeof(s_stype), "OS+%#x",
|
||||
stype - STT_LOOS);
|
||||
else if (stype >= STT_LOPROC && stype <= STT_HIPROC) {
|
||||
} else if (stype >= STT_LOPROC && stype <= STT_HIPROC) {
|
||||
if (mach == EM_SPARCV9 && stype == STT_SPARC_REGISTER)
|
||||
return "REGISTER";
|
||||
snprintf(s_stype, sizeof(s_stype), "PROC+%#x",
|
||||
@ -1059,556 +1065,10 @@ static struct {
|
||||
{"OS NONCONF", 'O', SHF_OS_NONCONFORMING},
|
||||
{"GROUP", 'G', SHF_GROUP},
|
||||
{"TLS", 'T', SHF_TLS},
|
||||
{"COMPRESSED", 'C', SHF_COMPRESSED},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
static const char *
|
||||
r_type(unsigned int mach, unsigned int type)
|
||||
{
|
||||
static char s_type[32];
|
||||
|
||||
switch(mach) {
|
||||
case EM_386:
|
||||
case EM_IAMCU:
|
||||
switch(type) {
|
||||
case 0: return "R_386_NONE";
|
||||
case 1: return "R_386_32";
|
||||
case 2: return "R_386_PC32";
|
||||
case 3: return "R_386_GOT32";
|
||||
case 4: return "R_386_PLT32";
|
||||
case 5: return "R_386_COPY";
|
||||
case 6: return "R_386_GLOB_DAT";
|
||||
case 7: return "R_386_JUMP_SLOT";
|
||||
case 8: return "R_386_RELATIVE";
|
||||
case 9: return "R_386_GOTOFF";
|
||||
case 10: return "R_386_GOTPC";
|
||||
case 14: return "R_386_TLS_TPOFF";
|
||||
case 15: return "R_386_TLS_IE";
|
||||
case 16: return "R_386_TLS_GOTIE";
|
||||
case 17: return "R_386_TLS_LE";
|
||||
case 18: return "R_386_TLS_GD";
|
||||
case 19: return "R_386_TLS_LDM";
|
||||
case 24: return "R_386_TLS_GD_32";
|
||||
case 25: return "R_386_TLS_GD_PUSH";
|
||||
case 26: return "R_386_TLS_GD_CALL";
|
||||
case 27: return "R_386_TLS_GD_POP";
|
||||
case 28: return "R_386_TLS_LDM_32";
|
||||
case 29: return "R_386_TLS_LDM_PUSH";
|
||||
case 30: return "R_386_TLS_LDM_CALL";
|
||||
case 31: return "R_386_TLS_LDM_POP";
|
||||
case 32: return "R_386_TLS_LDO_32";
|
||||
case 33: return "R_386_TLS_IE_32";
|
||||
case 34: return "R_386_TLS_LE_32";
|
||||
case 35: return "R_386_TLS_DTPMOD32";
|
||||
case 36: return "R_386_TLS_DTPOFF32";
|
||||
case 37: return "R_386_TLS_TPOFF32";
|
||||
}
|
||||
break;
|
||||
case EM_AARCH64:
|
||||
switch(type) {
|
||||
case 0: return "R_AARCH64_NONE";
|
||||
case 257: return "R_AARCH64_ABS64";
|
||||
case 258: return "R_AARCH64_ABS32";
|
||||
case 259: return "R_AARCH64_ABS16";
|
||||
case 260: return "R_AARCH64_PREL64";
|
||||
case 261: return "R_AARCH64_PREL32";
|
||||
case 262: return "R_AARCH64_PREL16";
|
||||
case 263: return "R_AARCH64_MOVW_UABS_G0";
|
||||
case 264: return "R_AARCH64_MOVW_UABS_G0_NC";
|
||||
case 265: return "R_AARCH64_MOVW_UABS_G1";
|
||||
case 266: return "R_AARCH64_MOVW_UABS_G1_NC";
|
||||
case 267: return "R_AARCH64_MOVW_UABS_G2";
|
||||
case 268: return "R_AARCH64_MOVW_UABS_G2_NC";
|
||||
case 269: return "R_AARCH64_MOVW_UABS_G3";
|
||||
case 270: return "R_AARCH64_MOVW_SABS_G0";
|
||||
case 271: return "R_AARCH64_MOVW_SABS_G1";
|
||||
case 272: return "R_AARCH64_MOVW_SABS_G2";
|
||||
case 273: return "R_AARCH64_LD_PREL_LO19";
|
||||
case 274: return "R_AARCH64_ADR_PREL_LO21";
|
||||
case 275: return "R_AARCH64_ADR_PREL_PG_HI21";
|
||||
case 276: return "R_AARCH64_ADR_PREL_PG_HI21_NC";
|
||||
case 277: return "R_AARCH64_ADD_ABS_LO12_NC";
|
||||
case 278: return "R_AARCH64_LDST8_ABS_LO12_NC";
|
||||
case 279: return "R_AARCH64_TSTBR14";
|
||||
case 280: return "R_AARCH64_CONDBR19";
|
||||
case 282: return "R_AARCH64_JUMP26";
|
||||
case 283: return "R_AARCH64_CALL26";
|
||||
case 284: return "R_AARCH64_LDST16_ABS_LO12_NC";
|
||||
case 285: return "R_AARCH64_LDST32_ABS_LO12_NC";
|
||||
case 286: return "R_AARCH64_LDST64_ABS_LO12_NC";
|
||||
case 287: return "R_AARCH64_MOVW_PREL_G0";
|
||||
case 288: return "R_AARCH64_MOVW_PREL_G0_NC";
|
||||
case 289: return "R_AARCH64_MOVW_PREL_G1";
|
||||
case 290: return "R_AARCH64_MOVW_PREL_G1_NC";
|
||||
case 291: return "R_AARCH64_MOVW_PREL_G2";
|
||||
case 292: return "R_AARCH64_MOVW_PREL_G2_NC";
|
||||
case 293: return "R_AARCH64_MOVW_PREL_G3";
|
||||
case 299: return "R_AARCH64_LDST128_ABS_LO12_NC";
|
||||
case 300: return "R_AARCH64_MOVW_GOTOFF_G0";
|
||||
case 301: return "R_AARCH64_MOVW_GOTOFF_G0_NC";
|
||||
case 302: return "R_AARCH64_MOVW_GOTOFF_G1";
|
||||
case 303: return "R_AARCH64_MOVW_GOTOFF_G1_NC";
|
||||
case 304: return "R_AARCH64_MOVW_GOTOFF_G2";
|
||||
case 305: return "R_AARCH64_MOVW_GOTOFF_G2_NC";
|
||||
case 306: return "R_AARCH64_MOVW_GOTOFF_G3";
|
||||
case 307: return "R_AARCH64_GOTREL64";
|
||||
case 308: return "R_AARCH64_GOTREL32";
|
||||
case 309: return "R_AARCH64_GOT_LD_PREL19";
|
||||
case 310: return "R_AARCH64_LD64_GOTOFF_LO15";
|
||||
case 311: return "R_AARCH64_ADR_GOT_PAGE";
|
||||
case 312: return "R_AARCH64_LD64_GOT_LO12_NC";
|
||||
case 313: return "R_AARCH64_LD64_GOTPAGE_LO15";
|
||||
case 560: return "R_AARCH64_TLSDESC_LD_PREL19";
|
||||
case 561: return "R_AARCH64_TLSDESC_ADR_PREL21";
|
||||
case 562: return "R_AARCH64_TLSDESC_ADR_PAGE21";
|
||||
case 563: return "R_AARCH64_TLSDESC_LD64_LO12";
|
||||
case 564: return "R_AARCH64_TLSDESC_ADD_LO12";
|
||||
case 565: return "R_AARCH64_TLSDESC_OFF_G1";
|
||||
case 566: return "R_AARCH64_TLSDESC_OFF_G0_NC";
|
||||
case 567: return "R_AARCH64_TLSDESC_LDR";
|
||||
case 568: return "R_AARCH64_TLSDESC_ADD";
|
||||
case 569: return "R_AARCH64_TLSDESC_CALL";
|
||||
case 1024: return "R_AARCH64_COPY";
|
||||
case 1025: return "R_AARCH64_GLOB_DAT";
|
||||
case 1026: return "R_AARCH64_JUMP_SLOT";
|
||||
case 1027: return "R_AARCH64_RELATIVE";
|
||||
case 1028: return "R_AARCH64_TLS_DTPREL64";
|
||||
case 1029: return "R_AARCH64_TLS_DTPMOD64";
|
||||
case 1030: return "R_AARCH64_TLS_TPREL64";
|
||||
case 1031: return "R_AARCH64_TLSDESC";
|
||||
case 1032: return "R_AARCH64_IRELATIVE";
|
||||
}
|
||||
break;
|
||||
case EM_ARM:
|
||||
switch(type) {
|
||||
case 0: return "R_ARM_NONE";
|
||||
case 1: return "R_ARM_PC24";
|
||||
case 2: return "R_ARM_ABS32";
|
||||
case 3: return "R_ARM_REL32";
|
||||
case 4: return "R_ARM_PC13";
|
||||
case 5: return "R_ARM_ABS16";
|
||||
case 6: return "R_ARM_ABS12";
|
||||
case 7: return "R_ARM_THM_ABS5";
|
||||
case 8: return "R_ARM_ABS8";
|
||||
case 9: return "R_ARM_SBREL32";
|
||||
case 10: return "R_ARM_THM_PC22";
|
||||
case 11: return "R_ARM_THM_PC8";
|
||||
case 12: return "R_ARM_AMP_VCALL9";
|
||||
case 13: return "R_ARM_TLS_DESC";
|
||||
/* Obsolete R_ARM_SWI24 is also 13 */
|
||||
case 14: return "R_ARM_THM_SWI8";
|
||||
case 15: return "R_ARM_XPC25";
|
||||
case 16: return "R_ARM_THM_XPC22";
|
||||
case 17: return "R_ARM_TLS_DTPMOD32";
|
||||
case 18: return "R_ARM_TLS_DTPOFF32";
|
||||
case 19: return "R_ARM_TLS_TPOFF32";
|
||||
case 20: return "R_ARM_COPY";
|
||||
case 21: return "R_ARM_GLOB_DAT";
|
||||
case 22: return "R_ARM_JUMP_SLOT";
|
||||
case 23: return "R_ARM_RELATIVE";
|
||||
case 24: return "R_ARM_GOTOFF";
|
||||
case 25: return "R_ARM_GOTPC";
|
||||
case 26: return "R_ARM_GOT32";
|
||||
case 27: return "R_ARM_PLT32";
|
||||
case 28: return "R_ARM_CALL";
|
||||
case 29: return "R_ARM_JUMP24";
|
||||
case 30: return "R_ARM_THM_JUMP24";
|
||||
case 31: return "R_ARM_BASE_ABS";
|
||||
case 38: return "R_ARM_TARGET1";
|
||||
case 40: return "R_ARM_V4BX";
|
||||
case 42: return "R_ARM_PREL31";
|
||||
case 43: return "R_ARM_MOVW_ABS_NC";
|
||||
case 44: return "R_ARM_MOVT_ABS";
|
||||
case 45: return "R_ARM_MOVW_PREL_NC";
|
||||
case 46: return "R_ARM_MOVT_PREL";
|
||||
case 100: return "R_ARM_GNU_VTENTRY";
|
||||
case 101: return "R_ARM_GNU_VTINHERIT";
|
||||
case 250: return "R_ARM_RSBREL32";
|
||||
case 251: return "R_ARM_THM_RPC22";
|
||||
case 252: return "R_ARM_RREL32";
|
||||
case 253: return "R_ARM_RABS32";
|
||||
case 254: return "R_ARM_RPC24";
|
||||
case 255: return "R_ARM_RBASE";
|
||||
}
|
||||
break;
|
||||
case EM_IA_64:
|
||||
switch(type) {
|
||||
case 0: return "R_IA_64_NONE";
|
||||
case 33: return "R_IA_64_IMM14";
|
||||
case 34: return "R_IA_64_IMM22";
|
||||
case 35: return "R_IA_64_IMM64";
|
||||
case 36: return "R_IA_64_DIR32MSB";
|
||||
case 37: return "R_IA_64_DIR32LSB";
|
||||
case 38: return "R_IA_64_DIR64MSB";
|
||||
case 39: return "R_IA_64_DIR64LSB";
|
||||
case 42: return "R_IA_64_GPREL22";
|
||||
case 43: return "R_IA_64_GPREL64I";
|
||||
case 44: return "R_IA_64_GPREL32MSB";
|
||||
case 45: return "R_IA_64_GPREL32LSB";
|
||||
case 46: return "R_IA_64_GPREL64MSB";
|
||||
case 47: return "R_IA_64_GPREL64LSB";
|
||||
case 50: return "R_IA_64_LTOFF22";
|
||||
case 51: return "R_IA_64_LTOFF64I";
|
||||
case 58: return "R_IA_64_PLTOFF22";
|
||||
case 59: return "R_IA_64_PLTOFF64I";
|
||||
case 62: return "R_IA_64_PLTOFF64MSB";
|
||||
case 63: return "R_IA_64_PLTOFF64LSB";
|
||||
case 67: return "R_IA_64_FPTR64I";
|
||||
case 68: return "R_IA_64_FPTR32MSB";
|
||||
case 69: return "R_IA_64_FPTR32LSB";
|
||||
case 70: return "R_IA_64_FPTR64MSB";
|
||||
case 71: return "R_IA_64_FPTR64LSB";
|
||||
case 72: return "R_IA_64_PCREL60B";
|
||||
case 73: return "R_IA_64_PCREL21B";
|
||||
case 74: return "R_IA_64_PCREL21M";
|
||||
case 75: return "R_IA_64_PCREL21F";
|
||||
case 76: return "R_IA_64_PCREL32MSB";
|
||||
case 77: return "R_IA_64_PCREL32LSB";
|
||||
case 78: return "R_IA_64_PCREL64MSB";
|
||||
case 79: return "R_IA_64_PCREL64LSB";
|
||||
case 82: return "R_IA_64_LTOFF_FPTR22";
|
||||
case 83: return "R_IA_64_LTOFF_FPTR64I";
|
||||
case 84: return "R_IA_64_LTOFF_FPTR32MSB";
|
||||
case 85: return "R_IA_64_LTOFF_FPTR32LSB";
|
||||
case 86: return "R_IA_64_LTOFF_FPTR64MSB";
|
||||
case 87: return "R_IA_64_LTOFF_FPTR64LSB";
|
||||
case 92: return "R_IA_64_SEGREL32MSB";
|
||||
case 93: return "R_IA_64_SEGREL32LSB";
|
||||
case 94: return "R_IA_64_SEGREL64MSB";
|
||||
case 95: return "R_IA_64_SEGREL64LSB";
|
||||
case 100: return "R_IA_64_SECREL32MSB";
|
||||
case 101: return "R_IA_64_SECREL32LSB";
|
||||
case 102: return "R_IA_64_SECREL64MSB";
|
||||
case 103: return "R_IA_64_SECREL64LSB";
|
||||
case 108: return "R_IA_64_REL32MSB";
|
||||
case 109: return "R_IA_64_REL32LSB";
|
||||
case 110: return "R_IA_64_REL64MSB";
|
||||
case 111: return "R_IA_64_REL64LSB";
|
||||
case 116: return "R_IA_64_LTV32MSB";
|
||||
case 117: return "R_IA_64_LTV32LSB";
|
||||
case 118: return "R_IA_64_LTV64MSB";
|
||||
case 119: return "R_IA_64_LTV64LSB";
|
||||
case 121: return "R_IA_64_PCREL21BI";
|
||||
case 122: return "R_IA_64_PCREL22";
|
||||
case 123: return "R_IA_64_PCREL64I";
|
||||
case 128: return "R_IA_64_IPLTMSB";
|
||||
case 129: return "R_IA_64_IPLTLSB";
|
||||
case 133: return "R_IA_64_SUB";
|
||||
case 134: return "R_IA_64_LTOFF22X";
|
||||
case 135: return "R_IA_64_LDXMOV";
|
||||
case 145: return "R_IA_64_TPREL14";
|
||||
case 146: return "R_IA_64_TPREL22";
|
||||
case 147: return "R_IA_64_TPREL64I";
|
||||
case 150: return "R_IA_64_TPREL64MSB";
|
||||
case 151: return "R_IA_64_TPREL64LSB";
|
||||
case 154: return "R_IA_64_LTOFF_TPREL22";
|
||||
case 166: return "R_IA_64_DTPMOD64MSB";
|
||||
case 167: return "R_IA_64_DTPMOD64LSB";
|
||||
case 170: return "R_IA_64_LTOFF_DTPMOD22";
|
||||
case 177: return "R_IA_64_DTPREL14";
|
||||
case 178: return "R_IA_64_DTPREL22";
|
||||
case 179: return "R_IA_64_DTPREL64I";
|
||||
case 180: return "R_IA_64_DTPREL32MSB";
|
||||
case 181: return "R_IA_64_DTPREL32LSB";
|
||||
case 182: return "R_IA_64_DTPREL64MSB";
|
||||
case 183: return "R_IA_64_DTPREL64LSB";
|
||||
case 186: return "R_IA_64_LTOFF_DTPREL22";
|
||||
}
|
||||
break;
|
||||
case EM_MIPS:
|
||||
switch(type) {
|
||||
case 0: return "R_MIPS_NONE";
|
||||
case 1: return "R_MIPS_16";
|
||||
case 2: return "R_MIPS_32";
|
||||
case 3: return "R_MIPS_REL32";
|
||||
case 4: return "R_MIPS_26";
|
||||
case 5: return "R_MIPS_HI16";
|
||||
case 6: return "R_MIPS_LO16";
|
||||
case 7: return "R_MIPS_GPREL16";
|
||||
case 8: return "R_MIPS_LITERAL";
|
||||
case 9: return "R_MIPS_GOT16";
|
||||
case 10: return "R_MIPS_PC16";
|
||||
case 11: return "R_MIPS_CALL16";
|
||||
case 12: return "R_MIPS_GPREL32";
|
||||
case 21: return "R_MIPS_GOTHI16";
|
||||
case 22: return "R_MIPS_GOTLO16";
|
||||
case 30: return "R_MIPS_CALLHI16";
|
||||
case 31: return "R_MIPS_CALLLO16";
|
||||
case 38: return "R_MIPS_TLS_DTPMOD32";
|
||||
case 39: return "R_MIPS_TLS_DTPREL32";
|
||||
case 40: return "R_MIPS_TLS_DTPMOD64";
|
||||
case 41: return "R_MIPS_TLS_DTPREL64";
|
||||
case 42: return "R_MIPS_TLS_GD";
|
||||
case 43: return "R_MIPS_TLS_LDM";
|
||||
case 44: return "R_MIPS_TLS_DTPREL_HI16";
|
||||
case 45: return "R_MIPS_TLS_DTPREL_LO16";
|
||||
case 46: return "R_MIPS_TLS_GOTTPREL";
|
||||
case 47: return "R_MIPS_TLS_TPREL32";
|
||||
case 48: return "R_MIPS_TLS_TPREL64";
|
||||
case 49: return "R_MIPS_TLS_TPREL_HI16";
|
||||
case 50: return "R_MIPS_TLS_TPREL_LO16";
|
||||
}
|
||||
break;
|
||||
case EM_PPC:
|
||||
switch(type) {
|
||||
case 0: return "R_PPC_NONE";
|
||||
case 1: return "R_PPC_ADDR32";
|
||||
case 2: return "R_PPC_ADDR24";
|
||||
case 3: return "R_PPC_ADDR16";
|
||||
case 4: return "R_PPC_ADDR16_LO";
|
||||
case 5: return "R_PPC_ADDR16_HI";
|
||||
case 6: return "R_PPC_ADDR16_HA";
|
||||
case 7: return "R_PPC_ADDR14";
|
||||
case 8: return "R_PPC_ADDR14_BRTAKEN";
|
||||
case 9: return "R_PPC_ADDR14_BRNTAKEN";
|
||||
case 10: return "R_PPC_REL24";
|
||||
case 11: return "R_PPC_REL14";
|
||||
case 12: return "R_PPC_REL14_BRTAKEN";
|
||||
case 13: return "R_PPC_REL14_BRNTAKEN";
|
||||
case 14: return "R_PPC_GOT16";
|
||||
case 15: return "R_PPC_GOT16_LO";
|
||||
case 16: return "R_PPC_GOT16_HI";
|
||||
case 17: return "R_PPC_GOT16_HA";
|
||||
case 18: return "R_PPC_PLTREL24";
|
||||
case 19: return "R_PPC_COPY";
|
||||
case 20: return "R_PPC_GLOB_DAT";
|
||||
case 21: return "R_PPC_JMP_SLOT";
|
||||
case 22: return "R_PPC_RELATIVE";
|
||||
case 23: return "R_PPC_LOCAL24PC";
|
||||
case 24: return "R_PPC_UADDR32";
|
||||
case 25: return "R_PPC_UADDR16";
|
||||
case 26: return "R_PPC_REL32";
|
||||
case 27: return "R_PPC_PLT32";
|
||||
case 28: return "R_PPC_PLTREL32";
|
||||
case 29: return "R_PPC_PLT16_LO";
|
||||
case 30: return "R_PPC_PLT16_HI";
|
||||
case 31: return "R_PPC_PLT16_HA";
|
||||
case 32: return "R_PPC_SDAREL16";
|
||||
case 33: return "R_PPC_SECTOFF";
|
||||
case 34: return "R_PPC_SECTOFF_LO";
|
||||
case 35: return "R_PPC_SECTOFF_HI";
|
||||
case 36: return "R_PPC_SECTOFF_HA";
|
||||
case 67: return "R_PPC_TLS";
|
||||
case 68: return "R_PPC_DTPMOD32";
|
||||
case 69: return "R_PPC_TPREL16";
|
||||
case 70: return "R_PPC_TPREL16_LO";
|
||||
case 71: return "R_PPC_TPREL16_HI";
|
||||
case 72: return "R_PPC_TPREL16_HA";
|
||||
case 73: return "R_PPC_TPREL32";
|
||||
case 74: return "R_PPC_DTPREL16";
|
||||
case 75: return "R_PPC_DTPREL16_LO";
|
||||
case 76: return "R_PPC_DTPREL16_HI";
|
||||
case 77: return "R_PPC_DTPREL16_HA";
|
||||
case 78: return "R_PPC_DTPREL32";
|
||||
case 79: return "R_PPC_GOT_TLSGD16";
|
||||
case 80: return "R_PPC_GOT_TLSGD16_LO";
|
||||
case 81: return "R_PPC_GOT_TLSGD16_HI";
|
||||
case 82: return "R_PPC_GOT_TLSGD16_HA";
|
||||
case 83: return "R_PPC_GOT_TLSLD16";
|
||||
case 84: return "R_PPC_GOT_TLSLD16_LO";
|
||||
case 85: return "R_PPC_GOT_TLSLD16_HI";
|
||||
case 86: return "R_PPC_GOT_TLSLD16_HA";
|
||||
case 87: return "R_PPC_GOT_TPREL16";
|
||||
case 88: return "R_PPC_GOT_TPREL16_LO";
|
||||
case 89: return "R_PPC_GOT_TPREL16_HI";
|
||||
case 90: return "R_PPC_GOT_TPREL16_HA";
|
||||
case 101: return "R_PPC_EMB_NADDR32";
|
||||
case 102: return "R_PPC_EMB_NADDR16";
|
||||
case 103: return "R_PPC_EMB_NADDR16_LO";
|
||||
case 104: return "R_PPC_EMB_NADDR16_HI";
|
||||
case 105: return "R_PPC_EMB_NADDR16_HA";
|
||||
case 106: return "R_PPC_EMB_SDAI16";
|
||||
case 107: return "R_PPC_EMB_SDA2I16";
|
||||
case 108: return "R_PPC_EMB_SDA2REL";
|
||||
case 109: return "R_PPC_EMB_SDA21";
|
||||
case 110: return "R_PPC_EMB_MRKREF";
|
||||
case 111: return "R_PPC_EMB_RELSEC16";
|
||||
case 112: return "R_PPC_EMB_RELST_LO";
|
||||
case 113: return "R_PPC_EMB_RELST_HI";
|
||||
case 114: return "R_PPC_EMB_RELST_HA";
|
||||
case 115: return "R_PPC_EMB_BIT_FLD";
|
||||
case 116: return "R_PPC_EMB_RELSDA";
|
||||
}
|
||||
break;
|
||||
case EM_RISCV:
|
||||
switch(type) {
|
||||
case 0: return "R_RISCV_NONE";
|
||||
case 1: return "R_RISCV_32";
|
||||
case 2: return "R_RISCV_64";
|
||||
case 3: return "R_RISCV_RELATIVE";
|
||||
case 4: return "R_RISCV_COPY";
|
||||
case 5: return "R_RISCV_JUMP_SLOT";
|
||||
case 6: return "R_RISCV_TLS_DTPMOD32";
|
||||
case 7: return "R_RISCV_TLS_DTPMOD64";
|
||||
case 8: return "R_RISCV_TLS_DTPREL32";
|
||||
case 9: return "R_RISCV_TLS_DTPREL64";
|
||||
case 10: return "R_RISCV_TLS_TPREL32";
|
||||
case 11: return "R_RISCV_TLS_TPREL64";
|
||||
case 16: return "R_RISCV_BRANCH";
|
||||
case 17: return "R_RISCV_JAL";
|
||||
case 18: return "R_RISCV_CALL";
|
||||
case 19: return "R_RISCV_CALL_PLT";
|
||||
case 20: return "R_RISCV_GOT_HI20";
|
||||
case 21: return "R_RISCV_TLS_GOT_HI20";
|
||||
case 22: return "R_RISCV_TLS_GD_HI20";
|
||||
case 23: return "R_RISCV_PCREL_HI20";
|
||||
case 24: return "R_RISCV_PCREL_LO12_I";
|
||||
case 25: return "R_RISCV_PCREL_LO12_S";
|
||||
case 26: return "R_RISCV_HI20";
|
||||
case 27: return "R_RISCV_LO12_I";
|
||||
case 28: return "R_RISCV_LO12_S";
|
||||
case 29: return "R_RISCV_TPREL_HI20";
|
||||
case 30: return "R_RISCV_TPREL_LO12_I";
|
||||
case 31: return "R_RISCV_TPREL_LO12_S";
|
||||
case 32: return "R_RISCV_TPREL_ADD";
|
||||
case 33: return "R_RISCV_ADD8";
|
||||
case 34: return "R_RISCV_ADD16";
|
||||
case 35: return "R_RISCV_ADD32";
|
||||
case 36: return "R_RISCV_ADD64";
|
||||
case 37: return "R_RISCV_SUB8";
|
||||
case 38: return "R_RISCV_SUB16";
|
||||
case 39: return "R_RISCV_SUB32";
|
||||
case 40: return "R_RISCV_SUB64";
|
||||
case 41: return "R_RISCV_GNU_VTINHERIT";
|
||||
case 42: return "R_RISCV_GNU_VTENTRY";
|
||||
case 43: return "R_RISCV_ALIGN";
|
||||
case 44: return "R_RISCV_RVC_BRANCH";
|
||||
case 45: return "R_RISCV_RVC_JUMP";
|
||||
}
|
||||
break;
|
||||
case EM_SPARC:
|
||||
case EM_SPARCV9:
|
||||
switch(type) {
|
||||
case 0: return "R_SPARC_NONE";
|
||||
case 1: return "R_SPARC_8";
|
||||
case 2: return "R_SPARC_16";
|
||||
case 3: return "R_SPARC_32";
|
||||
case 4: return "R_SPARC_DISP8";
|
||||
case 5: return "R_SPARC_DISP16";
|
||||
case 6: return "R_SPARC_DISP32";
|
||||
case 7: return "R_SPARC_WDISP30";
|
||||
case 8: return "R_SPARC_WDISP22";
|
||||
case 9: return "R_SPARC_HI22";
|
||||
case 10: return "R_SPARC_22";
|
||||
case 11: return "R_SPARC_13";
|
||||
case 12: return "R_SPARC_LO10";
|
||||
case 13: return "R_SPARC_GOT10";
|
||||
case 14: return "R_SPARC_GOT13";
|
||||
case 15: return "R_SPARC_GOT22";
|
||||
case 16: return "R_SPARC_PC10";
|
||||
case 17: return "R_SPARC_PC22";
|
||||
case 18: return "R_SPARC_WPLT30";
|
||||
case 19: return "R_SPARC_COPY";
|
||||
case 20: return "R_SPARC_GLOB_DAT";
|
||||
case 21: return "R_SPARC_JMP_SLOT";
|
||||
case 22: return "R_SPARC_RELATIVE";
|
||||
case 23: return "R_SPARC_UA32";
|
||||
case 24: return "R_SPARC_PLT32";
|
||||
case 25: return "R_SPARC_HIPLT22";
|
||||
case 26: return "R_SPARC_LOPLT10";
|
||||
case 27: return "R_SPARC_PCPLT32";
|
||||
case 28: return "R_SPARC_PCPLT22";
|
||||
case 29: return "R_SPARC_PCPLT10";
|
||||
case 30: return "R_SPARC_10";
|
||||
case 31: return "R_SPARC_11";
|
||||
case 32: return "R_SPARC_64";
|
||||
case 33: return "R_SPARC_OLO10";
|
||||
case 34: return "R_SPARC_HH22";
|
||||
case 35: return "R_SPARC_HM10";
|
||||
case 36: return "R_SPARC_LM22";
|
||||
case 37: return "R_SPARC_PC_HH22";
|
||||
case 38: return "R_SPARC_PC_HM10";
|
||||
case 39: return "R_SPARC_PC_LM22";
|
||||
case 40: return "R_SPARC_WDISP16";
|
||||
case 41: return "R_SPARC_WDISP19";
|
||||
case 42: return "R_SPARC_GLOB_JMP";
|
||||
case 43: return "R_SPARC_7";
|
||||
case 44: return "R_SPARC_5";
|
||||
case 45: return "R_SPARC_6";
|
||||
case 46: return "R_SPARC_DISP64";
|
||||
case 47: return "R_SPARC_PLT64";
|
||||
case 48: return "R_SPARC_HIX22";
|
||||
case 49: return "R_SPARC_LOX10";
|
||||
case 50: return "R_SPARC_H44";
|
||||
case 51: return "R_SPARC_M44";
|
||||
case 52: return "R_SPARC_L44";
|
||||
case 53: return "R_SPARC_REGISTER";
|
||||
case 54: return "R_SPARC_UA64";
|
||||
case 55: return "R_SPARC_UA16";
|
||||
case 56: return "R_SPARC_TLS_GD_HI22";
|
||||
case 57: return "R_SPARC_TLS_GD_LO10";
|
||||
case 58: return "R_SPARC_TLS_GD_ADD";
|
||||
case 59: return "R_SPARC_TLS_GD_CALL";
|
||||
case 60: return "R_SPARC_TLS_LDM_HI22";
|
||||
case 61: return "R_SPARC_TLS_LDM_LO10";
|
||||
case 62: return "R_SPARC_TLS_LDM_ADD";
|
||||
case 63: return "R_SPARC_TLS_LDM_CALL";
|
||||
case 64: return "R_SPARC_TLS_LDO_HIX22";
|
||||
case 65: return "R_SPARC_TLS_LDO_LOX10";
|
||||
case 66: return "R_SPARC_TLS_LDO_ADD";
|
||||
case 67: return "R_SPARC_TLS_IE_HI22";
|
||||
case 68: return "R_SPARC_TLS_IE_LO10";
|
||||
case 69: return "R_SPARC_TLS_IE_LD";
|
||||
case 70: return "R_SPARC_TLS_IE_LDX";
|
||||
case 71: return "R_SPARC_TLS_IE_ADD";
|
||||
case 72: return "R_SPARC_TLS_LE_HIX22";
|
||||
case 73: return "R_SPARC_TLS_LE_LOX10";
|
||||
case 74: return "R_SPARC_TLS_DTPMOD32";
|
||||
case 75: return "R_SPARC_TLS_DTPMOD64";
|
||||
case 76: return "R_SPARC_TLS_DTPOFF32";
|
||||
case 77: return "R_SPARC_TLS_DTPOFF64";
|
||||
case 78: return "R_SPARC_TLS_TPOFF32";
|
||||
case 79: return "R_SPARC_TLS_TPOFF64";
|
||||
}
|
||||
break;
|
||||
case EM_X86_64:
|
||||
switch(type) {
|
||||
case 0: return "R_X86_64_NONE";
|
||||
case 1: return "R_X86_64_64";
|
||||
case 2: return "R_X86_64_PC32";
|
||||
case 3: return "R_X86_64_GOT32";
|
||||
case 4: return "R_X86_64_PLT32";
|
||||
case 5: return "R_X86_64_COPY";
|
||||
case 6: return "R_X86_64_GLOB_DAT";
|
||||
case 7: return "R_X86_64_JUMP_SLOT";
|
||||
case 8: return "R_X86_64_RELATIVE";
|
||||
case 9: return "R_X86_64_GOTPCREL";
|
||||
case 10: return "R_X86_64_32";
|
||||
case 11: return "R_X86_64_32S";
|
||||
case 12: return "R_X86_64_16";
|
||||
case 13: return "R_X86_64_PC16";
|
||||
case 14: return "R_X86_64_8";
|
||||
case 15: return "R_X86_64_PC8";
|
||||
case 16: return "R_X86_64_DTPMOD64";
|
||||
case 17: return "R_X86_64_DTPOFF64";
|
||||
case 18: return "R_X86_64_TPOFF64";
|
||||
case 19: return "R_X86_64_TLSGD";
|
||||
case 20: return "R_X86_64_TLSLD";
|
||||
case 21: return "R_X86_64_DTPOFF32";
|
||||
case 22: return "R_X86_64_GOTTPOFF";
|
||||
case 23: return "R_X86_64_TPOFF32";
|
||||
case 24: return "R_X86_64_PC64";
|
||||
case 25: return "R_X86_64_GOTOFF64";
|
||||
case 26: return "R_X86_64_GOTPC32";
|
||||
case 27: return "R_X86_64_GOT64";
|
||||
case 28: return "R_X86_64_GOTPCREL64";
|
||||
case 29: return "R_X86_64_GOTPC64";
|
||||
case 30: return "R_X86_64_GOTPLT64";
|
||||
case 31: return "R_X86_64_PLTOFF64";
|
||||
case 32: return "R_X86_64_SIZE32";
|
||||
case 33: return "R_X86_64_SIZE64";
|
||||
case 34: return "R_X86_64_GOTPC32_TLSDESC";
|
||||
case 35: return "R_X86_64_TLSDESC_CALL";
|
||||
case 36: return "R_X86_64_TLSDESC";
|
||||
case 37: return "R_X86_64_IRELATIVE";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
|
||||
return (s_type);
|
||||
}
|
||||
|
||||
static const char *
|
||||
note_type(const char *name, unsigned int et, unsigned int nt)
|
||||
{
|
||||
@ -3312,11 +2772,11 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
|
||||
#define REL_HDR "r_offset", "r_info", "r_type", "st_value", "st_name"
|
||||
#define REL_CT32 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
|
||||
r_type(re->ehdr.e_machine, ELF32_R_TYPE(r.r_info)), \
|
||||
(uintmax_t)symval, symname
|
||||
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, \
|
||||
r_type(re->ehdr.e_machine, ELF64_R_TYPE(r.r_info)), \
|
||||
(uintmax_t)symval, symname
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
|
||||
printf("\nRelocation section (%s):\n", s->name);
|
||||
if (re->ec == ELFCLASS32)
|
||||
@ -3369,11 +2829,11 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
#define RELA_HDR "r_offset", "r_info", "r_type", "st_value", \
|
||||
"st_name + r_addend"
|
||||
#define RELA_CT32 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
|
||||
r_type(re->ehdr.e_machine, ELF32_R_TYPE(r.r_info)), \
|
||||
(uintmax_t)symval, symname
|
||||
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, \
|
||||
r_type(re->ehdr.e_machine, ELF64_R_TYPE(r.r_info)), \
|
||||
(uintmax_t)symval, symname
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
|
||||
printf("\nRelocation section with addend (%s):\n", s->name);
|
||||
if (re->ec == ELFCLASS32)
|
||||
@ -3480,7 +2940,7 @@ dump_symtab(struct readelf *re, int i)
|
||||
printf(" %16.16jx", (uintmax_t) sym.st_value);
|
||||
printf(" %5ju", (uintmax_t) sym.st_size);
|
||||
printf(" %-7s", st_type(re->ehdr.e_machine,
|
||||
GELF_ST_TYPE(sym.st_info)));
|
||||
re->ehdr.e_ident[EI_OSABI], GELF_ST_TYPE(sym.st_info)));
|
||||
printf(" %-6s", st_bind(GELF_ST_BIND(sym.st_info)));
|
||||
printf(" %-8s", st_vis(GELF_ST_VISIBILITY(sym.st_other)));
|
||||
printf(" %3s", st_shndx(sym.st_shndx));
|
||||
@ -3731,6 +3191,10 @@ dump_gnu_hash(struct readelf *re, struct section *s)
|
||||
ds = &re->sl[s->link];
|
||||
if (!get_ent_count(ds, &dynsymcount))
|
||||
return;
|
||||
if (symndx >= (uint32_t)dynsymcount) {
|
||||
warnx("Malformed .gnu.hash section (symndx out of range)");
|
||||
return;
|
||||
}
|
||||
nchain = dynsymcount - symndx;
|
||||
if (d->d_size != 4 * sizeof(uint32_t) + maskwords *
|
||||
(re->ec == ELFCLASS32 ? sizeof(uint32_t) : sizeof(uint64_t)) +
|
||||
@ -3796,7 +3260,7 @@ dump_notes(struct readelf *re)
|
||||
const char *rawfile;
|
||||
GElf_Phdr phdr;
|
||||
Elf_Data *d;
|
||||
size_t phnum;
|
||||
size_t filesize, phnum;
|
||||
int i, elferr;
|
||||
|
||||
if (re->ehdr.e_type == ET_CORE) {
|
||||
@ -3810,7 +3274,7 @@ dump_notes(struct readelf *re)
|
||||
}
|
||||
if (phnum == 0)
|
||||
return;
|
||||
if ((rawfile = elf_rawfile(re->elf, NULL)) == NULL) {
|
||||
if ((rawfile = elf_rawfile(re->elf, &filesize)) == NULL) {
|
||||
warnx("elf_rawfile failed: %s", elf_errmsg(-1));
|
||||
return;
|
||||
}
|
||||
@ -3820,9 +3284,15 @@ dump_notes(struct readelf *re)
|
||||
elf_errmsg(-1));
|
||||
continue;
|
||||
}
|
||||
if (phdr.p_type == PT_NOTE)
|
||||
if (phdr.p_type == PT_NOTE) {
|
||||
if (phdr.p_offset >= filesize ||
|
||||
phdr.p_filesz > filesize - phdr.p_offset) {
|
||||
warnx("invalid PHDR offset");
|
||||
continue;
|
||||
}
|
||||
dump_notes_content(re, rawfile + phdr.p_offset,
|
||||
phdr.p_filesz, phdr.p_offset);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -6815,9 +6285,12 @@ get_symbol_name(struct readelf *re, int symtab, int i)
|
||||
if (gelf_getsym(data, i, &sym) != &sym)
|
||||
return ("");
|
||||
/* Return section name for STT_SECTION symbol. */
|
||||
if (GELF_ST_TYPE(sym.st_info) == STT_SECTION &&
|
||||
re->sl[sym.st_shndx].name != NULL)
|
||||
return (re->sl[sym.st_shndx].name);
|
||||
if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) {
|
||||
if (sym.st_shndx < re->shnum &&
|
||||
re->sl[sym.st_shndx].name != NULL)
|
||||
return (re->sl[sym.st_shndx].name);
|
||||
return ("");
|
||||
}
|
||||
if (s->link >= re->shnum ||
|
||||
(name = elf_strptr(re->elf, s->link, sym.st_name)) == NULL)
|
||||
return ("");
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: size.c 3242 2015-08-07 12:47:11Z emaste $");
|
||||
ELFTC_VCSID("$Id: size.c 3458 2016-05-09 15:01:25Z emaste $");
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define ELF_ALIGN(val,x) (((val)+(x)-1) & ~((x)-1))
|
||||
@ -262,7 +262,7 @@ static void
|
||||
handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr,
|
||||
char **cmd_line)
|
||||
{
|
||||
size_t max_size;
|
||||
size_t max_size, segment_end;
|
||||
uint64_t raw_size;
|
||||
GElf_Off offset;
|
||||
static pid_t pid;
|
||||
@ -276,7 +276,13 @@ handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr,
|
||||
|
||||
data = elf_rawfile(elf, &max_size);
|
||||
offset = phdr->p_offset;
|
||||
while (data != NULL && offset < phdr->p_offset + phdr->p_filesz) {
|
||||
if (offset >= max_size || phdr->p_filesz > max_size - offset) {
|
||||
warnx("invalid PHDR offset");
|
||||
return;
|
||||
}
|
||||
segment_end = phdr->p_offset + phdr->p_filesz;
|
||||
|
||||
while (data != NULL && offset + sizeof(Elf32_Nhdr) < segment_end) {
|
||||
nhdr = (Elf32_Nhdr *)(uintptr_t)((char*)data + offset);
|
||||
memset(&nhdr_l, 0, sizeof(Elf32_Nhdr));
|
||||
if (!xlatetom(elf, elfhdr, &nhdr->n_type, &nhdr_l.n_type,
|
||||
@ -287,6 +293,13 @@ handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr,
|
||||
ELF_T_WORD, sizeof(Elf32_Word)))
|
||||
break;
|
||||
|
||||
if (offset + sizeof(Elf32_Nhdr) +
|
||||
ELF_ALIGN(nhdr_l.n_namesz, 4) +
|
||||
ELF_ALIGN(nhdr_l.n_descsz, 4) >= segment_end) {
|
||||
warnx("invalid note header");
|
||||
return;
|
||||
}
|
||||
|
||||
name = (char *)((char *)nhdr + sizeof(Elf32_Nhdr));
|
||||
switch (nhdr_l.n_type) {
|
||||
case NT_PRSTATUS: {
|
||||
@ -428,8 +441,8 @@ handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr,
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles program headers except for PT_NOTE, when sysv output stlye is
|
||||
* choosen, prints out the segment name and length. For berkely output
|
||||
* Handles program headers except for PT_NOTE, when sysv output style is
|
||||
* chosen, prints out the segment name and length. For berkely output
|
||||
* style only PT_LOAD segments are handled, and text,
|
||||
* data, bss size is calculated for them.
|
||||
*/
|
||||
@ -600,7 +613,7 @@ handle_elf(char const *name)
|
||||
elf_cmd = elf_next(elf);
|
||||
(void) elf_end(elf);
|
||||
warnx("%s: File format not recognized",
|
||||
arhdr->ar_name);
|
||||
arhdr != NULL ? arhdr->ar_name : name);
|
||||
continue;
|
||||
}
|
||||
/* Core dumps are handled separately */
|
||||
@ -739,7 +752,7 @@ berkeley_calc(GElf_Shdr *shdr)
|
||||
static void
|
||||
berkeley_totals(void)
|
||||
{
|
||||
long unsigned int grand_total;
|
||||
uint64_t grand_total;
|
||||
|
||||
grand_total = text_size_total + data_size_total + bss_size_total;
|
||||
tbl_append();
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: strings.c 3360 2016-01-24 18:34:06Z jkoshy $");
|
||||
ELFTC_VCSID("$Id: strings.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
enum return_code {
|
||||
RETURN_OK,
|
||||
@ -258,7 +258,7 @@ handle_elf(const char *name, int fd)
|
||||
int rc;
|
||||
|
||||
rc = RETURN_OK;
|
||||
/* If entire file is choosen, treat it as a binary file */
|
||||
/* If entire file is chosen, treat it as a binary file */
|
||||
if (entire_file)
|
||||
return (handle_binary(name, fd));
|
||||
|
||||
|
@ -13,6 +13,7 @@ LIB= elftc
|
||||
SRCS= elftc_bfdtarget.c \
|
||||
elftc_copyfile.c \
|
||||
elftc_demangle.c \
|
||||
elftc_reloc_type_str.c \
|
||||
elftc_set_timestamps.c \
|
||||
elftc_string_table.c \
|
||||
elftc_version.c \
|
||||
|
@ -6,5 +6,5 @@
|
||||
const char *
|
||||
elftc_version(void)
|
||||
{
|
||||
return "elftoolchain r3400M";
|
||||
return "elftoolchain r3475M";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user