]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: add static-pie support
authorYanzhang Wang <yanzhang.wang@intel.com>
Sat, 7 Oct 2023 11:32:25 +0000 (19:32 +0800)
committerPan Li <pan2.li@intel.com>
Sun, 8 Oct 2023 00:40:58 +0000 (08:40 +0800)
We only need to pass options to the linker when static-pie is passed.
There's another patch to enable static-pie in glibc. And we need to
enable in GCC first.

gcc/ChangeLog:

* config/riscv/linux.h: Pass the static-pie specific options to
the linker.

Signed-off-by: Yanzhang Wang <yanzhang.wang@intel.com>
gcc/config/riscv/linux.h

index 7323ff30f70304e8586dbdc0dafdb1b4586c2270..8901671ddf6064edc711b77c846abae77ea8b1c4 100644 (file)
@@ -55,9 +55,10 @@ along with GCC; see the file COPYING3.  If not see
 %{shared} \
   %{!shared: \
     %{!static: \
-      %{rdynamic:-export-dynamic} \
-      -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
-    %{static:-static}}"
+      %{!static-pie: \
+       %{rdynamic:-export-dynamic} \
+       -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+    %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
 
 #define STARTFILE_PREFIX_SPEC                  \
    "/lib" XLEN_SPEC "/" ABI_SPEC "/ "          \