public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Use crtbeginT.o and crtend.o for non-PIE static executables
Date: Mon,  8 Apr 2024 16:26:01 +0000 (GMT)	[thread overview]
Message-ID: <20240408162601.48B6D3858CD1@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=727aacfd667c026762b9aaa1a3a293f815edebba

commit 727aacfd667c026762b9aaa1a3a293f815edebba
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Apr 5 16:42:57 2024 -0700

    Use crtbeginT.o and crtend.o for non-PIE static executables
    
    When static PIE is enabled by default, we shouldn't use crtbeginS.o and
    crtendS.o for non-PIE static executables.  Check $($(@F)-no-pie) to use
    crtbeginT.o and crtend.o to create non-PIE static executables.
    Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

Diff:
---
 Makeconfig | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makeconfig b/Makeconfig
index 85e00cef94..e583765712 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -705,13 +705,15 @@ endif
 +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
 +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
 # Variants of the two previous definitions for statically linking programs.
+static-prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
+static-postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
 ifeq (yes,$(enable-static-pie))
 # Static PIE must use PIE variants.
-+prectorT = $(+prectorS)
-+postctorT = $(+postctorS)
++prectorT = $(if $($(@F)-no-pie),$(static-prector),$(+prectorS))
++postctorT = $(if $($(@F)-no-pie),$(static-postctor),$(+postctorS))
 else
-+prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
-+postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
++prectorT = $(static-prector)
++postctorT =$(static-postctor)
 endif
 csu-objpfx = $(common-objpfx)csu/
 elf-objpfx = $(common-objpfx)elf/

                 reply	other threads:[~2024-04-08 16:26 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=20240408162601.48B6D3858CD1@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=glibc-cvs@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).