From b3233914074cb7eb19ea2fc3c70257679f867f68 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 28 Jun 2019 19:21:59 +0200 Subject: 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 --- libebl/ChangeLog | 6 ++++++ libebl/eblopenbackend.c | 3 --- libebl/libeblP.h | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libebl') diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 8a7d177f..e42cd34b 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,9 @@ +2019-06-28 Mark Wielaard + + * eblopenbackend.c (try_dlopen): Remove result->name check. + (openbackend): Remove result->name assignment. + (struct ebl): Remove name. + 2019-05-30 Mark Wielaard * eblopenbackend.c (try_dlopen): New function extracted from diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 36a24921..9dd51950 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -283,7 +283,6 @@ try_dlopen (const char *dsoname, Elf *elf, GElf_Half machine, size_t cnt, result->elf = elf; /* A few entries are mandatory. */ - assert (result->name != NULL); assert (result->destr != NULL); return result; @@ -398,7 +397,6 @@ openbackend (Elf *elf, const char *emulation, GElf_Half machine) Return that information. */ result->dlhandle = NULL; result->elf = elf; - result->name = machines[cnt].prefix; fill_defaults (result); return result; @@ -408,7 +406,6 @@ openbackend (Elf *elf, const char *emulation, GElf_Half machine) result->dlhandle = NULL; result->elf = elf; result->emulation = ""; - result->name = ""; fill_defaults (result); return result; diff --git a/libebl/libeblP.h b/libebl/libeblP.h index 5b339b31..a5869685 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -38,9 +38,6 @@ /* Backend handle. */ struct ebl { - /* Machine name. */ - const char *name; - /* Emulation name. */ const char *emulation; -- cgit v1.2.1