From 32242e7e10276157533def1c92c4c720945510fc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 9 Feb 2009 21:48:48 +0000 Subject: unify the headers/random defines into porting.h to avoid duplication/rot --- utils/readelf.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'utils/readelf.c') diff --git a/utils/readelf.c b/utils/readelf.c index 60f14a6bf..191242b2f 100644 --- a/utils/readelf.c +++ b/utils/readelf.c @@ -13,19 +13,7 @@ * Licensed under GPLv2 or later */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bswap.h" -#include "link.h" -/* makefile will include elf.h for us */ +#include "porting.h" static int byteswap; static __inline__ uint32_t byteswap32_to_host(uint32_t value) @@ -103,15 +91,13 @@ static int check_elf_header(ElfW(Ehdr) *const ehdr) /* Check if the target endianness matches the host's endianness */ byteswap = 0; -#if __BYTE_ORDER == __LITTLE_ENDIAN - if (ehdr->e_ident[5] == ELFDATA2MSB) - byteswap = 1; -#elif __BYTE_ORDER == __BIG_ENDIAN - if (ehdr->e_ident[5] == ELFDATA2LSB) - byteswap = 1; -#else -#error Unknown host byte order! -#endif + if (UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_LITTLE) { + if (ehdr->e_ident[5] == ELFDATA2MSB) + byteswap = 1; + } else if (UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_BIG) { + if (ehdr->e_ident[5] == ELFDATA2LSB) + byteswap = 1; + } /* Be very lazy, and only byteswap the stuff we use */ if (byteswap) { ehdr->e_type = bswap_16(ehdr->e_type); -- cgit v1.2.3