public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: add static-pie support
@ 2023-10-07 11:32 yanzhang.wang
  2023-10-07 16:13 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: yanzhang.wang @ 2023-10-07 11:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: juzhe.zhong, kito.cheng, pan2.li, yanzhang.wang

From: Yanzhang Wang <yanzhang.wang@intel.com>

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>
---

Have tested with glibc enabled and no regression of gcc found.

 gcc/config/riscv/linux.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 7323ff30f70..8901671ddf6 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 "/ "		\
-- 
2.42.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: add static-pie support
  2023-10-07 11:32 [PATCH] RISC-V: add static-pie support yanzhang.wang
@ 2023-10-07 16:13 ` Jeff Law
  2023-10-08  0:41   ` Li, Pan2
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-10-07 16:13 UTC (permalink / raw)
  To: yanzhang.wang, gcc-patches; +Cc: juzhe.zhong, kito.cheng, pan2.li



On 10/7/23 05:32, yanzhang.wang@intel.com wrote:
> From: Yanzhang Wang <yanzhang.wang@intel.com>
> 
> 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.
OK.
jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] RISC-V: add static-pie support
  2023-10-07 16:13 ` Jeff Law
@ 2023-10-08  0:41   ` Li, Pan2
  0 siblings, 0 replies; 3+ messages in thread
From: Li, Pan2 @ 2023-10-08  0:41 UTC (permalink / raw)
  To: Jeff Law, Wang, Yanzhang, gcc-patches; +Cc: juzhe.zhong, kito.cheng

Committed, thanks Jeff.

Pan

-----Original Message-----
From: Jeff Law <jeffreyalaw@gmail.com> 
Sent: Sunday, October 8, 2023 12:13 AM
To: Wang, Yanzhang <yanzhang.wang@intel.com>; gcc-patches@gcc.gnu.org
Cc: juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Li, Pan2 <pan2.li@intel.com>
Subject: Re: [PATCH] RISC-V: add static-pie support



On 10/7/23 05:32, yanzhang.wang@intel.com wrote:
> From: Yanzhang Wang <yanzhang.wang@intel.com>
> 
> 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.
OK.
jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-08  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07 11:32 [PATCH] RISC-V: add static-pie support yanzhang.wang
2023-10-07 16:13 ` Jeff Law
2023-10-08  0:41   ` Li, Pan2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).