Module Name:    src
Committed By:   christos
Date:           Sun Apr 26 21:11:07 UTC 2020

Modified Files:
        src/external/gpl3/gcc/dist/gcc/config: netbsd-elf.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.17 src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.18
--- src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.17	Tue Oct  1 06:38:17 2019
+++ src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h	Sun Apr 26 17:11:07 2020
@@ -39,12 +39,12 @@ along with GCC; see the file COPYING3.  
        %{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 @@ along with GCC; see the file COPYING3.  
    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 @@ along with GCC; see the file COPYING3.  
      %{!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}}}}"

Reply via email to