From: Yanzhang Wang Date: Sat, 7 Oct 2023 11:32:25 +0000 (+0800) Subject: RISC-V: add static-pie support X-Git-Tag: basepoints/gcc-15~5674 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b20e59f49b51b7baf05e1b727be5da947e617496;p=thirdparty%2Fgcc.git RISC-V: add static-pie support 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 --- diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index 7323ff30f703..8901671ddf60 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -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 "/ " \