libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.
authorMark Wielaard <mark@klomp.org>
Fri, 28 Jun 2019 17:21:59 +0000 (19:21 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 10 Jul 2019 12:08:33 +0000 (14:08 +0200)
commitb3233914074cb7eb19ea2fc3c70257679f867f68
treeaad365893d911393052714723f050388197170d7
parent31c8b3f098b0654db8f573b2a15d5b6d07d4d3b0
libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.

To print eh human readable description of the ELF e_machine header field
we used the ebl name. But this is not set for most EM constants. Introduce
a new function dwelf_elf_e_machine_string that does work for all known
EM values. Use that in eu-readelf to print a string representation of the
e_machine value.

Since this was the only usage of ebl->name, remove that from struct ebl.

Also add a testcase that makes sure dwelf_elf_e_machine_string works for
all EM values in the libelf/elf.h header so we will immediately notice
when a new value appears.

Signed-off-by: Mark Wielaard <mark@klomp.org>
31 files changed:
backends/ChangeLog
backends/aarch64_init.c
backends/alpha_init.c
backends/arm_init.c
backends/bpf_init.c
backends/i386_init.c
backends/ia64_init.c
backends/m68k_init.c
backends/ppc64_init.c
backends/ppc_init.c
backends/riscv_init.c
backends/s390_init.c
backends/sh_init.c
backends/sparc_init.c
backends/tilegx_init.c
backends/x86_64_init.c
libdw/ChangeLog
libdw/libdw.map
libdwelf/ChangeLog
libdwelf/Makefile.am
libdwelf/dwelf_elf_e_machine_string.c [new file with mode: 0644]
libdwelf/libdwelf.h
libebl/ChangeLog
libebl/eblopenbackend.c
libebl/libeblP.h
src/ChangeLog
src/readelf.c
tests/ChangeLog
tests/Makefile.am
tests/dwelf_elf_e_machine_string.c [new file with mode: 0644]
tests/run-dwelf_elf_e_machine_string.sh [new file with mode: 0755]