Skip to content

Instantly share code, notes, and snippets.

@kaworu
Created March 20, 2013 09:53
Show Gist options
  • Save kaworu/5203536 to your computer and use it in GitHub Desktop.
Save kaworu/5203536 to your computer and use it in GitHub Desktop.
libelf patch to build with gcc48
Index: trunk/libelf/elf_update.c
===================================================================
--- trunk/libelf/elf_update.c (revision 2930)
+++ trunk/libelf/elf_update.c (working copy)
@@ -502,7 +502,7 @@
static off_t
_libelf_resync_elf(Elf *e, struct _Elf_Extent_List *extents)
{
- int ec, eh_class, eh_type;
+ int ec, eh_class;
unsigned int eh_byteorder, eh_version;
size_t align, fsz;
size_t phnum, shnum;
@@ -531,14 +531,12 @@
eh_class = eh32->e_ident[EI_CLASS];
phoff = (uint64_t) eh32->e_phoff;
shoff = (uint64_t) eh32->e_shoff;
- eh_type = eh32->e_type;
eh_version = eh32->e_version;
} else {
eh_byteorder = eh64->e_ident[EI_DATA];
eh_class = eh64->e_ident[EI_CLASS];
phoff = eh64->e_phoff;
shoff = eh64->e_shoff;
- eh_type = eh64->e_type;
eh_version = eh64->e_version;
}
Index: trunk/libelf/libelf_phdr.c
===================================================================
--- trunk/libelf/libelf_phdr.c (revision 2930)
+++ trunk/libelf/libelf_phdr.c (working copy)
@@ -38,7 +38,7 @@
void *
_libelf_getphdr(Elf *e, int ec)
{
- size_t phnum, phentsize;
+ size_t phnum;
size_t fsz, msz;
uint64_t phoff;
Elf32_Ehdr *eh32;
@@ -69,11 +69,9 @@
if (ec == ELFCLASS32) {
eh32 = (Elf32_Ehdr *) ehdr;
- phentsize = eh32->e_phentsize;
phoff = (uint64_t) eh32->e_phoff;
} else {
eh64 = (Elf64_Ehdr *) ehdr;
- phentsize = eh64->e_phentsize;
phoff = (uint64_t) eh64->e_phoff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment