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
This commit is contained in:
parent
7ee5b008fb
commit
e8968eb491
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210325
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user