Change pe/coff build-id section name to '.buildid'
authorJon TURNEY <jon.turney@dronecode.org.uk>
Sat, 30 Aug 2014 14:02:49 +0000 (15:02 +0100)
committerJon TURNEY <jon.turney@dronecode.org.uk>
Mon, 8 Sep 2014 16:54:20 +0000 (17:54 +0100)
The section name used to store the build-id on pe/coff is arbitrary, as it's
contents should be located using the pe/coff header's DataDirectory debug data
entry, not by using the section name.

But '.build-id' is not a good choice for that section name, as it is 9
characters long, and hence truncated to 8 characters when
--disable-long-section-names is used (which is the default, when producing an
executable with no dwarf debug sections, e.g. using ld --strip-all --build-id)

This truncation then breaks 'objcopy --only-keep-debug', which does use the
section name, due to concerns that keeping an arbitrary section which contains
the debug directory is not sensible.

binutils/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

* objcopy.c (is_nondebug_keep_contents_section): Change pe/coff
build-id section name from '.build-id' to '.buildid'.

ld/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

* emultempl/pe.em (write_build_id, setup_build_id): Change pe/coff
build-id section name from '.build-id' to '.buildid'.
* emultempl/pep.em (write_build_id, setup_build_id): Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
binutils/ChangeLog
binutils/objcopy.c
ld/ChangeLog
ld/emultempl/pe.em
ld/emultempl/pep.em

index 19569d42baf02601392e92105434189e045a7200..693e155048aaa4c7b5e835cce4efaff84fc507e0 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
+       * objcopy.c (is_nondebug_keep_contents_section): Change
+       '.build-id' to '.buildid'.
+
 2014-08-22  Richard Henderson  <rth@redhat.com>
 
        * dwarf.h (init_dwarf_regnames_aarch64): Declare.
index 46fd8bcd039dd120343130aa5166076df8e02f6d..3b353ad168a24e8899640cf8f111f27bce712513 100644 (file)
@@ -1148,13 +1148,13 @@ is_nondebug_keep_contents_section (bfd *ibfd, asection *isection)
   if (ibfd->xvec->flavour == bfd_target_elf_flavour)
     return (elf_section_type (isection) == SHT_NOTE);
 
-  /* Always keep the .build-id section for PE/COFF.
+  /* Always keep the .buildid section for PE/COFF.
 
      Strictly, this should be written "always keep the section storing the debug
      directory", but that may be the .text section for objects produced by some
      tools, which it is not sensible to keep.  */
   if (ibfd->xvec->flavour == bfd_target_coff_flavour)
-    return (strcmp (bfd_get_section_name (ibfd, isection), ".build-id") == 0);
+    return (strcmp (bfd_get_section_name (ibfd, isection), ".buildid") == 0);
 
   return FALSE;
 }
index 53f93bb135669c158082116a8dd3ad25108ff662..ac85c63582fef4d98218b2d8ec04e357d492291f 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
+       * emultempl/pe.em (write_build_id, setup_build_id): Change pe/coff
+       build-id section name from '.build-id' to '.buildid'.
+       * emultempl/pep.em (write_build_id, setup_build_id): Ditto.
+
 2014-08-22  Andreas Tobler  <andreast@fgznet.ch>
 
        * emulparams/armelf_fbsd.sh (TEXT_START_ADDR): Increase alignment to
index 7a5b77bf9b21d19b0da86458ae441258a48d1191..979cc8b8e960486a2867a8f8fd573ea5b9dd768c 100644 (file)
@@ -1297,7 +1297,7 @@ write_build_id (bfd *abfd)
   bfd_size_type build_id_size;
   unsigned char *build_id;
 
-  /* Find the section the .build-id output section has been merged info.  */
+  /* Find the section the .buildid output section has been merged info.  */
   for (asec = abfd->sections; asec != NULL; asec = asec->next)
     {
       struct bfd_link_order *l = NULL;
@@ -1319,7 +1319,7 @@ write_build_id (bfd *abfd)
 
   if (!link_order)
     {
-      einfo (_("%P: warning: .build-id section discarded,"
+      einfo (_("%P: warning: .buildid section discarded,"
                " --build-id ignored.\n"));
       return TRUE;
     }
@@ -1383,7 +1383,7 @@ write_build_id (bfd *abfd)
   return TRUE;
 }
 
-/* Make .build-id section, and set up coff_tdata->build_id. */
+/* Make .buildid section, and set up coff_tdata->build_id. */
 static bfd_boolean
 setup_build_id (bfd *ibfd)
 {
@@ -1398,7 +1398,7 @@ setup_build_id (bfd *ibfd)
 
   flags = (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
           | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
-  s = bfd_make_section_anyway_with_flags (ibfd, ".build-id", flags);
+  s = bfd_make_section_anyway_with_flags (ibfd, ".buildid", flags);
   if (s != NULL)
     {
       struct pe_tdata *t = pe_data (link_info.output_bfd);
@@ -1416,7 +1416,7 @@ setup_build_id (bfd *ibfd)
       return TRUE;
     }
 
-  einfo ("%P: warning: Cannot create .build-id section,"
+  einfo ("%P: warning: Cannot create .buildid section,"
         " --build-id ignored.\n");
   return FALSE;
 }
index 6d56bc321c890e8cffcf66f426a4150c7d57cbf5..b24a60820237ba3d65935924949b7f474ad2e1e1 100644 (file)
@@ -1261,7 +1261,7 @@ write_build_id (bfd *abfd)
   bfd_size_type build_id_size;
   unsigned char *build_id;
 
-  /* Find the section the .build-id output section has been merged info.  */
+  /* Find the section the .buildid output section has been merged info.  */
   for (asec = abfd->sections; asec != NULL; asec = asec->next)
     {
       struct bfd_link_order *l = NULL;
@@ -1283,7 +1283,7 @@ write_build_id (bfd *abfd)
 
   if (!link_order)
     {
-      einfo (_("%P: warning: .build-id section discarded,"
+      einfo (_("%P: warning: .buildid section discarded,"
                " --build-id ignored.\n"));
       return TRUE;
     }
@@ -1347,7 +1347,7 @@ write_build_id (bfd *abfd)
   return TRUE;
 }
 
-/* Make .build-id section, and set up coff_tdata->build_id. */
+/* Make .buildid section, and set up coff_tdata->build_id. */
 static bfd_boolean
 setup_build_id (bfd *ibfd)
 {
@@ -1362,7 +1362,7 @@ setup_build_id (bfd *ibfd)
 
   flags = (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
           | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
-  s = bfd_make_section_anyway_with_flags (ibfd, ".build-id", flags);
+  s = bfd_make_section_anyway_with_flags (ibfd, ".buildid", flags);
   if (s != NULL)
     {
       struct pe_tdata *t = pe_data (link_info.output_bfd);
@@ -1380,7 +1380,7 @@ setup_build_id (bfd *ibfd)
       return TRUE;
     }
 
-  einfo ("%P: warning: Cannot create .build-id section,"
+  einfo ("%P: warning: Cannot create .buildid section,"
         " --build-id ignored.\n");
   return FALSE;
 }
This page took 0.033245 seconds and 4 git commands to generate.