[COMMITTED] libebl: Remove Ebl struct size check and MODVERSION string.

Mark Wielaard mark@klomp.org
Wed Jun 10 19:04:09 GMT 2020


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>
---
 ChangeLog               |  4 ++++
 backends/ChangeLog      | 20 ++++++++++++++++++++
 backends/aarch64_init.c | 11 +++--------
 backends/alpha_init.c   | 11 +++--------
 backends/arm_init.c     | 11 +++--------
 backends/bpf_init.c     | 10 +++-------
 backends/csky_init.c    | 11 +++--------
 backends/i386_init.c    | 11 +++--------
 backends/ia64_init.c    | 11 +++--------
 backends/libebl_CPU.h   |  3 +--
 backends/m68k_init.c    | 11 +++--------
 backends/ppc64_init.c   | 11 +++--------
 backends/ppc_init.c     | 11 +++--------
 backends/riscv_init.c   | 11 +++--------
 backends/s390_init.c    | 11 +++--------
 backends/sh_init.c      | 11 +++--------
 backends/sparc_init.c   | 11 +++--------
 backends/tilegx_init.c  | 11 +++--------
 backends/x86_64_init.c  | 11 +++--------
 configure.ac            |  6 ------
 libebl/ChangeLog        |  9 +++++++++
 libebl/eblopenbackend.c | 34 +++++++++++++++++-----------------
 libebl/libeblP.h        |  6 ++++--
 23 files changed, 103 insertions(+), 154 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 854568e0..c08af9d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-10  Mark Wielaard  <mark@klomp.org>
+
+	* configure.ac (MODVERSION): Remove.
+
 2020-03-30  Mark Wielaard  <mark@klomp.org>
 
 	* configure.ac: Set version to 0.179.
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 3f5f9bb0..7d3578b0 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,23 @@
+2020-06-10  Mark Wielard  <mark@klomp.org>
+
+	* aarch64_init.c (aarch64_init): Remove ehlen, return eh.
+	* alpha_init.c (alpha_init): Likewise.
+	* arm_init.c (arm_init): Likewise.
+	* bpf_init.c (bpf_init): Likewise.
+	* csky_init.c (csky_init): Likewise.
+	* i386_init.c (i386_init): Likewise.
+	* ia64_init.c (ia64_init): Likewise.
+	* m68k_init.c (m68k_init): Likewise.
+	* ppc64_init.c (ppc64_init): Likewise.
+	* ppc_init.c (ppc_init): Likewise.
+	* riscv_init.c (riscv_init): Likewise.
+	* s390_init.c (s390_init): Likewise.
+	* sh_init.c (sh_init): Likewise.
+	* sparc_init.c (sparc_init): Likewise.
+	* tilegx_init.c (tilegx_init): Likewise.
+	* x86_64_init.c (x86_64_init): Likewise.
+	* libebl_CPU.h (init): Adjust EBLHOOK signature.
+
 2019-07-05  Omar Sandoval  <osandov@fb.com>
 
 	* Makefile.am: Replace libcpu_{i386,x86_64,bpf}.a with libcpu.a.
diff --git a/backends/aarch64_init.c b/backends/aarch64_init.c
index 95268ae0..66bfae94 100644
--- a/backends/aarch64_init.c
+++ b/backends/aarch64_init.c
@@ -38,16 +38,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 aarch64_init (Elf *elf __attribute__ ((unused)),
 	      GElf_Half machine __attribute__ ((unused)),
-	      Ebl *eh,
-	      size_t ehlen)
+	      Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   aarch64_init_reloc (eh);
   HOOK (eh, register_info);
@@ -65,5 +60,5 @@ aarch64_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, set_initial_registers_tid);
   HOOK (eh, unwind);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/alpha_init.c b/backends/alpha_init.c
index f66f40c5..c69aec6d 100644
--- a/backends/alpha_init.c
+++ b/backends/alpha_init.c
@@ -39,16 +39,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 alpha_init (Elf *elf __attribute__ ((unused)),
 	    GElf_Half machine __attribute__ ((unused)),
-	    Ebl *eh,
-	    size_t ehlen)
+	    Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   alpha_init_reloc (eh);
   HOOK (eh, dynamic_tag_name);
@@ -64,5 +59,5 @@ alpha_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, auxv_info);
   eh->sysvhash_entrysize = sizeof (Elf64_Xword);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/arm_init.c b/backends/arm_init.c
index af023f02..edd53b75 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -39,16 +39,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 arm_init (Elf *elf __attribute__ ((unused)),
 	  GElf_Half machine __attribute__ ((unused)),
-	  Ebl *eh,
-	  size_t ehlen)
+	  Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   arm_init_reloc (eh);
   HOOK (eh, segment_type_name);
