diff options
author | kaiw <kaiw@FreeBSD.org> | 2010-07-21 08:58:52 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2010-07-21 08:58:52 +0000 |
commit | d52f6374a8ac2ed4442c862b5c27e12e7921db39 (patch) | |
tree | 1fd64483b461c3a95643505ccb63407707d65990 /lib | |
parent | 19ba81c75ab61e11e242da176f498a77890674fe (diff) | |
download | FreeBSD-src-d52f6374a8ac2ed4442c862b5c27e12e7921db39.zip FreeBSD-src-d52f6374a8ac2ed4442c862b5c27e12e7921db39.tar.gz |
Bug fix: when updating headers using the gelf_update_*() functions,
the appropriate `dirty' bit needs to be set for both the Elf32 and
Elf64 case.
Obtained from: elftoolchain
MFC after: 1 month
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libelf/gelf_ehdr.c | 4 | ||||
-rw-r--r-- | lib/libelf/gelf_phdr.c | 4 | ||||
-rw-r--r-- | lib/libelf/gelf_shdr.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/libelf/gelf_ehdr.c b/lib/libelf/gelf_ehdr.c index 4d7698a..f3e8c76 100644 --- a/lib/libelf/gelf_ehdr.c +++ b/lib/libelf/gelf_ehdr.c @@ -137,6 +137,8 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); + (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { eh64 = (Elf64_Ehdr *) ehdr; *eh64 = *s; @@ -161,7 +163,5 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) eh32->e_shnum = s->e_shnum; eh32->e_shstrndx = s->e_shstrndx; - (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } diff --git a/lib/libelf/gelf_phdr.c b/lib/libelf/gelf_phdr.c index 6d82d7f..654b99d 100644 --- a/lib/libelf/gelf_phdr.c +++ b/lib/libelf/gelf_phdr.c @@ -155,6 +155,8 @@ gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) return (0); } + (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { ph64 = e->e_u.e_elf.e_phdr.e_phdr64 + ndx; *ph64 = *s; @@ -172,7 +174,5 @@ gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) LIBELF_COPY_U32(ph32, s, p_memsz); LIBELF_COPY_U32(ph32, s, p_align); - (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } diff --git a/lib/libelf/gelf_shdr.c b/lib/libelf/gelf_shdr.c index efe98b8..3f8f562 100644 --- a/lib/libelf/gelf_shdr.c +++ b/lib/libelf/gelf_shdr.c @@ -107,6 +107,8 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *s) return (0); } + (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { scn->s_shdr.s_shdr64 = *s; return (1); @@ -125,7 +127,5 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *s) LIBELF_COPY_U32(sh32, s, sh_addralign); LIBELF_COPY_U32(sh32, s, sh_entsize); - (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); - return (1); } |