Blame SOURCES/glibc-rh911307.patch

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