]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/elf64-x86-64.c
ld: Support ELF GNU program properties
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 3 Apr 2017 15:03:14 +0000 (08:03 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 3 Apr 2017 15:08:27 +0000 (08:08 -0700)
commit46bed6796d5821832e8ba373ddb2e7fdc45a109d
tree0c7b181ff39eb800307fc0f7f2dc81d35ecb2aac
parent82156ab704b08b124d319c0decdbd48b3ca2dac5
ld: Support ELF GNU program properties

From .note.gnu.property section in each ELF input, we build a list of
GNU properties if .note.gnu.property section isn't corrupt.  The unknown
properties are ignored.  All property lists in relocatable inputs are
merged into an output property list.  When -z stack-size=N is used and
N isn't 0, the GNU_PROPERTY_STACK_SIZE property will be merged with or
added to the output property list.  .note.gnu.property section is
generated in output from the output property list.

bfd/

* Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
(BFD32_BACKENDS_CFILES): Add elf-properties.c.
* configure.ac (elf): Add elf-properties.lo.
* Makefile.in: Regenerated.
* configure: Likewise.
* elf-bfd.h (elf_property_kind): New.
(elf_property): Likewise.
(elf_property_list): Likewise.
(elf_properties): Likewise.
(_bfd_elf_parse_gnu_properties): Likewise.
(_bfd_elf_get_property): Likewise.
(_bfd_elf_link_setup_gnu_properties): Likewise.
(elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
and setup_gnu_properties.
(elf_obj_tdata): Add properties.
* elf-properties.c: New file.
* elf32-i386.c (elf_i386_parse_gnu_properties): New.
(elf_i386_merge_gnu_properties): Likewise.
(elf_backend_parse_gnu_properties): Likewise.
(elf_backend_merge_gnu_properties): Likewise.
* elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
(elf_x86_64_merge_gnu_properties): Likewise.
(elf_backend_parse_gnu_properties): Likewise.
(elf_backend_merge_gnu_properties): Likewise.
* elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
(elf_backend_parse_gnu_properties): Likewise.
(elf_backend_setup_gnu_properties): Likewise.
(elfNN_bed): Add elf_backend_parse_gnu_properties,
elf_backend_merge_gnu_properties and
elf_backend_setup_gnu_properties.

ld/

* ld/NEWS: Mention support for ELF GNU program properties.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Call
ELF setup_gnu_properties.
* testsuite/ld-i386/i386.exp: Run property tests for Linux/i386.
* testsuite/ld-i386/pass.c: New file.
* testsuite/ld-i386/property-1.r: Likewise.
* testsuite/ld-i386/property-2.r: Likewise.
* testsuite/ld-i386/property-3.r: Likewise.
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-6.r: Likewise.
* testsuite/ld-i386/property-6a.c: Likewise.
* testsuite/ld-i386/property-6b.c: Likewise.
* testsuite/ld-i386/property-6c.S: Likewise.
* testsuite/ld-i386/property-7.r: Likewise.
* testsuite/ld-i386/property-no-copy.S: Likewise.
* testsuite/ld-i386/property-stack.S: Likewise.
* testsuite/ld-i386/property-unsorted-1.S: Likewise.
* testsuite/ld-i386/property-unsorted-2.S: Likewise.
* testsuite/ld-i386/property-x86-1.S: Likewise.
* testsuite/ld-i386/property-x86-2.S: Likewise.
* testsuite/ld-x86-64/pass.c: Likewise.
* testsuite/ld-x86-64/property-1.r: Likewise.
* testsuite/ld-x86-64/property-2.r: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-6.r: Likewise.
* testsuite/ld-x86-64/property-6a.c: Likewise.
* testsuite/ld-x86-64/property-6b.c: Likewise.
* testsuite/ld-x86-64/property-6c.S: Likewise.
* testsuite/ld-x86-64/property-7.r: Likewise.
* testsuite/ld-x86-64/property-no-copy.S: Likewise.
* testsuite/ld-x86-64/property-stack.S: Likewise.
* testsuite/ld-x86-64/property-unsorted-1.S: Likewise.
* testsuite/ld-x86-64/property-unsorted-2.S: Likewise.
* testsuite/ld-x86-64/property-x86-1.S: Likewise.
* testsuite/ld-x86-64/property-x86-2.S: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run property tests for
Linux/x86-64.
50 files changed:
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/configure
bfd/configure.ac
bfd/elf-bfd.h
bfd/elf-properties.c [new file with mode: 0644]
bfd/elf.c
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elfxx-target.h
ld/ChangeLog
ld/NEWS
ld/emultempl/elf32.em
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pass.c [new file with mode: 0644]
ld/testsuite/ld-i386/property-1.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-2.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-3.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-4.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-5.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-6.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-6a.c [new file with mode: 0644]
ld/testsuite/ld-i386/property-6b.c [new file with mode: 0644]
ld/testsuite/ld-i386/property-6c.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-7.r [new file with mode: 0644]
ld/testsuite/ld-i386/property-no-copy.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-stack.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-unsorted-1.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-unsorted-2.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-x86-1.S [new file with mode: 0644]
ld/testsuite/ld-i386/property-x86-2.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/pass.c [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-1.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-2.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-3.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-4.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-5.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-6.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-6a.c [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-6b.c [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-6c.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-7.r [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-no-copy.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-stack.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-unsorted-1.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-unsorted-2.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-1.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/property-x86-2.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp