diff options
author | Xi Ruoyao <xry111@xry111.site> | 2022-09-13 23:21:39 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2022-09-20 13:59:30 +0800 |
commit | 90d3e27f3a6add0cd6892bdf07c6a2538bb709e4 (patch) | |
tree | 1c2fa4462b693fec03020dda233b4ab11186e1a1 /gcc/config | |
parent | 2b61ed838c7f3f4bf54d4530c0f053b420623beb (diff) | |
download | gcc-90d3e27f3a6add0cd6892bdf07c6a2538bb709e4.zip gcc-90d3e27f3a6add0cd6892bdf07c6a2538bb709e4.tar.gz gcc-90d3e27f3a6add0cd6892bdf07c6a2538bb709e4.tar.bz2 |
LoongArch: Prepare static PIE support
Static PIE allows us to extend the ASLR to cover static executables and
it's not too difficult to support it. On GCC side, we just pass a group
of options to the linker, like other ports with static PIE support.
The real implementation of static PIE (rcrt1.o) will be added into Glibc
later.
gcc/ChangeLog:
* config/loongarch/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): For
-static-pie, pass -static -pie --no-dynamic-linker -z text to
the linker, and do not pass --dynamic-linker.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/loongarch/gnu-user.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h index 664dc92..c5b1afe 100644 --- a/gcc/config/loongarch/gnu-user.h +++ b/gcc/config/loongarch/gnu-user.h @@ -40,8 +40,10 @@ along with GCC; see the file COPYING3. If not see #undef GNU_USER_TARGET_LINK_SPEC #define GNU_USER_TARGET_LINK_SPEC \ "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \ - "%{!shared: %{static} %{!static: %{rdynamic:-export-dynamic} " \ - "-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" + "%{!shared: %{static} " \ + "%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \ + "-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \ + "%{static-pie: -static -pie --no-dynamic-linker -z text}}" /* Similar to standard Linux, but adding -ffast-math support. */ |