summaryrefslogtreecommitdiff
path: root/ldso/util/readelf.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-03-07 12:23:11 +0000
committerEric Andersen <andersen@codepoet.org>2003-03-07 12:23:11 +0000
commit443636be415c1920f071cfe4907fcc361b2999ce (patch)
tree49c863ca968b578a2af684f0b96c5f5217b0b816 /ldso/util/readelf.c
parenta2a493671ebbb9728d09eb99f0b8b3e0da5e88f8 (diff)
Patch from Stefan Allius
the ldd.c wasn't compilable for SuperH due to a missing ELFCLASSM define and the readelf executable was linked with a wrong dynamic linker path. To fix this I removed the --uclibc-use-build-dir. The patch also fixed all the compiler warnings (-Wall -W). Erik made a few additional changes to eliminate unused function arguments and fixup a static variable that was was doing the wrong thing
Diffstat (limited to 'ldso/util/readelf.c')
-rw-r--r--ldso/util/readelf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ldso/util/readelf.c b/ldso/util/readelf.c
index bb8aa26fd..a703b5da2 100644
--- a/ldso/util/readelf.c
+++ b/ldso/util/readelf.c
@@ -56,7 +56,7 @@ Elf32_Shdr * elf_find_section_type( int key, Elf32_Ehdr *ehdr)
int j;
Elf32_Shdr *shdr = (Elf32_Shdr *)(ehdr->e_shoff + (char *)ehdr);
for (j = ehdr->e_shnum; --j>=0; ++shdr) {
- if (key==byteswap32_to_host(shdr->sh_type)) {
+ if (key==(int)byteswap32_to_host(shdr->sh_type)) {
return shdr;
}
}
@@ -68,7 +68,7 @@ Elf32_Phdr * elf_find_phdr_type( int type, Elf32_Ehdr *ehdr)
int j;
Elf32_Phdr *phdr = (Elf32_Phdr *)(ehdr->e_phoff + (char *)ehdr);
for (j = ehdr->e_phnum; --j>=0; ++phdr) {
- if (type==byteswap32_to_host(phdr->p_type)) {
+ if (type==(int)byteswap32_to_host(phdr->p_type)) {
return phdr;
}
}
@@ -82,7 +82,7 @@ void * elf_find_dynamic(int const key, Elf32_Dyn *dynp,
Elf32_Phdr *pt_text = elf_find_phdr_type(PT_LOAD, ehdr);
unsigned tx_reloc = byteswap32_to_host(pt_text->p_vaddr) - byteswap32_to_host(pt_text->p_offset);
for (; DT_NULL!=byteswap32_to_host(dynp->d_tag); ++dynp) {
- if (key == byteswap32_to_host(dynp->d_tag)) {
+ if (key == (int)byteswap32_to_host(dynp->d_tag)) {
if (return_val == 1)
return (void *)(intptr_t)byteswap32_to_host(dynp->d_un.d_val);
else
@@ -307,8 +307,9 @@ int main( int argc, char** argv)
Elf32_Shdr *dynsec;
Elf32_Dyn *dynamic;
+ fprintf (stderr," argc:%d argv:'%s' '%s'\n",argc, argv[0], argv[1]);
- if (!thefilename) {
+ if (argc < 2 || !thefilename) {
fprintf(stderr, "No filename specified.\n");
exit(EXIT_FAILURE);
}
@@ -321,7 +322,7 @@ int main( int argc, char** argv)
exit(EXIT_FAILURE);
}
- if (statbuf.st_size < sizeof(Elf32_Ehdr))
+ if ((size_t)statbuf.st_size < sizeof(Elf32_Ehdr))
goto foo;
/* mmap the file to make reading stuff from it effortless */