Blame SOURCES/glibc-rh911307.patch

b40826
#
b40826
# Red Hat BZ:
b40826
# https://bugzilla.redhat.com/show_bug.cgi?id=911307
b40826
#
b40826
# Sourceware BZ: None.
b40826
#
b40826
# Upstreamm submission: Not yet completed.
b40826
#
b40826
# ChangeLog
b40826
#
b40826
# 2013-02-27  Carlos O'Donell  <carlos@redhat.com>
b40826
#
b40826
#	* elf/Makefile (CFLAGS-.o): Add -fno-tree-loop-distribute-patterns.
b40826
#	(CFLAGS-.os): Likewise.
b40826
#	(CFLAGS-.op): Likewise.
b40826
#	(CFLAGS-.ob): Likewise.
b40826
#	(CFLAGS-.oS): Likewise.
b40826
#	* string/Makefile (CFLAGS-.o): Likewise.
b40826
#	(CFLAGS-.os): Likewise.
b40826
#	(CFLAGS-.op): Likewise.
b40826
#	(CFLAGS-.ob): Likewise.
b40826
#	(CFLAGS-.oS): Likewise.
b40826
#
b40826
diff -Nrup a/elf/Makefile b/elf/Makefile
b40826
--- a/elf/Makefile	2013-05-28 09:56:09.798610050 -0600
b40826
+++ b/elf/Makefile	2013-05-28 13:30:20.007930731 -0600
b40826
@@ -461,6 +461,16 @@ CFLAGS-cache.c = $(SYSCONF-FLAGS)
b40826
 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
b40826
 		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
b40826
 
b40826
+# Disable any optimization which might result in function calls during early
b40826
+# dynamic loader startup. We disable -ftree-loop-distribute-patterns which
b40826
+# might convert code into calls to functions like memcpy or memset when the PLT
b40826
+# is not yet setup.
b40826
+CFLAGS-.o += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.os += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.op += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.ob += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.oS += -fno-tree-loop-distribute-patterns
b40826
+
b40826
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
b40826
 generated += $(addsuffix .so,$(strip $(modules-names)))
b40826
 
b40826
diff -Nrup a/string/Makefile b/string/Makefile
b40826
--- a/string/Makefile	2013-05-28 09:56:09.534610913 -0600
b40826
+++ b/string/Makefile	2013-05-28 13:31:01.693053657 -0600
b40826
@@ -77,6 +77,14 @@ CFLAGS-test-ffs.c = -fno-builtin
b40826
 CFLAGS-tst-inlcall.c = -fno-builtin
b40826
 CFLAGS-bug-strstr1.c = -fno-builtin
b40826
 
b40826
+# Disable any optimization which might result in function calls to the very
b40826
+# same functions we are trying to compile, thus creating an infinite loop.
b40826
+CFLAGS-.o += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.os += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.op += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.ob += -fno-tree-loop-distribute-patterns
b40826
+CFLAGS-.oS += -fno-tree-loop-distribute-patterns
b40826
+
b40826
 ifeq ($(cross-compiling),no)
b40826
 tests: $(objpfx)tst-svc.out
b40826
 $(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc