From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7535 Path: news.gmane.org!not-for-mail From: Andre McCurdy Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] force LTO to be disabled when compiling dlstart.lo Date: Mon, 27 Apr 2015 23:12:34 -0700 Message-ID: <1430201554-11359-1-git-send-email-armccurdy@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1430201597 7700 80.91.229.3 (28 Apr 2015 06:13:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2015 06:13:17 +0000 (UTC) Cc: Andre McCurdy To: musl@lists.openwall.com Original-X-From: musl-return-7548-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 28 08:13:05 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YmylU-0006Px-I1 for gllmg-musl@m.gmane.org; Tue, 28 Apr 2015 08:13:04 +0200 Original-Received: (qmail 28064 invoked by uid 550); 28 Apr 2015 06:13:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28004 invoked from network); 28 Apr 2015 06:12:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cHcxA68HpYllpn3LHUF/IyLX6uzBIuN9eFVppulhg/w=; b=KtBLTebuXFKmD0Ux+TUUFCVxfpI/4fj/V9bdqrg5EayvFvbTRpRassv0XXcBEvcm4z EDtElwq91yKAH58zPIfGjKU+DFFb79zIelvpEYzeWTsyZljNSwOxCvMJxcEIkZP0mloB myk6lxkYSSrk4IjOLv3mD0CxXNhFTnxXwkOG8I4Rsg3Vxid/xh0M9fOudQ6UiQZdp7qx CtGnT7z+3j70O5BxTTbFU6fwLLGlpxHmj+dGvZ9cCeB6hXDHW8UomQgOJpWGosmNqpCn /3SLYrUWZHp1wtxtobJ9CqrkXX3a7gH3FBGpSR0Lyp4at5cin95N2Vn4Sxdn8HrOTjHC znKQ== X-Received: by 10.107.19.213 with SMTP id 82mr18149990iot.34.1430201567802; Mon, 27 Apr 2015 23:12:47 -0700 (PDT) X-Mailer: git-send-email 1.9.1 Xref: news.gmane.org gmane.linux.lib.musl.general:7535 Archived-At: When LTO is enabled, the _dlstart_c symbol seems to get removed before the crt_arch.h assembler fragment which references it has been linked. Disabling LTO for dlstart.lo is a less intrusive workaround than making _dlstart_c globally visible. Signed-off-by: Andre McCurdy --- Makefile | 4 ++++ configure | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 6559295..48580fc 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,10 @@ src/ldso/dlstart.lo src/ldso/dynlink.lo: src/internal/dynlink.h arch/$(ARCH)/rel crt/crt1.o crt/Scrt1.o src/ldso/dlstart.lo: $(wildcard arch/$(ARCH)/crt_arch.h) +# Disable LTO as a workaround for the _dlstart_c symbol being removed +# before the crt_arch.h assembler fragment which references it is linked. +src/ldso/dlstart.lo: CFLAGS += $(CFLAGS_NOLTO) + crt/Scrt1.o: CFLAGS += -fPIC OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=src/%)) diff --git a/configure b/configure index 143dc92..69c6dab 100755 --- a/configure +++ b/configure @@ -112,6 +112,7 @@ fi CFLAGS_C99FSE= CFLAGS_AUTO= CFLAGS_MEMOPS= +CFLAGS_NOLTO= CFLAGS_NOSSP= LDFLAGS_AUTO= OPTIMIZE_GLOBS= @@ -296,6 +297,12 @@ CFLAGS_C99FSE="$CFLAGS_C99FSE -D__may_alias__=" fi # +# Check for options to disable LTO. If not found, this is not an +# error; we assume the toolchain does not support LTO. +# +tryflag CFLAGS_NOLTO -fno-lto + +# # Check for options to disable stack protector, which needs to be # disabled for a few early-bootstrap translation units. If not found, # this is not an error; we assume the toolchain does not do ssp. @@ -564,6 +571,7 @@ CC = $CC CFLAGS = $CFLAGS_AUTO $CFLAGS CFLAGS_C99FSE = $CFLAGS_C99FSE CFLAGS_MEMOPS = $CFLAGS_MEMOPS +CFLAGS_NOLTO = $CFLAGS_NOLTO CFLAGS_NOSSP = $CFLAGS_NOSSP CPPFLAGS = $CPPFLAGS LDFLAGS = $LDFLAGS_AUTO $LDFLAGS -- 1.9.1