@@ -72,5 +67,5 @@ arm_init (Elf *elf __attribute__ ((unused)),
   /* Bit zero encodes whether an function address is THUMB or ARM. */
   eh->func_addr_mask = ~(GElf_Addr)1;
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/bpf_init.c b/backends/bpf_init.c
index d407d378..f20f339e 100644
--- a/backends/bpf_init.c
+++ b/backends/bpf_init.c
@@ -39,20 +39,16 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 bpf_init (Elf *elf __attribute__ ((unused)),
 	  GElf_Half machine __attribute__ ((unused)),
-	  Ebl *eh, size_t ehlen)
+	  Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   bpf_init_reloc (eh);
   HOOK (eh, register_info);
   HOOK (eh, disasm);
   HOOK (eh, reloc_simple_type);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/csky_init.c b/backends/csky_init.c
index b34a03aa..b2863ced 100644
--- a/backends/csky_init.c
+++ b/backends/csky_init.c
@@ -37,16 +37,11 @@
 /* This defines the common reloc hooks based on csky_reloc.def.  */
 #include "common-reloc.c"
 
-const char *
+Ebl *
 csky_init (Elf *elf __attribute__ ((unused)),
 	   GElf_Half machine __attribute__ ((unused)),
-	   Ebl *eh,
-	   size_t ehlen)
+	   Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   csky_init_reloc (eh);
   HOOK (eh, abi_cfi);
@@ -61,5 +56,5 @@ csky_init (Elf *elf __attribute__ ((unused)),
   /* gcc/config/ #define DWARF_FRAME_REGISTERS.  */
   eh->frame_nregs = 38;
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/i386_init.c b/backends/i386_init.c
index 67428b53..3f6b9ed1 100644
--- a/backends/i386_init.c
+++ b/backends/i386_init.c
@@ -38,16 +38,11 @@
 /* This defines the common reloc hooks based on i386_reloc.def.  */
 #include "common-reloc.c"
 
-const char *
+Ebl *
 i386_init (Elf *elf __attribute__ ((unused)),
 	   GElf_Half machine __attribute__ ((unused)),
-	   Ebl *eh,
-	   size_t ehlen)
+	   Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   i386_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -66,5 +61,5 @@ i386_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, set_initial_registers_tid);
   HOOK (eh, unwind);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/ia64_init.c b/backends/ia64_init.c
index 2d1f43f2..b46b35cc 100644
--- a/backends/ia64_init.c
+++ b/backends/ia64_init.c
@@ -38,16 +38,11 @@
 /* This defines the common reloc hooks based on ia64_reloc.def.  */
 #include "common-reloc.c"
 
-const char *
+Ebl *
 ia64_init (Elf *elf __attribute__ ((unused)),
 	   GElf_Half machine __attribute__ ((unused)),
-	   Ebl *eh,
-	   size_t ehlen)
+	   Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   ia64_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -61,5 +56,5 @@ ia64_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, return_value_location);
   HOOK (eh, check_reloc_target_type);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h
index ef2b922b..0e507bd3 100644
--- a/backends/libebl_CPU.h
+++ b/backends/libebl_CPU.h
@@ -37,8 +37,7 @@
 #define EBLHOOK_2(a, b)	a##b
 
 /* Constructor.  */
-extern const char *EBLHOOK(init) (Elf *elf, GElf_Half machine,
-				  Ebl *eh, size_t ehlen);
+extern Ebl *EBLHOOK(init) (Elf *elf, GElf_Half machine, Ebl *eh);
 
 #include "ebl-hooks.h"
 
diff --git a/backends/m68k_init.c b/backends/m68k_init.c
index 05d544c1..7b94f23a 100644
--- a/backends/m68k_init.c
+++ b/backends/m68k_init.c
@@ -37,16 +37,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 m68k_init (Elf *elf __attribute__ ((unused)),
 	   GElf_Half machine __attribute__ ((unused)),
-	   Ebl *eh,
-	   size_t ehlen)
+	   Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   m68k_init_reloc (eh);
   HOOK (eh, gotpc_reloc_check);
@@ -59,5 +54,5 @@ m68k_init (Elf *elf __attribute__ ((unused)),
   eh->frame_nregs = 25;
   HOOK (eh, set_initial_registers_tid);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c
index c2e7043b..f509aef6 100644
--- a/backends/ppc64_init.c
+++ b/backends/ppc64_init.c
@@ -41,16 +41,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 ppc64_init (Elf *elf __attribute__ ((unused)),
 	    GElf_Half machine __attribute__ ((unused)),
-	    Ebl *eh,
-	    size_t ehlen)
+	    Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   ppc64_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -107,5 +102,5 @@ ppc64_init (Elf *elf __attribute__ ((unused)),
 	}
     }
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/ppc_init.c b/backends/ppc_init.c
index eb286c25..ac440ab2 100644
--- a/backends/ppc_init.c
+++ b/backends/ppc_init.c
@@ -39,16 +39,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 ppc_init (Elf *elf __attribute__ ((unused)),
 	  GElf_Half machine __attribute__ ((unused)),
-	  Ebl *eh,
-	  size_t ehlen)
+	  Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   ppc_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -69,5 +64,5 @@ ppc_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, set_initial_registers_tid);
   HOOK (eh, dwarf_to_regno);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/riscv_init.c b/backends/riscv_init.c
