summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_xlatetof.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2019-02-03 19:05:13 +0100
committerMark Wielaard <[email protected]>2019-02-28 22:41:14 +0100
commitb9d1678951e13e934759a643040da752573f765f (patch)
treeaeb7bf4b5aab4e415efdb37e20a5728ebfbbe438 /libelf/elf32_xlatetof.c
parent92ded1f11c0622cd9e1943bb85e1bdbdc4fb4802 (diff)
libelf: There is just one ELF version.
Remove (partially defined out) code and data structures dealing with multiple ELF versions. There hasn't been a new ELF version in the last 20 years. Simplify the code a bit by just assuming there will only be one version (EV_CURRENT == 1). Simplifies elf_version, gets rid of __libelf_version_initialized. Removes one (or more) array (version) dimension from various tables and accessor functions (__elf_xfctstom, shtype_map, __libelf_data_type, __libelf_type_aligns and __libelf_type_sizes). Signed-off-by: Mark Wielaard <[email protected]>`
Diffstat (limited to 'libelf/elf32_xlatetof.c')
-rw-r--r--libelf/elf32_xlatetof.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c
index ac4eaf40..082d833f 100644
--- a/libelf/elf32_xlatetof.c
+++ b/libelf/elf32_xlatetof.c
@@ -50,11 +50,7 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
type. This means, whether there is an integer number of records.
Note that for this implementation the memory and file size of the
data types are identical. */
-#if EV_NUM != 2
- size_t recsize = __libelf_type_sizes[src->d_version - 1][ELFW(ELFCLASS,LIBELFBITS) - 1][src->d_type];
-#else
- size_t recsize = __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][src->d_type];
-#endif
+ size_t recsize = __libelf_type_sizes[ELFW(ELFCLASS,LIBELFBITS) - 1][src->d_type];
if (src->d_size % recsize != 0)
{
@@ -97,15 +93,7 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
else
{
xfct_t fctp;
-
- /* Get a pointer to the transformation functions. The `#ifdef' is
- a small optimization since we don't anticipate another ELF
- version and so would waste "precious" code. */
-#if EV_NUM != 2
- fctp = __elf_xfctstom[dest->d_version - 1][src->d_version - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][src->d_type];
-#else
- fctp = __elf_xfctstom[0][0][ELFW(ELFCLASS, LIBELFBITS) - 1][src->d_type];
-#endif
+ fctp = __elf_xfctstom[ELFW(ELFCLASS, LIBELFBITS) - 1][src->d_type];
/* Do the real work. */
(*fctp) (dest->d_buf, src->d_buf, src->d_size, 1);