public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH V2] arm: add -static-pie support
@ 2022-07-20 14:06 Lance Fredrickson
  2022-08-04 16:47 ` Lance Fredrickson
  0 siblings, 1 reply; 5+ messages in thread
From: Lance Fredrickson @ 2022-07-20 14:06 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

This patch adds -static-pie support for the arm architecture. aarch64 
had the appropriate code for handling -static-pie, so this just mirrors 
the code found there.  Tested with uclibc-ng and musl c-standard 
libraries to produce static-pie binaries.  Re-submitted with minor spell 
check fix.

[-- Attachment #2: 0001-arm-add-static-pie-support.patch --]
[-- Type: text/plain, Size: 1114 bytes --]

From 4e122adfea2a6247f2da0c094f3203cbdf2a578c Mon Sep 17 00:00:00 2001
From: lancethepants <lancethepants@gmail.com>
Date: Tue, 19 Jul 2022 14:21:05 -0600
Subject: [PATCH V2] arm: add -static-pie support

The commit mirrors code from aarch64 to handle -static-pie.
Tested with uclibc-ng and musl c-standard libraries.

Signed-off-by: Lance Fredrickson <lancethepants@gmail.com>
---
 gcc/config/arm/linux-elf.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index df3da67c4f0..70f71b051a3 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -66,9 +66,10 @@
    %{static:-Bstatic} \
    %{shared:-shared} \
    %{symbolic:-Bsymbolic} \
-   %{!static: \
+   %{!static:%{!static-pie: \
      %{rdynamic:-export-dynamic} \
-     %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+     %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \
+   %{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \
    -X \
    %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    SUBTARGET_EXTRA_LINK_SPEC
-- 
2.20.1


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

* Re: [PATCH V2] arm: add -static-pie support
  2022-07-20 14:06 [PATCH V2] arm: add -static-pie support Lance Fredrickson
@ 2022-08-04 16:47 ` Lance Fredrickson
  2022-08-10 20:30   ` Ramana Radhakrishnan
  0 siblings, 1 reply; 5+ messages in thread
From: Lance Fredrickson @ 2022-08-04 16:47 UTC (permalink / raw)
  To: gcc-patches

Just a follow up trying to get some eyes on my static-pie patch 
submission for arm.
Feedback welcome.
https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598610.html

thanks,
Lance Fredrickson

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

* Re: [PATCH V2] arm: add -static-pie support
  2022-08-04 16:47 ` Lance Fredrickson
@ 2022-08-10 20:30   ` Ramana Radhakrishnan
  2022-08-16  3:05     ` Lance Fredrickson
  0 siblings, 1 reply; 5+ messages in thread
From: Ramana Radhakrishnan @ 2022-08-10 20:30 UTC (permalink / raw)
  To: Lance Fredrickson; +Cc: gcc-patches, Richard Earnshaw

Hi Lance,

Thanks for your contribution - looks like your first one to GCC ?

The patch looks good to me, though it should probably go through a
full test suite run on arm-linux-gnueabihf and get a ChangeLog - see
here for more https://gcc.gnu.org/contribute.html#patches.

This is probably small enough to go under the 10 line rule but since
you've used Signed-off-by in your patch, is that indicating you are
contributing under DCO rules -
https://gcc.gnu.org/contribute.html#legal ?

regards
Ramana


On Thu, Aug 4, 2022 at 5:48 PM Lance Fredrickson via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Just a follow up trying to get some eyes on my static-pie patch
> submission for arm.
> Feedback welcome.
> https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598610.html
>
> thanks,
> Lance Fredrickson

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

* Re: [PATCH V2] arm: add -static-pie support
  2022-08-10 20:30   ` Ramana Radhakrishnan
@ 2022-08-16  3:05     ` Lance Fredrickson
  2022-09-05 13:13       ` Andrea Corallo
  0 siblings, 1 reply; 5+ messages in thread
From: Lance Fredrickson @ 2022-08-16  3:05 UTC (permalink / raw)
  To: Ramana Radhakrishnan; +Cc: gcc-patches, Richard Earnshaw

Yes, this is a 1st submission.
Yes, I guess I was going for DCO rules.
I will look at running the test suite. Does this need to be done on the 
target? because my arm target is a measly dual core 1ghz embedded chip 
and low ram. Netgear R7000 router actually.

regards
Lance

On 8/10/2022 2:30 PM, Ramana Radhakrishnan wrote:
> Hi Lance,
>
> Thanks for your contribution - looks like your first one to GCC ?
>
> The patch looks good to me, though it should probably go through a
> full test suite run on arm-linux-gnueabihf and get a ChangeLog - see
> here for more https://gcc.gnu.org/contribute.html#patches.
>
> This is probably small enough to go under the 10 line rule but since
> you've used Signed-off-by in your patch, is that indicating you are
> contributing under DCO rules -
> https://gcc.gnu.org/contribute.html#legal ?
>
> regards
> Ramana
>
>
> On Thu, Aug 4, 2022 at 5:48 PM Lance Fredrickson via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>> Just a follow up trying to get some eyes on my static-pie patch
>> submission for arm.
>> Feedback welcome.
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598610.html
>>
>> thanks,
>> Lance Fredrickson


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

* Re: [PATCH V2] arm: add -static-pie support
  2022-08-16  3:05     ` Lance Fredrickson
@ 2022-09-05 13:13       ` Andrea Corallo
  0 siblings, 0 replies; 5+ messages in thread
From: Andrea Corallo @ 2022-09-05 13:13 UTC (permalink / raw)
  To: Lance Fredrickson via Gcc-patches
  Cc: Ramana Radhakrishnan, Lance Fredrickson, Richard Earnshaw

Lance Fredrickson via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

> Yes, this is a 1st submission.
> Yes, I guess I was going for DCO rules.
> I will look at running the test suite. Does this need to be done on
> the target? because my arm target is a measly dual core 1ghz embedded
> chip and low ram. Netgear R7000 router actually.

Hi Lance,

you should be able to use qemu to run arm-linux-gnueabihf binaries and
as a consequance the testsuite if you prefer.

BR

  Andrea

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

end of thread, other threads:[~2022-09-05 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 14:06 [PATCH V2] arm: add -static-pie support Lance Fredrickson
2022-08-04 16:47 ` Lance Fredrickson
2022-08-10 20:30   ` Ramana Radhakrishnan
2022-08-16  3:05     ` Lance Fredrickson
2022-09-05 13:13       ` Andrea Corallo

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