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