Convert .note.gnu.property section between ELF32 and ELF64
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Aug 2018 04:00:04 +0000 (21:00 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Aug 2018 04:00:18 +0000 (21:00 -0700)
commit6404ab993797d1d6cd3d9e97cc281e3cb6226c12
treeeee63602c3e8fdeca481656be671146ad4bbbaf1
parentf40f4a11d12025d18be2b0f9072f6ddcc94d3cdb
Convert .note.gnu.property section between ELF32 and ELF64

.note.gnu.property section has different alignments and section
sizes for 32-bit and 64-bit ELF binaries.  This patch updated
bfd_convert_section_size and bfd_convert_section_contents to
properly convert .note.gnu.property section between 32-bit and
64-bit ELF binaries.

bfd/

PR binutils/23494
* bfd.c (bfd_convert_section_size): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_property_size to convert
.note.gnu.property section size.
(bfd_convert_section_contents): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_properties to convert
.note.gnu.property section.
* elf-bfd.h (_bfd_elf_convert_gnu_property_size): New prototype.
(_bfd_elf_convert_gnu_properties): Likewise.
* elf-properties.c (elf_get_gnu_property_section_size): New
function.
(elf_write_gnu_properties): Likewise.
(_bfd_elf_convert_gnu_property_size): Likewise.
(_bfd_elf_convert_gnu_properties): Likewise.
(_bfd_elf_link_setup_gnu_properties): Use
elf_get_gnu_property_section_size and elf_write_gnu_properties.

binutils/

PR binutils/23494
* testsuite/binutils-all/x86-64/pr23494a-x32.d: New file.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
15 files changed:
bfd/ChangeLog
bfd/bfd.c
bfd/elf-bfd.h
bfd/elf-properties.c
binutils/ChangeLog
binutils/testsuite/binutils-all/x86-64/pr23494a-x32.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494a.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494a.s [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494b-x32.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494b.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494b.s [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494c-x32.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494c.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494d-x32.d [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr23494d.d [new file with mode: 0644]