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