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