From afbd55362239c85fffad0ce8ce1ff1fbdfb4137c Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 30 Aug 2011 03:40:53 +0200 Subject: [PATCH] Silence some compilation warnings. --- src/p_lx_elf.cpp | 12 ++++++------ src/p_lx_elf.h | 7 +++---- src/p_lx_interp.cpp | 2 +- src/p_vmlinx.cpp | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 00ebb4ef..9bd96326 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -47,7 +47,7 @@ #define PT_NOTE32 Elf32_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_VER5 = 0x05000000; @@ -1703,7 +1703,7 @@ PackNetBSDElf32x86::generateElfHdr( unsigned char *cp = note_body; unsigned j; 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)) + up4(get_te32(&np->descsz)); @@ -1754,7 +1754,7 @@ PackNetBSDElf32x86::generateElfHdr( unsigned bits = get_te32(&np_PaX->body[4]); bits &= ~PAX_MPROTECT; 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); note_offset += sz_PaX; @@ -1790,7 +1790,7 @@ PackOpenBSDElf32x86::generateElfHdr( unsigned const brka ) { - cprElfHdr3 *const h3 = (cprElfHdr3 *)&elfout; + cprElfHdr3 *const h3 = (cprElfHdr3 *)(void *)&elfout; memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK h3->ehdr.e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi; assert(2==get_te16(&h3->ehdr.e_phnum)); @@ -2913,7 +2913,7 @@ Linker* PackLinuxElf32armBe::newLinker() const } 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; int j = e_phnum; @@ -2963,7 +2963,7 @@ PackLinuxElf32::elf_unsigned_dynamic(unsigned int const key) const return 0; } -unsigned +acc_uint64l_t PackLinuxElf64::elf_get_offset_from_address(acc_uint64l_t const addr) const { Elf64_Phdr const *phdr = phdri; diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index 907273fd..27ef70c6 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -63,8 +63,7 @@ protected: virtual void addStubEntrySections(Filter const *); 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; protected: @@ -134,7 +133,7 @@ protected: static unsigned elf_hash(char const *) /*const*/; static unsigned gnu_hash(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_type(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, 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_type(unsigned) const; void const *elf_find_dynamic(unsigned) const; diff --git a/src/p_lx_interp.cpp b/src/p_lx_interp.cpp index 7cf8eb4e..99fe5f67 100644 --- a/src/p_lx_interp.cpp +++ b/src/p_lx_interp.cpp @@ -114,7 +114,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &) h3.phdr[2].p_align = 1; if (opt->o_unix.make_ptinterp) { // unusual "once per release" - *(cprElfHdr3 *)&elfout = h3; + *(cprElfHdr3 *)(void *)&elfout = h3; elfout.ehdr.e_phnum = 1; fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize); } diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index 71a6eae3..db7db7de 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -1079,8 +1079,8 @@ void PackVmlinuxAMD64::defineDecompressorSymbols() // 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 // would be to use ehdri.e_entry (startup_64). - linker->defineSymbol("ENTRY_POINT", phdri[0].p_paddr); - linker->defineSymbol("PHYSICAL_START", phdri[0].p_paddr); + linker->defineSymbol("ENTRY_POINT", (unsigned) phdri[0].p_paddr); + linker->defineSymbol("PHYSICAL_START", (unsigned) phdri[0].p_paddr); } unsigned PackVmlinuxARMEL::write_vmlinux_head(