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