This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie


crt1.o is used to create dynamic and non-PIE static executables.  Static
PIE needs to link with Pcrt1.o, instead of crt1.o, to relocate static PIE
at run-time.  When -pg is used with -static-pie, gPcrt1.o should be used.

Tested on x86-64.  OK for master?

Thanks.

H.J.
---
	* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
	Pcrt1.o%s/gPcrt1.o%s for -static-pie.
---
 gcc/config/gnu-user.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index a967b69a350..c1cfdc3da90 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,9 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if defined HAVE_LD_PIE
 #define GNU_USER_TARGET_STARTFILE_SPEC \
   "%{shared:; \
-     pg|p|profile:gcrt1.o%s; \
+     pg|p|profile:%{static-pie:gPcrt1.o%s;:gcrt1.o%s}; \
      static:crt1.o%s; \
-     static-pie|" PIE_SPEC ":Scrt1.o%s; \
+     static-pie:Pcrt1.o%s; \
+     " PIE_SPEC ":Scrt1.o%s; \
      :crt1.o%s} \
    crti.o%s \
    %{static:crtbeginT.o%s; \
-- 
2.13.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]