[gcc r10-7036] Keep .GCC.command.line sections of LTO objetcs

Richard Biener rguenth@gcc.gnu.org
Thu Mar 5 07:44:00 GMT 2020


https://gcc.gnu.org/g:c9f90a25d4945e904839326957c7c4d34abd88dd

commit r10-7036-gc9f90a25d4945e904839326957c7c4d34abd88dd
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Mar 5 08:44:11 2020 +0100

    Keep .GCC.command.line sections of LTO objetcs
    
    This patch is for .GCC.command.line sections in LTO objects to be copied
    into the final objects as in the following example:
    
    [egeyar@localhost lto]$ gcc -flto -O3 demo.c -c -g --record-gcc-command-line
    [egeyar@localhost lto]$ gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2
    [egeyar@localhost lto]$ gcc demo.o demo2.o -o a.out
    [egeyar@localhost lto]$ readelf -p .GCC.command.line a.out
    
    String dump of section '.GCC.command.line':
      [     0]  10.0.1 20200227 (experimental) : gcc -flto -O3 demo.c -c -g --record-gcc-command-line
      [    56]  10.0.1 20200227 (experimental) : gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2
    
    2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
    
    	* simple-object.c (handle_lto_debug_sections): Name
    	".GCC.command.line" among debug sections to be copied over
    	from lto objects.

Diff:
---
 libiberty/ChangeLog       | 6 ++++++
 libiberty/simple-object.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 4c8b236..106c107 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
+
+	* simple-object.c (handle_lto_debug_sections): Name
+	".GCC.command.line" among debug sections to be copied over
+	from lto objects.
+
 2020-03-02  Nick Clifton  <nickc@redhat.com>
 
 	* testsuite/demangle-expected: Update expected demangling of
diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c
index e6c466a..92f5698 100644
--- a/libiberty/simple-object.c
+++ b/libiberty/simple-object.c
@@ -301,6 +301,9 @@ handle_lto_debug_sections (const char *name, int rename)
      COMDAT sections in objects produced by GCC.  */
   else if (strcmp (name, ".comment") == 0)
     return strcpy (newname, name);
+  /* Copy over .GCC.command.line section under the same name if present.  */
+  else if (strcmp (name, ".GCC.command.line") == 0)
+    return strcpy (newname, name);
   free (newname);
   return NULL;
 }



More information about the Gcc-cvs mailing list