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/ldd.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'utils/ldd.c') diff --git a/utils/ldd.c b/utils/ldd.c index 289d163b2..18f4b6cde 100644 --- a/utils/ldd.c +++ b/utils/ldd.c @@ -13,25 +13,7 @@ * Licensed under GPLv2 or later */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bswap.h" -#include "link.h" -#include "dl-defs.h" -/* makefile will include elf.h for us */ - -#ifdef DMALLOC -#include -#endif +#include "porting.h" #if defined(__alpha__) #define MATCH_MACHINE(x) (x == EM_ALPHA) @@ -134,16 +116,12 @@ # warning "You really should add a MATCH_MACHINE() macro for your architecture" #endif -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_LITTLE #define ELFDATAM ELFDATA2LSB -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_BIG #define ELFDATAM ELFDATA2MSB #endif -#ifndef UCLIBC_RUNTIME_PREFIX -# define UCLIBC_RUNTIME_PREFIX "/" -#endif - struct library { char *name; int resolved; @@ -247,15 +225,13 @@ 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) { -- cgit v1.2.3