summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-06-10 20:55:58 +0200
committerMark Wielaard <mark@klomp.org>2020-06-10 21:01:33 +0200
commit27a388bdd21e6bc1a27f111b803b7903b8851606 (patch)
tree852936990905cc4a40a97e1fc1b2473f9b1ddadb /backends
parent815fe154e78c715ed2f467e8d17fac17e4255753 (diff)
downloadelfutils-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 'backends')
-rw-r--r--backends/ChangeLog20
-rw-r--r--backends/aarch64_init.c11
-rw-r--r--backends/alpha_init.c11
-rw-r--r--backends/arm_init.c11
-rw-r--r--backends/bpf_init.c10
-rw-r--r--backends/csky_init.c11
-rw-r--r--backends/i386_init.c11
-rw-r--r--backends/ia64_init.c11
-rw-r--r--backends/libebl_CPU.h3
-rw-r--r--backends/m68k_init.c11
-rw-r--r--backends/ppc64_init.c11
-rw-r--r--backends/ppc_init.c11
-rw-r--r--backends/riscv_init.c11
-rw-r--r--backends/s390_init.c11
-rw-r--r--backends/sh_init.c11
-rw-r--r--backends/sparc_init.c11
-rw-r--r--backends/tilegx_init.c11
-rw-r--r--backends/x86_64_init.c11
18 files changed, 69 insertions, 129 deletions
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;
}