[PATCH] BZ #14544: Use crtbeginT.o to statically link programs
Andreas Jaeger
aj@suse.com
Thu Sep 6 18:32:00 GMT 2012
On 09/05/2012 04:58 AM, H.J. Lu wrote:
> 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`
I would sort them alphabetically, so after the PIE definitions.
> # 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`
this is fine, please submit with the change above,
thanks,
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
More information about the Libc-alpha
mailing list