Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/gcc/config Fix -static -pie to be -st...



details:   https://anonhg.NetBSD.org/src/rev/ec68cdb7bb08
branches:  trunk
changeset: 971532:ec68cdb7bb08
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 26 21:11:07 2020 +0000

description:
Fix -static -pie to be -static *and* -pie. Before it was just -static:
- Restructure the begin and end code so the top level conditional is "pie".
  There is no change for the end code, but we use crtbeginS for static pie.
- If -pie is specified, always pass it to the linker (otherwise we end up
  with non pie binaries).
- Remove an extra unneeded space in the shared linker definition.

diffstat:

 external/gpl3/gcc/dist/gcc/config/netbsd-elf.h |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (51 lines):

diff -r 9b0e7564ac74 -r ec68cdb7bb08 external/gpl3/gcc/dist/gcc/config/netbsd-elf.h
--- a/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h    Sun Apr 26 21:05:36 2020 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h    Sun Apr 26 21:11:07 2020 +0000
@@ -39,12 +39,12 @@
        %{p:gcrt0%O%s}          \
        %{!p:crt0%O%s}}}                \
    %:if-exists(crti%O%s)       \
-   %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
-   %{!static:                   \
-     %{!shared:                 \
-       %{!pie:crtbegin%O%s}     \
-       %{pie:crtbeginS%O%s}}    \
-     %{shared:crtbeginS%O%s}}"
+   %{pie:crtbeginS%O%s}                \
+   %{!pie:                     \
+     %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
+     %{!static:                 \
+       %{shared:crtbeginS%O%s} \
+       %{!shared:crtbegin%O%s}}}"
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
@@ -55,10 +55,10 @@
    C++ file-scope static objects deconstructed after exiting "main".  */
 
 #define NETBSD_ENDFILE_SPEC    \
-  "%{!shared:                   \
-    %{!pie:crtend%O%s}          \
-    %{pie:crtendS%O%s}}         \
-   %{shared:crtendS%O%s}        \
+  "%{pie:crtendS%O%s}          \
+   %{!pie:                     \
+     %{shared:crtendS%O%s}     \
+     %{!shared:crtend%O%s}}    \
    %:if-exists(crtn%O%s)"
 
 #undef ENDFILE_SPEC
@@ -85,11 +85,12 @@
      %{!nostdlib: \
        %{!r: \
         %{!e*:-e %(netbsd_entry_point)}}} \
+     %{pie:-pie} \
      %{!static: \
        %{rdynamic:-export-dynamic} \
        %(netbsd_link_ld_elf_so)} \
      %{static:-static \
-       %{pie: --no-dynamic-linker}}} \
+       %{pie:--no-dynamic-linker}}} \
    %{!shared:%{!nostdlib:%{!nodefaultlibs:\
      %{%:sanitize(address): -lasan } \
      %{%:sanitize(undefined): -lubsan}}}}"



Home | Main Index | Thread Index | Old Index