Commit: Combine .gnu.build.attributes.* sections into .gnu.build.attributes

Nick Clifton nickc@redhat.com
Mon Jul 30 08:35:00 GMT 2018


Hi Guys,

  I recently updated the annobin plugin for gcc so that it will now
  generate .gnu.build.attributes.<foo> sections whenever a function
  is placed into its own section (called <foo>).  The patch below
  tells the linkers (gold and bfd) to combine these sections back into
  the main .gnu.build.attributes section during linking.

Cheers
  Nick

gold/ChangeLog
2018-07-30  Nick Clifton  <nickc@redhat.com>

	* layout.cc (section_name_mapping): Add an entry for
	.gnu.build.attributes.

ld/ChangeLog
2018-07-30  Nick Clifton  <nickc@redhat.com>

	* scripttempl/elf.sc: Place .gnu.build.attributes sections with
	other read-only sections.

diff --git a/gold/layout.cc b/gold/layout.cc
index 0df7ed37f0..66162a253d 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -5429,6 +5429,7 @@ const Layout::Section_name_mapping Layout::section_name_mapping[] =
   MAPPING_INIT(".gnu.linkonce.armextab.", ".ARM.extab"),
   MAPPING_INIT(".ARM.exidx", ".ARM.exidx"),
   MAPPING_INIT(".gnu.linkonce.armexidx.", ".ARM.exidx"),
+  MAPPING_INIT(".gnu.build.attributes.", ".gnu.build.attributes"),
 };
 
 // Mapping for ".text" section prefixes with -z,keep-text-section-prefix.
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 444aef2942..6bf6936362 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -564,6 +564,7 @@ cat <<EOF
   ${CREATE_SHLIB-${SDATA2}}
   ${CREATE_SHLIB-${SBSS2}}
   ${OTHER_READONLY_SECTIONS}
+  .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
   .eh_frame_hdr : { *(.eh_frame_hdr) ${RELOCATING+*(.eh_frame_entry .eh_frame_entry.*)} }
   .eh_frame     ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
   .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table



More information about the Binutils mailing list