diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-04-14 05:30:59 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-04-14 05:31:15 -0700 |
commit | 9917b5596a372317c9708c7166cff9dd69b62d5e (patch) | |
tree | 43350626d6b8db288bbdb35c327a7ed587c8fa6d /bfd | |
parent | 6be872a439e15d12e86e7c5889f9e0b7804e59c6 (diff) | |
download | gdb-9917b5596a372317c9708c7166cff9dd69b62d5e.zip gdb-9917b5596a372317c9708c7166cff9dd69b62d5e.tar.gz gdb-9917b5596a372317c9708c7166cff9dd69b62d5e.tar.bz2 |
elf: Set p_memsz to p_filesz for loadable PT_NOTE segment
Since p_memsz of the loadable PT_NOTE segment should be the same as
p_filesz, set p_memsz on the loadable PT_NOTE segment when updating
p_filesz.
bfd/
PR binutils/27708
* elf.c (assign_file_positions_for_non_load_sections): Set
p_memsz to p_filesz for the loadable PT_NOTE segment.
binutils/
PR binutils/27708
* testsuite/binutils-all/x86-64/pr27708.dump: New file.
* testsuite/binutils-all/x86-64/pr27708.exe.bz2: Likewise.
* testsuite/binutils-all/x86-64/x86-64.exp: Run binutils/27708
test.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d03929a..6c89655 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-04-14 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/27708 + * elf.c (assign_file_positions_for_non_load_sections): Set + p_memsz to p_filesz for the loadable PT_NOTE segment. + 2021-04-14 Frederic Cambus <fred@statdns.com> * elf.c (elfcore_grok_netbsd_note): Remove unneeded #ifdef @@ -6300,6 +6300,11 @@ assign_file_positions_for_non_load_sections (bfd *abfd, { p->p_filesz = (sect->filepos - m->sections[0]->filepos + hdr->sh_size); + /* NB: p_memsz of the loadable PT_NOTE segment + should be the same as p_filesz. */ + if (p->p_type == PT_NOTE + && (hdr->sh_flags & SHF_ALLOC) != 0) + p->p_memsz = p->p_filesz; break; } } |