diff options
| author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-09 14:02:22 +0000 |
|---|---|---|
| committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-09 14:02:22 +0000 |
| commit | b17bfc22373f1da75287bdc5e487301599be6496 (patch) | |
| tree | d8d6df171a7f92156fb09cc49bc7f628ca1b0579 /utils/readelf.c | |
| parent | aba870d2c18b5ad6a4417a40488a726197589676 (diff) | |
| download | uClibc-alpine-b17bfc22373f1da75287bdc5e487301599be6496.tar.bz2 uClibc-alpine-b17bfc22373f1da75287bdc5e487301599be6496.tar.xz | |
Synch utils directory with trunk
Diffstat (limited to 'utils/readelf.c')
| -rw-r--r-- | utils/readelf.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/utils/readelf.c b/utils/readelf.c index 0ff5d2563..188f92f9f 100644 --- a/utils/readelf.c +++ b/utils/readelf.c @@ -27,8 +27,8 @@ #include "link.h" /* makefile will include elf.h for us */ -int byteswap; -inline uint32_t byteswap32_to_host(uint32_t value) +static int byteswap; +static inline uint32_t byteswap32_to_host(uint32_t value) { if (byteswap==1) { return(bswap_32(value)); @@ -36,7 +36,7 @@ inline uint32_t byteswap32_to_host(uint32_t value) return(value); } } -inline uint64_t byteswap64_to_host(uint64_t value) +static inline uint64_t byteswap64_to_host(uint64_t value) { if (byteswap==1) { return(bswap_64(value)); @@ -50,7 +50,7 @@ inline uint64_t byteswap64_to_host(uint64_t value) # define byteswap_to_host(x) byteswap32_to_host(x) #endif -ElfW(Shdr) * elf_find_section_type( uint32_t key, ElfW(Ehdr) *ehdr) +static ElfW(Shdr) * elf_find_section_type( uint32_t key, ElfW(Ehdr) *ehdr) { int j; ElfW(Shdr) *shdr = (ElfW(Shdr) *)(ehdr->e_shoff + (char *)ehdr); @@ -62,7 +62,7 @@ ElfW(Shdr) * elf_find_section_type( uint32_t key, ElfW(Ehdr) *ehdr) return NULL; } -ElfW(Phdr) * elf_find_phdr_type( uint32_t type, ElfW(Ehdr) *ehdr) +static ElfW(Phdr) * elf_find_phdr_type( uint32_t type, ElfW(Ehdr) *ehdr) { int j; ElfW(Phdr) *phdr = (ElfW(Phdr) *)(ehdr->e_phoff + (char *)ehdr); @@ -74,8 +74,8 @@ ElfW(Phdr) * elf_find_phdr_type( uint32_t type, ElfW(Ehdr) *ehdr) return NULL; } -/* Returns value if return_val==1, ptr otherwise */ -void * elf_find_dynamic( int64_t const key, ElfW(Dyn) *dynp, +/* Returns value if return_val==1, ptr otherwise */ +static void * elf_find_dynamic( int64_t const key, ElfW(Dyn) *dynp, ElfW(Ehdr) *ehdr, int return_val) { ElfW(Phdr) *pt_text = elf_find_phdr_type(PT_LOAD, ehdr); @@ -91,12 +91,12 @@ void * elf_find_dynamic( int64_t const key, ElfW(Dyn) *dynp, return NULL; } -int check_elf_header(ElfW(Ehdr) *const ehdr) +static int check_elf_header(ElfW(Ehdr) *const ehdr) { - if (! ehdr || strncmp((void *)ehdr, ELFMAG, SELFMAG) != 0 || + if (! ehdr || strncmp((void *)ehdr, ELFMAG, SELFMAG) != 0 || (ehdr->e_ident[EI_CLASS] != ELFCLASS32 && ehdr->e_ident[EI_CLASS] != ELFCLASS64) || - ehdr->e_ident[EI_VERSION] != EV_CURRENT) + ehdr->e_ident[EI_VERSION] != EV_CURRENT) { return 1; } @@ -196,7 +196,7 @@ static void describe_elf_hdr(ElfW(Ehdr)* ehdr) case EM_CYGNUS_FR30: case EM_FR30: tmp="Fujitsu FR30"; break; case EM_CYGNUS_FRV: - case EM_PJ_OLD: + case EM_PJ_OLD: case EM_PJ: tmp="picoJava"; break; case EM_MMA: tmp="Fujitsu MMA Multimedia Accelerator"; break; case EM_PCP: tmp="Siemens PCP"; break; @@ -247,7 +247,7 @@ static void describe_elf_hdr(ElfW(Ehdr)* ehdr) case EM_PDSP: tmp="Sony DSP Processor"; break; default: tmp="unknown"; } - printf( "Machine:\t%s\n", tmp); + printf( "Machine:\t%s\n", tmp); switch (ehdr->e_ident[EI_CLASS]) { case ELFCLASSNONE: tmp = "Invalid class"; break; @@ -266,7 +266,7 @@ static void describe_elf_hdr(ElfW(Ehdr)* ehdr) printf( "Data:\t\t%s\n", tmp); printf( "Version:\t%d %s\n", ehdr->e_ident[EI_VERSION], - (ehdr->e_ident[EI_VERSION]==EV_CURRENT)? + (ehdr->e_ident[EI_VERSION]==EV_CURRENT)? "(current)" : "(unknown: %lx)"); switch (ehdr->e_ident[EI_OSABI]) { @@ -302,7 +302,7 @@ static void list_needed_libraries(ElfW(Dyn)* dynamic, char *strtab) } } } - + static void describe_elf_interpreter(ElfW(Ehdr)* ehdr) { ElfW(Phdr) *phdr; @@ -340,7 +340,7 @@ int main( int argc, char** argv) goto foo; /* mmap the file to make reading stuff from it effortless */ - ehdr = (ElfW(Ehdr) *)mmap(0, statbuf.st_size, + ehdr = (ElfW(Ehdr) *)mmap(0, statbuf.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(thefile), 0); foo: |
