Silence some compilation warnings.

This commit is contained in:
Markus F.X.J. Oberhumer
2011-08-30 03:40:53 +02:00
parent 36bc14e884
commit afbd553622
4 changed files with 12 additions and 13 deletions
+6 -6
View File
@@ -47,7 +47,7 @@
#define PT_NOTE32 Elf32_Phdr::PT_NOTE #define PT_NOTE32 Elf32_Phdr::PT_NOTE
#define PT_NOTE64 Elf64_Phdr::PT_NOTE #define PT_NOTE64 Elf64_Phdr::PT_NOTE
static unsigned const EF_ARM_HASENTRY = 0x02; //static unsigned const EF_ARM_HASENTRY = 0x02;
static unsigned const EF_ARM_EABI_VER4 = 0x04000000; static unsigned const EF_ARM_EABI_VER4 = 0x04000000;
static unsigned const EF_ARM_EABI_VER5 = 0x05000000; static unsigned const EF_ARM_EABI_VER5 = 0x05000000;
@@ -1703,7 +1703,7 @@ PackNetBSDElf32x86::generateElfHdr(
unsigned char *cp = note_body; unsigned char *cp = note_body;
unsigned j; unsigned j;
for (j=0; j < note_size; ) { for (j=0; j < note_size; ) {
Elf32_Nhdr const *const np = (Elf32_Nhdr const *)cp; Elf32_Nhdr const *const np = (Elf32_Nhdr const *)(void *)cp;
int k = sizeof(*np) + up4(get_te32(&np->namesz)) int k = sizeof(*np) + up4(get_te32(&np->namesz))
+ up4(get_te32(&np->descsz)); + up4(get_te32(&np->descsz));
@@ -1754,7 +1754,7 @@ PackNetBSDElf32x86::generateElfHdr(
unsigned bits = get_te32(&np_PaX->body[4]); unsigned bits = get_te32(&np_PaX->body[4]);
bits &= ~PAX_MPROTECT; bits &= ~PAX_MPROTECT;
bits |= PAX_NOMPROTECT; bits |= PAX_NOMPROTECT;
set_te32((unsigned *)&np_PaX->body[4], bits); set_te32(ACC_UNCONST_CAST(unsigned char *, &np_PaX->body[4]), bits);
sz_elf_hdrs += sz_PaX + sizeof(*phdr); sz_elf_hdrs += sz_PaX + sizeof(*phdr);
note_offset += sz_PaX; note_offset += sz_PaX;
@@ -1790,7 +1790,7 @@ PackOpenBSDElf32x86::generateElfHdr(
unsigned const brka unsigned const brka
) )
{ {
cprElfHdr3 *const h3 = (cprElfHdr3 *)&elfout; cprElfHdr3 *const h3 = (cprElfHdr3 *)(void *)&elfout;
memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK
h3->ehdr.e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi; h3->ehdr.e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi;
assert(2==get_te16(&h3->ehdr.e_phnum)); assert(2==get_te16(&h3->ehdr.e_phnum));
@@ -2913,7 +2913,7 @@ Linker* PackLinuxElf32armBe::newLinker() const
} }
unsigned unsigned
PackLinuxElf32::elf_get_offset_from_address(acc_uint64l_t const addr) const PackLinuxElf32::elf_get_offset_from_address(unsigned const addr) const
{ {
Elf32_Phdr const *phdr = phdri; Elf32_Phdr const *phdr = phdri;
int j = e_phnum; int j = e_phnum;
@@ -2963,7 +2963,7 @@ PackLinuxElf32::elf_unsigned_dynamic(unsigned int const key) const
return 0; return 0;
} }
unsigned acc_uint64l_t
PackLinuxElf64::elf_get_offset_from_address(acc_uint64l_t const addr) const PackLinuxElf64::elf_get_offset_from_address(acc_uint64l_t const addr) const
{ {
Elf64_Phdr const *phdr = phdri; Elf64_Phdr const *phdr = phdri;
+3 -4
View File
@@ -63,8 +63,7 @@ protected:
virtual void addStubEntrySections(Filter const *); virtual void addStubEntrySections(Filter const *);
virtual void unpack(OutputFile *fo); virtual void unpack(OutputFile *fo);
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const = 0; //virtual void const *elf_find_dynamic(unsigned) const = 0;
virtual void const *elf_find_dynamic(unsigned) const = 0;
virtual acc_uint64l_t elf_unsigned_dynamic(unsigned) const = 0; virtual acc_uint64l_t elf_unsigned_dynamic(unsigned) const = 0;
protected: protected:
@@ -134,7 +133,7 @@ protected:
static unsigned elf_hash(char const *) /*const*/; static unsigned elf_hash(char const *) /*const*/;
static unsigned gnu_hash(char const *) /*const*/; static unsigned gnu_hash(char const *) /*const*/;
virtual Elf32_Sym const *elf_lookup(char const *) const; virtual Elf32_Sym const *elf_lookup(char const *) const;
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const; virtual unsigned elf_get_offset_from_address(unsigned) const;
Elf32_Shdr const *elf_find_section_name(char const *) const; Elf32_Shdr const *elf_find_section_name(char const *) const;
Elf32_Shdr const *elf_find_section_type(unsigned) const; Elf32_Shdr const *elf_find_section_type(unsigned) const;
void const *elf_find_dynamic(unsigned) const; void const *elf_find_dynamic(unsigned) const;
@@ -241,7 +240,7 @@ protected:
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k, virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
unsigned const e_phnum); unsigned const e_phnum);
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const; virtual acc_uint64l_t elf_get_offset_from_address(acc_uint64l_t) const;
Elf64_Shdr const *elf_find_section_name(char const *) const; Elf64_Shdr const *elf_find_section_name(char const *) const;
Elf64_Shdr const *elf_find_section_type(unsigned) const; Elf64_Shdr const *elf_find_section_type(unsigned) const;
void const *elf_find_dynamic(unsigned) const; void const *elf_find_dynamic(unsigned) const;
+1 -1
View File
@@ -114,7 +114,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
h3.phdr[2].p_align = 1; h3.phdr[2].p_align = 1;
if (opt->o_unix.make_ptinterp) { // unusual "once per release" if (opt->o_unix.make_ptinterp) { // unusual "once per release"
*(cprElfHdr3 *)&elfout = h3; *(cprElfHdr3 *)(void *)&elfout = h3;
elfout.ehdr.e_phnum = 1; elfout.ehdr.e_phnum = 1;
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize); fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
} }
+2 -2
View File
@@ -1079,8 +1079,8 @@ void PackVmlinuxAMD64::defineDecompressorSymbols()
// We assume a 32-bit boot loader, so we use the 32-bit convention // We assume a 32-bit boot loader, so we use the 32-bit convention
// of "enter at the beginning" (startup_32). The 64-bit convention // of "enter at the beginning" (startup_32). The 64-bit convention
// would be to use ehdri.e_entry (startup_64). // would be to use ehdri.e_entry (startup_64).
linker->defineSymbol("ENTRY_POINT", phdri[0].p_paddr); linker->defineSymbol("ENTRY_POINT", (unsigned) phdri[0].p_paddr);
linker->defineSymbol("PHYSICAL_START", phdri[0].p_paddr); linker->defineSymbol("PHYSICAL_START", (unsigned) phdri[0].p_paddr);
} }
unsigned PackVmlinuxARMEL::write_vmlinux_head( unsigned PackVmlinuxARMEL::write_vmlinux_head(