diff options
Diffstat (limited to 'utils/ldd.c')
-rw-r--r-- | utils/ldd.c | 44 |
1 files changed, 10 insertions, 34 deletions
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 <stdlib.h> -#include <stdio.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> -#include <stdint.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/wait.h> - -#include "bswap.h" -#include "link.h" -#include "dl-defs.h" -/* makefile will include elf.h for us */ - -#ifdef DMALLOC -#include <dmalloc.h> -#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) { |