9832fd
This is a downstream only patch for RHEL 7.
9832fd
9832fd
See bug 1790475 for the history behind --disable-bind-now for ppc64.
9832fd
In summary: COPY relocations and BIND_NOW are incompatible on ppc64.
9832fd
The solution is to globally disable BIND_NOW hardening on ppc64 with
9832fd
--disable-bind-now and then use a downstream-only patch to partially
9832fd
enable BIND_NOW hardening for ppc64 to the level of hardening that
9832fd
works given the toolchain.
9832fd
9832fd
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
9832fd
index b11edd77bd2c22d4..47a9e7bcf66a8531 100644
9832fd
--- a/sysdeps/powerpc/Makefile
9832fd
+++ b/sysdeps/powerpc/Makefile
9832fd
@@ -1,3 +1,29 @@
9832fd
+################################################################################
9832fd
+# Only enabled if we are not building for ppc64le.
9832fd
+ifeq (,$(filter %le,$(config-machine)))
9832fd
+# Enable bind-now behaviour by default for POWER. This is a downstream specific
9832fd
+# change that is required due to a toolchain limitation in handling COPY
9832fd
+# relocations and BIND_NOW (see rhbz#1790475).
9832fd
+LDCFLAGS-c.so += -Wl,-z,now
9832fd
+# Likewise. Take care that this is carefully selected to turn BIND_NOW back on
9832fd
+# for ld.so without turning it back on for libpthread.so which has the
9832fd
+# problematic OPD that generates a COPY relocation. Enable these only for the
9832fd
+# elf subdir which is also used to build libc.so.6. This avoids enabling
9832fd
+# BIND_NOW for libpthread.
9832fd
+ifeq ($(subdir),elf)
9832fd
+z-now-no = -Wl,-z,now
9832fd
+LDFLAGS-lib.so += -Wl,-z,now
9832fd
+link-extra-flags += -Wl,-z,now
9832fd
+endif
9832fd
+# Likewise. Take care that this is carefully selected to turn BIND_NOW
9832fd
+# back on for iconv modules to ensure the data-only DSOs have consistently the
9832fd
+# correct expected flags for DSOs (even if they don't really need them).
9832fd
+ifeq ($(subdir),iconvdata)
9832fd
+LDFLAGS.so += -Wl,-z,now
9832fd
+endif
9832fd
+endif
9832fd
+################################################################################
9832fd
+
9832fd
 ifeq ($(subdir),string)
9832fd
 CFLAGS-memcmp.c += -Wno-uninitialized
9832fd
 endif