summaryrefslogtreecommitdiff
path: root/utils/readsoname2.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-12-30 06:26:55 +0000
committerMike Frysinger <vapier@gentoo.org>2005-12-30 06:26:55 +0000
commit0e89137680c5b381b022ef5a027a2de169798160 (patch)
tree00f0a4ef40ae48af02d4b41d53e5fc9733a93079 /utils/readsoname2.c
parente564f1896716789c2121320f9e6992e35d469f09 (diff)
use ElfW(Addr) instead of ElfW(Word) since elf word types are always 32bits in size, even on 64bit hosts, while Addr is the proper native size ... also get creative with our signed/unsigned usage to get rid of warnings
Diffstat (limited to 'utils/readsoname2.c')
-rw-r--r--utils/readsoname2.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/readsoname2.c b/utils/readsoname2.c
index 9452c0c4d..029a2bbc1 100644
--- a/utils/readsoname2.c
+++ b/utils/readsoname2.c
@@ -2,14 +2,14 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
{
ElfW(Ehdr) *epnt;
ElfW(Phdr) *ppnt;
- int i, j;
+ unsigned int i, j;
char *header;
- ElfW(Word) dynamic_addr = 0;
- ElfW(Word) dynamic_size = 0;
+ ElfW(Addr) dynamic_addr = 0;
+ ElfW(Addr) dynamic_size = 0;
unsigned long page_size = getpagesize();
- ElfW(Word) strtab_val = 0;
- ElfW(Word) needed_val;
- ElfW(Sword) loadaddr = -1;
+ ElfW(Addr) strtab_val = 0;
+ ElfW(Addr) needed_val;
+ ElfW(Addr) loadaddr = -1;
ElfW(Dyn) *dpnt;
struct stat st;
char *needed;
@@ -62,7 +62,7 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
ppnt->p_filesz=bswap_32(ppnt->p_filesz);
}
- if (loadaddr == -1 && ppnt->p_type == PT_LOAD)
+ if (loadaddr == (ElfW(Addr))-1 && ppnt->p_type == PT_LOAD)
loadaddr = (ppnt->p_vaddr & ~(page_size-1)) -
(ppnt->p_offset & ~(page_size-1));
if(ppnt->p_type == 2)
@@ -104,8 +104,8 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
if (dpnt->d_tag == DT_SONAME || dpnt->d_tag == DT_NEEDED)
{
needed_val = dpnt->d_un.d_val;
- if (needed_val + strtab_val - loadaddr >= 0 ||
- needed_val + strtab_val - loadaddr < st.st_size)
+ if (needed_val + strtab_val >= loadaddr ||
+ needed_val + strtab_val < st.st_size - loadaddr)
{
needed = (char *) (header - loadaddr + strtab_val + needed_val);