Hi!

When creating lto debugobj, we copy over just the debug sections,
and from the lack of .note.GNU-stack section then on various targets
the linker implies RWE PT_GNU_STACK segment header.

Fixed by copying over also the .note.GNU-stack section if present.
It is not 100% perfect solution if .note.GNU-stack in the original
indicates executable stack, in the debugobj we really don't need
it, so could get away with clearing the SHF_EXECINSTR bit, but in reality
it shouldn't be that bad, if the source had trampolines, then likely the
LTO objects will have them too.

Tested on x86_64-linux, ok for trunk?

2017-10-18  Jakub Jelinek  <ja...@redhat.com>

        PR lto/82598
        * simple-object.c (handle_lto_debug_sections): Copy over also
        .note.GNU-stack section with unchanged name.

--- libiberty/simple-object.c.jj        2017-09-01 09:27:00.000000000 +0200
+++ libiberty/simple-object.c   2017-10-18 09:15:51.088756028 +0200
@@ -273,6 +273,9 @@ handle_lto_debug_sections (const char **
       *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;
 }
 

        Jakub

Reply via email to