public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lance Fredrickson <lancethepants@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] arm: add -static-pie support
Date: Tue, 19 Jul 2022 14:36:12 -0600	[thread overview]
Message-ID: <c7dc02a4-5fc1-956b-6d89-6c09a1a48b5a@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 252 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.

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

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

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


             reply	other threads:[~2022-07-19 20:36 UTC|newest]

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

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=c7dc02a4-5fc1-956b-6d89-6c09a1a48b5a@gmail.com \
    --to=lancethepants@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).