This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] BZ #14544: Use crtbeginT.o to statically link programs
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 4 Sep 2012 19:58:13 -0700
- Subject: [PATCH] BZ #14544: Use crtbeginT.o to statically link programs
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
We should use crtbeginT.o instead of crtbegin.o to statically link
programs. Tested on Linux/x86-64. OK to install?
Thanks.
H.J.
---
ChangeLog | 12 ++++++++++++
Makeconfig | 11 +++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
>From b0eb4b944f6d540df6a810d073014c5712335440 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 4 Sep 2012 19:53:24 -0700
Subject: [PATCH] Use crtbeginT.o to statically link programs
---
ChangeLog | 12 ++++++++++++
Makeconfig | 11 +++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5411be3..721a96f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14544]
+ * Makeconfig (link-static-before-libc): Replace $(+prector)
+ with $(+prectorT).
+ (link-static-after-libc): Replace $(+postctor) with
+ $(+postctorT).
+ (link-bounded): Replace $(+prector)/$(+postctor) with
+ $(+prectorT)/$(+postctorT).
+ (+prectorT): New macro.
+ (+postctorT): Likewise.
+
2012-09-04 Florian Weimer <fweimer@redhat.com>
* stdlib/tst-secure-getenv.c (alternative_main): Only warn on SGID
diff --git a/Makeconfig b/Makeconfig
index 57f35f9..1c87973 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -445,13 +445,13 @@ ifndef +link-static
+link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(addprefix $(csu-objpfx),$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static) $(link-libc-static)
-+link-static-after-libc = $(+postctor) $(+postinit)
++link-static-after-libc = $(+postctorT) $(+postinit)
+link-static = $(+link-static-before-libc) $(link-libc-static) \
$(+link-static-after-libc)
+link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
@@ -462,12 +462,12 @@ ifndef +link-bounded
+link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) \
$(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.ob \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-bounded) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+ $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctorT) $(+postinit)
endif
ifndef config-LDFLAGS
ifeq (yes,$(build-shared))
@@ -576,6 +576,9 @@ endif
+postinit = $(addprefix $(csu-objpfx),crtn.o)
+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+# Variants of the two previous definitions for statically linking programs.
++prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
++postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
# Variants of the two previous definitions for linking PIE programs.
+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
--
1.7.11.4