Blob Blame History Raw
#
# Red Hat BZ:
# https://bugzilla.redhat.com/show_bug.cgi?id=911307
#
# Sourceware BZ: None.
#
# Upstreamm submission: Not yet completed.
#
# ChangeLog
#
# 2013-02-27  Carlos O'Donell  <carlos@redhat.com>
#
#	* elf/Makefile (CFLAGS-.o): Add -fno-tree-loop-distribute-patterns.
#	(CFLAGS-.os): Likewise.
#	(CFLAGS-.op): Likewise.
#	(CFLAGS-.ob): Likewise.
#	(CFLAGS-.oS): Likewise.
#	* string/Makefile (CFLAGS-.o): Likewise.
#	(CFLAGS-.os): Likewise.
#	(CFLAGS-.op): Likewise.
#	(CFLAGS-.ob): Likewise.
#	(CFLAGS-.oS): Likewise.
#
diff -urN glibc-2.17-c758a686/string/Makefile tmp/glibc-2.17-c758a686/string/Makefile
--- glibc-2.17-c758a686/string/Makefile	2013-02-27 18:07:34.618968703 -0500
+++ tmp/glibc-2.17-c758a686/string/Makefile	2013-02-27 18:08:16.075796160 -0500
@@ -72,6 +72,14 @@ CFLAGS-stratcliff.c = -fno-builtin
 CFLAGS-test-ffs.c = -fno-builtin
 CFLAGS-tst-inlcall.c = -fno-builtin
 
+# Disable any optimization which might result in function calls to the very
+# same functions we are trying to compile, thus creating an infinite loop.
+CFLAGS-.o += -fno-tree-loop-distribute-patterns
+CFLAGS-.os += -fno-tree-loop-distribute-patterns
+CFLAGS-.op += -fno-tree-loop-distribute-patterns
+CFLAGS-.ob += -fno-tree-loop-distribute-patterns
+CFLAGS-.oS += -fno-tree-loop-distribute-patterns
+
 ifeq ($(run-built-tests),yes)
 tests: $(objpfx)tst-svc-cmp.out
 $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
diff -urN glibc-2.17-c758a686/elf/Makefile tmp/glibc-2.17-c758a686/elf/Makefile
--- glibc-2.17-c758a686/elf/Makefile	2013-02-27 18:07:13.812055613 -0500
+++ tmp/glibc-2.17-c758a686/elf/Makefile	2013-02-27 18:08:16.075796160 -0500
@@ -432,6 +432,16 @@
 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
 		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
 
+# Disable any optimization which might result in function calls during early
+# dynamic loader startup. We disable -ftree-loop-distribute-patterns which
+# might convert code into calls to functions like memcpy or memset when the PLT
+# is not yet setup.
+CFLAGS-.o += -fno-tree-loop-distribute-patterns
+CFLAGS-.os += -fno-tree-loop-distribute-patterns
+CFLAGS-.op += -fno-tree-loop-distribute-patterns
+CFLAGS-.ob += -fno-tree-loop-distribute-patterns
+CFLAGS-.oS += -fno-tree-loop-distribute-patterns
+
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))