summaryrefslogtreecommitdiffstats
path: root/libelf
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2015-10-06 10:16:58 -0700
committerChih-hung Hsieh <chh@google.com>2015-10-06 22:11:51 +0000
commit15edce876ace54b89eebd323d89643e7712e717a (patch)
tree4c47e4e2c36cda429b77d2b9ec52a1aa821e214d /libelf
parent684ae4fee9aef03ebebe8b159ca82fbce1220b99 (diff)
parent22843755fa0b6870162660105c6fbbd1ba078390 (diff)
downloadandroid_external_elfutils-15edce876ace54b89eebd323d89643e7712e717a.tar.gz
android_external_elfutils-15edce876ace54b89eebd323d89643e7712e717a.tar.bz2
android_external_elfutils-15edce876ace54b89eebd323d89643e7712e717a.zip
Merge latest upstream commit 2284375.
* Four libdwfl nested functions were converted to standard C syntax, to compile with clang/llvm. * Other upstream changes since SHA d8698e5, see git log for details: sparc relocation types, update sh_info in unstrip, strtab/shstrtab string tables in strip and unstrip, update e_version and e_shentsize in elf_update, Ukrainian translation. Change-Id: Ib5871cd3873a8fdf88683c30d95effc7fdc338f5
Diffstat (limited to 'libelf')
-rw-r--r--libelf/ChangeLog5
-rw-r--r--libelf/elf32_updatenull.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 1916877c..0609b37d 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-29 Mark Wielaard <mjw@redhat.com>
+
+ * elf32_updatenull.c (default_ehdr): Set e_version when EV_NONE.
+ (updatenull_wrlock): Always set e_shentsize.
+
2015-09-23 Mark Wielaard <mjw@redhat.com>
* elf32_getehdr.c (getehdr_wrlock): Mark as internal_function.
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
index c59ffcbd..d3754d32 100644
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -84,8 +84,12 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr,
update_if_changed (ehdr->e_ident[EI_VERSION], EV_CURRENT,
elf->state.ELFW(elf,LIBELFBITS).ehdr_flags);
- if (unlikely (ehdr->e_version == EV_NONE)
- || unlikely (ehdr->e_version >= EV_NUM))
+ if (unlikely (ehdr->e_version == EV_NONE))
+ {
+ ehdr->e_version = EV_CURRENT;
+ elf->state.ELFW(elf,LIBELFBITS).ehdr_flags |= ELF_F_DIRTY;
+ }
+ else if (unlikely (ehdr->e_version >= EV_NUM))
{
__libelf_seterrno (ELF_E_UNKNOWN_VERSION);
return 1;
@@ -394,6 +398,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
while ((list = list->next) != NULL);
/* Store section information. */
+ update_if_changed (ehdr->e_shentsize,
+ elf_typesize (LIBELFBITS, ELF_T_SHDR, 1), ehdr_flags);
if (elf->flags & ELF_F_LAYOUT)
{
/* The user is supposed to fill out e_shoff. Use it and
@@ -414,9 +420,6 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
- update_if_changed (ehdr->e_shentsize,
- elf_typesize (LIBELFBITS, ELF_T_SHDR, 1),
- ehdr_flags);
/* Account for the section header size. */
size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);