diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-09 21:48:48 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-09 21:48:48 +0000 |
commit | 32242e7e10276157533def1c92c4c720945510fc (patch) | |
tree | a91c4ec4e0a229c959c65d6f41f59c8c29648728 /utils/ldd.c | |
parent | 98f6d6a8ebd80e9223a4e213a85fd3d0cf1c4190 (diff) |
unify the headers/random defines into porting.h to avoid duplication/rot
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) { |