]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR lto/82598 (lto debugobj lacks .note.GNU-stack)
authorJakub Jelinek <jakub@redhat.com>
Wed, 18 Oct 2017 09:20:31 +0000 (11:20 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 18 Oct 2017 09:20:31 +0000 (11:20 +0200)
PR lto/82598
* simple-object.c (handle_lto_debug_sections): Copy over also
.note.GNU-stack section with unchanged name.
* simple-object-elf.c (SHF_EXECINSTR): Define.
(simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit
on .note.GNU-stack section.

From-SVN: r253851

libiberty/ChangeLog
libiberty/simple-object-elf.c
libiberty/simple-object.c

index ecbf3e7d41d2cecef358589d5a48177d77944cef..f1f010327b065faddad862af937b899e18106d28 100644 (file)
@@ -1,3 +1,12 @@
+2017-10-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/82598
+       * simple-object.c (handle_lto_debug_sections): Copy over also
+       .note.GNU-stack section with unchanged name.
+       * simple-object-elf.c (SHF_EXECINSTR): Define.
+       (simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit
+       on .note.GNU-stack section.
+
 2017-09-25  Nathan Sidwell  <nathan@acm.org>
 
        PR demangler/82195
index 7eb3df856688d8cbeed239a4e51cb40b8f1b2b9a..c39492439d099372f1d76e5b14d0015484bc3a5a 100644 (file)
@@ -196,6 +196,7 @@ typedef struct {
 
 /* Values for sh_flags field.  */
 
+#define SHF_EXECINSTR  0x00000004      /* Executable section.  */
 #define SHF_EXCLUDE    0x80000000      /* Link editor is to exclude this
                                           section from executable and
                                           shared library that it builds
@@ -1403,7 +1404,14 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
       flags = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
                               shdr, sh_flags, Elf_Addr);
       if (ret == 0)
-       flags &= ~SHF_EXCLUDE;
+       {
+         /* The debugobj doesn't contain any code, thus no trampolines.
+            Even when the original object needs trampolines, debugobj
+            doesn't.  */
+         if (strcmp (name, ".note.GNU-stack") == 0)
+           flags &= ~SHF_EXECINSTR;
+         flags &= ~SHF_EXCLUDE;
+       }
       else if (ret == -1)
        flags = SHF_EXCLUDE;
       ELF_SET_FIELD (type_functions, ei_class, Shdr,
index 553e90f50480bc8af2b3cb95d2338630bac117e2..19d222fb1cd11cfe5b0dfc30b5399457be4e568e 100644 (file)
@@ -273,6 +273,9 @@ handle_lto_debug_sections (const char **name)
       *name = *name + sizeof (".gnu.lto_") - 1;
       return 1;
     }
+  /* Copy over .note.GNU-stack section under the same name if present.  */
+  else if (strcmp (*name, ".note.GNU-stack") == 0)
+    return 1;
   return 0;
 }