diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-08-08 14:28:47 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-08-08 14:28:47 +0000 |
commit | 4c69b9f793fc1eae9190d8ba26dba25db616272f (patch) | |
tree | 0029a765f3402cdbef9bb2f384c8a067e1ed17c0 /ldso/util/ldd.c | |
parent | e3787b675f1a369697d97ba8e65bf6ba80ace51d (diff) |
Patch from Stefan Allius and Edie C. Dost to let ldd and
readelf compile under solaris.
Diffstat (limited to 'ldso/util/ldd.c')
-rw-r--r-- | ldso/util/ldd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c index 6b9326b53..29c520c60 100644 --- a/ldso/util/ldd.c +++ b/ldso/util/ldd.c @@ -29,7 +29,6 @@ #define _GNU_SOURCE -#include <features.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> @@ -38,9 +37,14 @@ #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> -#include <endian.h> -#include <byteswap.h> + +#include "bswap.h" +#if defined (sun) +#include "link.h" +#else #include "elf.h" +#endif + #ifdef DMALLOC #include <dmalloc.h> #endif @@ -102,7 +106,7 @@ void * elf_find_dynamic(int const key, Elf32_Dyn *dynp, for (; DT_NULL!=byteswap32_to_host(dynp->d_tag); ++dynp) { if (key == byteswap32_to_host(dynp->d_tag)) { if (return_val == 1) - return (void *)byteswap32_to_host(dynp->d_un.d_val); + return (void *)(intptr_t)byteswap32_to_host(dynp->d_un.d_val); else return (void *)(byteswap32_to_host(dynp->d_un.d_val) - tx_reloc + (char *)ehdr ); } @@ -133,6 +137,7 @@ int check_elf_header(Elf32_Ehdr *const ehdr) #else #error Unknown host byte order! #endif + /* Be vary lazy, and only byteswap the stuff we use */ if (byteswap==1) { ehdr->e_type=bswap_16(ehdr->e_type); @@ -457,7 +462,7 @@ foo: dynsec = elf_find_section_type(SHT_DYNAMIC, ehdr); find_elf_interpreter(ehdr, dynamic, dynstr, is_suid); if (dynsec) { - dynamic = (Elf32_Dyn*)(byteswap32_to_host(dynsec->sh_offset) + (int)ehdr); + dynamic = (Elf32_Dyn*)(byteswap32_to_host(dynsec->sh_offset) + (intptr_t)ehdr); dynstr = (char *)elf_find_dynamic(DT_STRTAB, dynamic, ehdr, 0); find_needed_libraries(ehdr, dynamic, dynstr, is_suid); } |