summaryrefslogtreecommitdiff
path: root/bfd/elfxx-target.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-03 08:03:14 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-03 08:08:27 -0700
commit46bed6796d5821832e8ba373ddb2e7fdc45a109d (patch)
tree0c7b181ff39eb800307fc0f7f2dc81d35ecb2aac /bfd/elfxx-target.h
parent82156ab704b08b124d319c0decdbd48b3ca2dac5 (diff)
downloadbinutils-gdb-46bed6796d5821832e8ba373ddb2e7fdc45a109d.tar.gz
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.
Diffstat (limited to 'bfd/elfxx-target.h')
-rw-r--r--bfd/elfxx-target.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index d063fb7f1ba..6cc9f3f7a60 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -519,6 +519,15 @@
#ifndef elf_backend_obj_attrs_handle_unknown
#define elf_backend_obj_attrs_handle_unknown NULL
#endif
+#ifndef elf_backend_parse_gnu_properties
+#define elf_backend_parse_gnu_properties NULL
+#endif
+#ifndef elf_backend_merge_gnu_properties
+#define elf_backend_merge_gnu_properties NULL
+#endif
+#ifndef elf_backend_setup_gnu_properties
+#define elf_backend_setup_gnu_properties _bfd_elf_link_setup_gnu_properties
+#endif
#ifndef elf_backend_static_tls_alignment
#define elf_backend_static_tls_alignment 1
#endif
@@ -838,6 +847,9 @@ static struct elf_backend_data elfNN_bed =
elf_backend_obj_attrs_section_type,
elf_backend_obj_attrs_order,
elf_backend_obj_attrs_handle_unknown,
+ elf_backend_parse_gnu_properties,
+ elf_backend_merge_gnu_properties,
+ elf_backend_setup_gnu_properties,
elf_backend_compact_eh_encoding,
elf_backend_cant_unwind_opcode,
elf_backend_static_tls_alignment,