aboutsummaryrefslogtreecommitdiff
path: root/Makeconfig
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-04-05 16:42:57 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-04-08 09:25:36 -0700
commit727aacfd667c026762b9aaa1a3a293f815edebba (patch)
tree810756bde14717cf0187fb615d5f4533aa73a19d /Makeconfig
parentf8d8b1b1e6d3b8b93f224efc796b7ea083fdb83f (diff)
downloadglibc-727aacfd667c026762b9aaa1a3a293f815edebba.zip
glibc-727aacfd667c026762b9aaa1a3a293f815edebba.tar.gz
glibc-727aacfd667c026762b9aaa1a3a293f815edebba.tar.bz2
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>
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig10
1 files changed, 6 insertions, 4 deletions
diff --git a/Makeconfig b/Makeconfig
index 85e00ce..e583765 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/