diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-01-05 11:27:26 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-01-05 11:27:26 -0500 |
commit | 710cbb8d24db7bbc64af06921ba281b752e5ef99 (patch) | |
tree | d321ccabfd0f0cbe08f2f747757a9883b8d755cc | |
parent | misc/elf-abi: code cleanup (diff) | |
download | elfix-710cbb8d24db7bbc64af06921ba281b752e5ef99.tar.gz elfix-710cbb8d24db7bbc64af06921ba281b752e5ef99.tar.bz2 elfix-710cbb8d24db7bbc64af06921ba281b752e5ef99.zip |
misc/elf-abi: remove endian code
-rw-r--r-- | misc/elf-abi/elf-abi.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/misc/elf-abi/elf-abi.c b/misc/elf-abi/elf-abi.c index 6b3a9c2..0a271ba 100644 --- a/misc/elf-abi/elf-abi.c +++ b/misc/elf-abi/elf-abi.c @@ -67,8 +67,6 @@ #define ELFCLASS32 1 /* 32-bit objects */ #define ELFCLASS64 2 /* 64-bit objects */ -#define ELFDATA2LSB 1 /* 2's complement, little endian */ -#define ELFDATA2MSB 2 /* 2's complement, big endian */ #define EM_SPARC 2 /* SUN SPARC */ #define EM_386 3 /* Intel 80386 */ @@ -116,20 +114,6 @@ get_wordsize(uint8_t ei_class) } -int -get_endian(uint8_t ei_data) -{ - switch (ei_data) { - case ELFDATA2LSB: - return -1; - case ELFDATA2MSB: - return 1; - default: - return 0; - } -} - - char * get_abi(uint16_t e_machine, int width, uint32_t e_flags) { @@ -175,14 +159,12 @@ int main(int argc, char* argv[]) { int width; /* Machine word size. Either 32 or 64 bits. */ - int endian; /* Endian, -1 = little, 1 = big */ char *abi; /* Abi name from glibc's <bits/syscall.h> */ int fd; /* file descriptor for opened Elf object. */ struct stat s; /* stat on opened Elf object. */ char magic[4]; /* magic number at the begining of the file */ uint8_t ei_class; /* ei_class is one byte of e_ident[] */ - uint8_t ei_data; /* ei_data is one byte of e_ident[] */ uint16_t e_machine; /* Size is Elf32_Half or Elf64_Half. Both are 2 bytes. */ uint32_t e_flags; /* Size is Elf32_Word or Elf64_Word. Both are 4 bytes. */ uint64_t e_machine_offset, e_flags_offset; /* Wide enough for either 32 or 64 bits. */ @@ -208,11 +190,6 @@ main(int argc, char* argv[]) err(1, "read() ei_class failed"); width = get_wordsize(ei_class); - /* Little or Big Endian? */ - if (read(fd, &ei_data, 1) == -1) - err(1, "read() ei_data failed"); - endian = get_endian(ei_data); - /* All Elf files begin with the following Elf header: unsigned char e_ident[EI_NIDENT]; - 16 bytes |