public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>, commit-hurd@gnu.org
Subject: [hurd,commited] hurd: Add rules for static PIE build
Date: Sun, 12 Dec 2021 01:11:52 +0100	[thread overview]
Message-ID: <20211212001152.441384-1-samuel.thibault@ens-lyon.org> (raw)

This fixes [BZ #28671].
---
 csu/Makefile               | 17 ++++++++++++-----
 sysdeps/mach/hurd/Makefile |  2 ++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/csu/Makefile b/csu/Makefile
index e2390e4a7d..b52a98ffda 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -71,17 +71,21 @@ else
 extra-objs += gmon-start.o
 endif
 
+ifeq (yes,$(enable-static-pie))
+extra-objs += r$(start-installed-name) gr$(start-installed-name)
+install-lib += r$(start-installed-name) gr$(start-installed-name)
+endif
+
 ifneq ($(start-installed-name),$(static-start-installed-name))
-# FIXME: Only Hurd defines static-start-installed-name.  Hurd needs to
-# provide special rules to support static PIE.
 extra-objs += $(static-start-installed-name) g$(static-start-installed-name)
 omit-deps += $(patsubst %.o,%,$(static-start-installed-name) \
 			     g$(static-start-installed-name))
 install-lib += $(static-start-installed-name) g$(static-start-installed-name)
-else
 ifeq (yes,$(enable-static-pie))
-extra-objs += r$(start-installed-name) gr$(start-installed-name)
-install-lib += r$(start-installed-name) gr$(start-installed-name)
+extra-objs += r$(static-start-installed-name) gr$(static-start-installed-name)
+omit-deps += $(patsubst %.o,%,r$(static-start-installed-name) \
+			     gr$(static-start-installed-name))
+install-lib += r$(static-start-installed-name) gr$(static-start-installed-name)
 endif
 endif
 
@@ -150,6 +154,9 @@ ifneq ($(start-installed-name),$(static-start-installed-name))
 $(objpfx)g$(static-start-installed-name): \
   $(objpfx)g%: $(objpfx)% $(objpfx)gmon-start.o
 	$(link-relocatable)
+$(objpfx)gr$(static-start-installed-name): \
+  $(objpfx)gr%: $(objpfx)r% $(objpfx)gmon-start.o
+	$(link-relocatable)
 endif
 else
 $(addprefix $(objpfx),$(sort g$(start-installed-name) \
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 393e92210b..6a6a25ca1f 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -188,6 +188,8 @@ extra-objs += static-start.o
 # We need special startup code for statically linked binaries.
 $(objpfx)crt0.o: $(objpfx)static-start.o $(objpfx)abi-note.o $(objpfx)init.o $(objpfx)static-reloc.o
 	$(link-relocatable)
+$(objpfx)rcrt0.o: $(objpfx)static-start.o $(objpfx)abi-note.o $(objpfx)init.o
+	$(link-relocatable)
 
 endif
 \f
-- 
2.33.0


                 reply	other threads:[~2021-12-12  0:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211212001152.441384-1-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=commit-hurd@gnu.org \
    --cc=libc-alpha@sourceware.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).