mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] force LTO to be disabled when compiling dlstart.lo
@ 2015-04-28  6:12 Andre McCurdy
  2015-04-28  8:35 ` Alexander Monakov
  0 siblings, 1 reply; 10+ messages in thread
From: Andre McCurdy @ 2015-04-28  6:12 UTC (permalink / raw)
  To: musl; +Cc: Andre McCurdy

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-04-29  3:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28  6:12 [PATCH] force LTO to be disabled when compiling dlstart.lo Andre McCurdy
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

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).