diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9d96f9564ef621c7def3e44e4617871763f6e7f1..5c02a76121d709af10fc237239f660fc031063d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
+	rcrt1.o%s/grcrt1.o%s for -static-pie.
+
 2017-11-17  Jan Hubicka  <hubicka@ucw.cz>
 
 	* i386.c (ix86_multiplication_cost, ix86_division_cost,
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index df17b18090696641d23b4bb157a49963e211e31d..93960f5cacb1074c76931193a85b5a680b65ab87 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:grcrt1.o%s;:gcrt1.o%s}; \
      static:crt1.o%s; \
-     static-pie|" PIE_SPEC ":Scrt1.o%s; \
+     static-pie:rcrt1.o%s; \
+     " PIE_SPEC ":Scrt1.o%s; \
      :crt1.o%s} \
    crti.o%s \
    %{static:crtbeginT.o%s; \