public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ben Wolsieffer <benwolsieffer@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Lance Fredrickson <lancethepants@gmail.com>
Subject: Re: [PATCH] arm: add -static-pie support
Date: Sat, 30 Sep 2023 16:55:17 -0400	[thread overview]
Message-ID: <ZRiLNbXH1ApHSW1z@Dell-Inspiron-15> (raw)
In-Reply-To: <c7dc02a4-5fc1-956b-6d89-6c09a1a48b5a@gmail.com>

On Tue, Jul 19, 2022 at 02:21:05PM -0600, lancethepants wrote:
> The commit mirros 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

Hi,

This patch seems to have gotten a bit mangled when it was submitted,
so perhaps that's why it was ignored, but it would be great to get this
functionality in gcc.

In particular, systemd has begun relying on -static-pie for EFI
support, and has to implement workarounds (manually passing these flags
to the linker) for architectures that don't support -static-pie (see
[1], [2]).

Thanks, Ben

[1] https://github.com/NixOS/nixpkgs/pull/243242#issuecomment-1741835837
[2] https://github.com/systemd/systemd/issues/29381

      reply	other threads:[~2023-09-30 20:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 20:36 Lance Fredrickson
2023-09-30 20:55 ` Ben Wolsieffer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZRiLNbXH1ApHSW1z@Dell-Inspiron-15 \
    --to=benwolsieffer@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lancethepants@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).