mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andre McCurdy <armccurdy@gmail.com>
To: musl@lists.openwall.com
Cc: Andre McCurdy <armccurdy@gmail.com>
Subject: [PATCH] force LTO to be disabled when compiling dlstart.lo
Date: Mon, 27 Apr 2015 23:12:34 -0700	[thread overview]
Message-ID: <1430201554-11359-1-git-send-email-armccurdy@gmail.com> (raw)

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 <armccurdy@gmail.com>
---
 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



             reply	other threads:[~2015-04-28  6:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28  6:12 Andre McCurdy [this message]
2015-04-28  8:35 ` Alexander Monakov
2015-04-28  8:45   ` Alexander Monakov
2015-04-28 13:43   ` Rich Felker
2015-04-28 14:48     ` Khem Raj
2015-04-28 18:41     ` Alexander Monakov
2015-04-28 18:50       ` Alexander Monakov
2015-04-28 18:58         ` Rich Felker
2015-04-28 19:23           ` Alexander Monakov
2015-04-29  3:22             ` Rich Felker

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=1430201554-11359-1-git-send-email-armccurdy@gmail.com \
    --to=armccurdy@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).