index 9be5c6f2..551e7bb6 100644
--- a/backends/riscv_init.c
+++ b/backends/riscv_init.c
@@ -43,16 +43,11 @@ extern __typeof (EBLHOOK (return_value_location))
 
 extern __typeof (EBLHOOK (core_note)) riscv64_core_note attribute_hidden;
 
-const char *
+Ebl *
 riscv_init (Elf *elf,
 	    GElf_Half machine __attribute__ ((unused)),
-	    Ebl *eh,
-	    size_t ehlen)
+	    Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   riscv_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -73,5 +68,5 @@ riscv_init (Elf *elf,
 	  == EF_RISCV_FLOAT_ABI_DOUBLE))
     eh->return_value_location = riscv_return_value_location_lp64d;
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/s390_init.c b/backends/s390_init.c
index b4f3e7f8..fd79502d 100644
--- a/backends/s390_init.c
+++ b/backends/s390_init.c
@@ -40,16 +40,11 @@
 extern __typeof (s390_core_note) s390x_core_note;
 
 
-const char *
+Ebl *
 s390_init (Elf *elf __attribute__ ((unused)),
 	   GElf_Half machine __attribute__ ((unused)),
-	   Ebl *eh,
-	   size_t ehlen)
+	   Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   s390_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -75,5 +70,5 @@ s390_init (Elf *elf __attribute__ ((unused)),
   if (eh->class == ELFCLASS64)
     eh->sysvhash_entrysize = sizeof (Elf64_Xword);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/sh_init.c b/backends/sh_init.c
index 24f4d4a4..05cf8b18 100644
--- a/backends/sh_init.c
+++ b/backends/sh_init.c
@@ -39,16 +39,11 @@
 #include "common-reloc.c"
 
 
-const char *
+Ebl *
 sh_init (Elf *elf __attribute__ ((unused)),
 	 GElf_Half machine __attribute__ ((unused)),
-	 Ebl *eh,
-	 size_t ehlen)
+	 Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   sh_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -58,5 +53,5 @@ sh_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, register_info);
   HOOK (eh, return_value_location);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/sparc_init.c b/backends/sparc_init.c
index 6daff114..647a7897 100644
--- a/backends/sparc_init.c
+++ b/backends/sparc_init.c
@@ -44,16 +44,11 @@
 
 extern __typeof (EBLHOOK (core_note)) sparc64_core_note attribute_hidden;
 
-const char *
+Ebl *
 sparc_init (Elf *elf __attribute__ ((unused)),
 	    GElf_Half machine __attribute__ ((unused)),
-	    Ebl *eh,
-	    size_t ehlen)
+	    Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   sparc_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -79,5 +74,5 @@ sparc_init (Elf *elf __attribute__ ((unused)),
   eh->ra_offset = 8;
   HOOK (eh, set_initial_registers_tid);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/tilegx_init.c b/backends/tilegx_init.c
index 66df9318..0f79542a 100644
--- a/backends/tilegx_init.c
+++ b/backends/tilegx_init.c
@@ -37,16 +37,11 @@
 /* This defines the common reloc hooks based on tilegx_reloc.def.  */
 #include "common-reloc.c"
 
-const char *
+Ebl *
 tilegx_init (Elf *elf __attribute__ ((unused)),
 	     GElf_Half machine __attribute__ ((unused)),
-	     Ebl *eh,
-	     size_t ehlen)
+	     Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   tilegx_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -54,5 +49,5 @@ tilegx_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, register_info);
   HOOK (eh, core_note);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c
index 8abafb7f..44c1ad28 100644
--- a/backends/x86_64_init.c
+++ b/backends/x86_64_init.c
@@ -41,16 +41,11 @@
 
 extern __typeof (EBLHOOK (core_note)) x32_core_note attribute_hidden;
 
-const char *
+Ebl *
 x86_64_init (Elf *elf __attribute__ ((unused)),
 	     GElf_Half machine __attribute__ ((unused)),
-	     Ebl *eh,
-	     size_t ehlen)
+	     Ebl *eh)
 {
-  /* Check whether the Elf_BH object has a sufficent size.  */
-  if (ehlen < sizeof (Ebl))
-    return NULL;
-
   /* We handle it.  */
   x86_64_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
@@ -70,5 +65,5 @@ x86_64_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, set_initial_registers_tid);
   HOOK (eh, unwind);
 
-  return MODVERSION;
+  return eh;
 }
diff --git a/configure.ac b/configure.ac
index a39e800f..c2c6890a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -627,12 +627,6 @@ esac
 # Round up to the next release API (x.y) version.
 eu_version=$(( (eu_version + 999) / 1000 ))
 
-dnl Unique ID for this build.
-MODVERSION="Build for ${eu_version} ${ac_cv_build}"
-AC_SUBST([MODVERSION])
-AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
-AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
-
 AC_CHECK_SIZEOF(long)
 
 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
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.  */
-- 
2.18.4



More information about the Elfutils-devel mailing list