summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libelf/ChangeLog8
-rw-r--r--libelf/gelf.h12
-rw-r--r--libelf/gelf_newehdr.c6
-rw-r--r--libelf/gelf_newphdr.c6
4 files changed, 22 insertions, 10 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 64141288..8539cb56 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,11 @@
+2016-10-11 Akihiko Odaki <[email protected]>
+ Mark Wielaard <[email protected]>
+
+ * gelf.h (gelf_newehdr): Change return type to void *.
+ (gelf_newphdr): Likewise.
+ * gelf_newehdr.c (gelf_newehdr): Likewise.
+ * gelf_newphdr.c (gelf_newphdr): Likewise.
+
2016-10-21 Mark Wielaard <[email protected]>
* elf_getdata.c (__libelf_set_rawdata_wrlock): Sanity check
diff --git a/libelf/gelf.h b/libelf/gelf.h
index 1bc7ee72..06198803 100644
--- a/libelf/gelf.h
+++ b/libelf/gelf.h
@@ -165,8 +165,10 @@ extern GElf_Ehdr *gelf_getehdr (Elf *__elf, GElf_Ehdr *__dest);
/* Update the ELF header. */
extern int gelf_update_ehdr (Elf *__elf, GElf_Ehdr *__src);
-/* Create new ELF header if none exists. */
-extern unsigned long int gelf_newehdr (Elf *__elf, int __class);
+/* Create new ELF header if none exists. Creates an Elf32_Ehdr if CLASS
+ is ELFCLASS32 or an Elf64_Ehdr if CLASS is ELFCLASS64. Returns NULL
+ on error. */
+extern void *gelf_newehdr (Elf *__elf, int __class);
/* Get section at OFFSET. */
extern Elf_Scn *gelf_offscn (Elf *__elf, GElf_Off __offset);
@@ -183,8 +185,10 @@ extern GElf_Phdr *gelf_getphdr (Elf *__elf, int __ndx, GElf_Phdr *__dst);
/* Update the program header. */
extern int gelf_update_phdr (Elf *__elf, int __ndx, GElf_Phdr *__src);
-/* Create new program header with PHNUM entries. */
-extern unsigned long int gelf_newphdr (Elf *__elf, size_t __phnum);
+/* Create new program header with PHNUM entries. Creates either an
+ Elf32_Phdr or an Elf64_Phdr depending on whether the given ELF is
+ ELFCLASS32 or ELFCLASS64. Returns NULL on error. */
+extern void *gelf_newphdr (Elf *__elf, size_t __phnum);
/* Get compression header of section if any. Returns NULL and sets
elf_errno if the section isn't compressed or an error occurred. */
diff --git a/libelf/gelf_newehdr.c b/libelf/gelf_newehdr.c
index cfa80e1b..27889066 100644
--- a/libelf/gelf_newehdr.c
+++ b/libelf/gelf_newehdr.c
@@ -37,10 +37,10 @@
#include "libelfP.h"
-unsigned long int
+void *
gelf_newehdr (Elf *elf, int class)
{
return (class == ELFCLASS32
- ? (unsigned long int) INTUSE(elf32_newehdr) (elf)
- : (unsigned long int) INTUSE(elf64_newehdr) (elf));
+ ? (void *) INTUSE(elf32_newehdr) (elf)
+ : (void *) INTUSE(elf64_newehdr) (elf));
}
diff --git a/libelf/gelf_newphdr.c b/libelf/gelf_newphdr.c
index 4e95474e..84aad781 100644
--- a/libelf/gelf_newphdr.c
+++ b/libelf/gelf_newphdr.c
@@ -37,10 +37,10 @@
#include "libelfP.h"
-unsigned long int
+void *
gelf_newphdr ( Elf *elf, size_t phnum)
{
return (elf->class == ELFCLASS32
- ? (unsigned long int) INTUSE(elf32_newphdr) (elf, phnum)
- : (unsigned long int) INTUSE(elf64_newphdr) (elf, phnum));
+ ? (void *) INTUSE(elf32_newphdr) (elf, phnum)
+ : (void *) INTUSE(elf64_newphdr) (elf, phnum));
}