diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-17 18:37:58 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-11-17 10:50:25 -0800 |
commit | bf08493135bf7ac6f0c225efd2e104ee6ad4bb08 (patch) | |
tree | efb2f80212a689dff8c7972f88591c268ad2b394 | |
parent | 8115288d846dfcd0028d7d7489105557f2fe59d2 (diff) | |
download | gcc-hjl/pie/gcc-7-branch.tar.gz |
Use rcrt1.o%s/grcrt1.o%s to relocate static PIEhjl/pie/gcc-7-branch
crt1.o is used to create dynamic and non-PIE static executables. Static
PIE needs to link with rcrt1.o, instead of crt1.o, which is also used by
musl libc and OpenBSD:
https://gcc.gnu.org/ml/gcc/2015-06/msg00008.html
to relocate static PIE at run-time. When -pg is used with -static-pie,
grcrt1.o should be used.
* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
rcrt1.o%s/grcrt1.o%s for -static-pie.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254890 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/config/gnu-user.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h index a967b69a350..50e6feb1c30 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; \ |