From: Sergei Trofimovich <siarh...@google.com>

In --enable-default-pie mode compiler should switch from
using crtend.o to crtendS.o. On sparc it is especially visible
because crtend.o contains PIC-unfriendly code.

gcc:

2020-07-14  Sergei Trofimovich  <siarh...@google.com>

        PR driver/96190
        * config/sparc/linux.h: Use PIE_SPEC to select crtendS.o.
        * config/sparc/linux64.h: ditto
---
 gcc/config/sparc/linux.h   | 2 +-
 gcc/config/sparc/linux64.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 81201e67a2f..13d1d688880 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+  "%{shared|" PIE_SPEC ":crtendS.o%s;:crtend.o%s} crtn.o%s\
    %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 /* -mcpu=native handling only makes sense with compiler running on
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index a1a0efd8f28..be937dbaaf6 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -52,7 +52,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+  "%{shared|" PIE_SPEC ":crtendS.o%s;:crtend.o%s} crtn.o%s\
    %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 /* The default code model.  */
-- 
2.27.0

Reply via email to