diff options
author | Mark Wielaard <mark@klomp.org> | 2020-06-10 20:55:58 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-06-10 21:01:33 +0200 |
commit | 27a388bdd21e6bc1a27f111b803b7903b8851606 (patch) | |
tree | 852936990905cc4a40a97e1fc1b2473f9b1ddadb /libebl | |
parent | 815fe154e78c715ed2f467e8d17fac17e4255753 (diff) | |
download | elfutils-27a388bdd21e6bc1a27f111b803b7903b8851606.tar.gz |
libebl: Remove Ebl struct size check and MODVERSION string.
We used to do several sanity checks when the ebl backend libraries
were loaded to make sure there was no version mismatch. When initializing
the backend we passed the current Ebl struct size so the library could
check it supported the given Ebl struct and we checked that the init
method returned the correct build time module version string. Neither
are necessary now that the backends are builtin.
Remove both the struct size check and the MODVERSION string (which
wasn't actually checked anymore). Make the init function return the
given Ebl handle or NULL on error (no init function currently indicates
any error).
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 9 | ||||
-rw-r--r-- | libebl/eblopenbackend.c | 34 | ||||
-rw-r--r-- | libebl/libeblP.h | 6 |
3 files changed, 30 insertions, 19 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 75aa1ab8..fa6dd037 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,12 @@ +2020-06-10 Mark Wielaard <mark@klomp.org> + + * eblopenbackend.c (i386_init, sh_init, x86_64_init, ia64_init, + alpha_init, arm_init, aarch64_init, sparc_init, ppc_init, + ppc64_init, s390_init, tilegx_init, m68k_init, bpf_init, + riscv_init, csky_init): Adjust signature. + (openbackend): Call init without sizeof(Ebl). + * libeblP.h (ebl_bhinit_t): Adjust signature. + 2020-06-04 Mark Wielaard <mark@klomp.org> * eblsegmenttypename.c (ebl_segment_type_name): Remove diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 4ebde45f..b3b6fc01 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -41,22 +41,22 @@ #include <system.h> #include <libeblP.h> -const char *i386_init (Elf *, GElf_Half, Ebl *, size_t); -const char *sh_init (Elf *, GElf_Half, Ebl *, size_t); -const char *x86_64_init (Elf *, GElf_Half, Ebl *, size_t); -const char *ia64_init (Elf *, GElf_Half, Ebl *, size_t); -const char *alpha_init (Elf *, GElf_Half, Ebl *, size_t); -const char *arm_init (Elf *, GElf_Half, Ebl *, size_t); -const char *aarch64_init (Elf *, GElf_Half, Ebl *, size_t); -const char *sparc_init (Elf *, GElf_Half, Ebl *, size_t); -const char *ppc_init (Elf *, GElf_Half, Ebl *, size_t); -const char *ppc64_init (Elf *, GElf_Half, Ebl *, size_t); -const char *s390_init (Elf *, GElf_Half, Ebl *, size_t); -const char *tilegx_init (Elf *, GElf_Half, Ebl *, size_t); -const char *m68k_init (Elf *, GElf_Half, Ebl *, size_t); -const char *bpf_init (Elf *, GElf_Half, Ebl *, size_t); -const char *riscv_init (Elf *, GElf_Half, Ebl *, size_t); -const char *csky_init (Elf *, GElf_Half, Ebl *, size_t); +Ebl *i386_init (Elf *, GElf_Half, Ebl *); +Ebl *sh_init (Elf *, GElf_Half, Ebl *); +Ebl *x86_64_init (Elf *, GElf_Half, Ebl *); +Ebl *ia64_init (Elf *, GElf_Half, Ebl *); +Ebl *alpha_init (Elf *, GElf_Half, Ebl *); +Ebl *arm_init (Elf *, GElf_Half, Ebl *); +Ebl *aarch64_init (Elf *, GElf_Half, Ebl *); +Ebl *sparc_init (Elf *, GElf_Half, Ebl *); +Ebl *ppc_init (Elf *, GElf_Half, Ebl *); +Ebl *ppc64_init (Elf *, GElf_Half, Ebl *); +Ebl *s390_init (Elf *, GElf_Half, Ebl *); +Ebl *tilegx_init (Elf *, GElf_Half, Ebl *); +Ebl *m68k_init (Elf *, GElf_Half, Ebl *); +Ebl *bpf_init (Elf *, GElf_Half, Ebl *); +Ebl *riscv_init (Elf *, GElf_Half, Ebl *); +Ebl *csky_init (Elf *, GElf_Half, Ebl *); /* This table should contain the complete list of architectures as far as the ELF specification is concerned. */ @@ -330,7 +330,7 @@ openbackend (Elf *elf, const char *emulation, GElf_Half machine) } if (machines[cnt].init && - machines[cnt].init (elf, machine, result, sizeof(Ebl))) + machines[cnt].init (elf, machine, result)) { result->elf = elf; /* A few entries are mandatory. */ diff --git a/libebl/libeblP.h b/libebl/libeblP.h index fd0fcc98..599f6378 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -80,8 +80,10 @@ struct ebl }; -/* Type of the initialization functions in the backend modules. */ -typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t); +/* Type of the initialization functions in the backend modules. + The init function returns the given Ebl * or NULL if it couldn't + initialize for the given Elf or machine. */ +typedef Ebl *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *); /* gettext helper macros. */ |