Blame SOURCES/glibc-rh911307.patch

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