Hi! This patch undoes the PR65780 performance regressions on a few targets I have tested to work fine. This PR was about an access to uninitialized COMMON symbol defined in executable (or PIE) where there is a normal symbol definition in a shared library. The PR65780 fix that got committed stopped treating such COMMONs as binding local on all architectures, except for i?86 (for normal execs only) and x86_64 (for normal execs and PIEs, but the latter only with recent linker). As s390/arm/aarch64 seems to work fine (generate a COPY relocation and thus define symbol locally) in non-PIE executables, this patch changes those to a function that has been added for that behavior. E.g. powerpc64{,le} on the other side isn't able to link that case neither in normal execs nor PIEs.
Bootstrapped/regtested on {x86_64,i686,armv7hl,aarch64,s390{,x},powerpc64{,le}}-linux, ok for trunk (and perhaps after a while for 5.2)? 2015-04-23 Jakub Jelinek <ja...@redhat.com> PR target/65780 * config/s390/linux.h (TARGET_BINDS_LOCAL_P): Define to default_binds_local_p_2. * config/arm/linux-elf.h (TARGET_BINDS_LOCAL_P): Likewise. * config/aarch64/aarch64-linux.h (TARGET_BINDS_LOCAL_P): Likewise. --- gcc/config/s390/linux.h.jj 2015-01-05 13:07:16.000000000 +0100 +++ gcc/config/s390/linux.h 2015-04-22 17:39:38.880273650 +0200 @@ -90,4 +90,10 @@ along with GCC; see the file COPYING3. #undef TARGET_LIBC_HAS_FUNCTION #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function +/* Uninitialized common symbols in non-PIE executables, even with + strong definitions in dependent shared libraries, will resolve + to COPY relocated symbol in the executable. See PR65780. */ +#undef TARGET_BINDS_LOCAL_P +#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 + #endif --- gcc/config/arm/linux-elf.h.jj 2015-01-05 13:07:16.000000000 +0100 +++ gcc/config/arm/linux-elf.h 2015-04-22 17:42:35.979420149 +0200 @@ -118,3 +118,9 @@ /* Add .note.GNU-stack. */ #undef NEED_INDICATE_EXEC_STACK #define NEED_INDICATE_EXEC_STACK 1 + +/* Uninitialized common symbols in non-PIE executables, even with + strong definitions in dependent shared libraries, will resolve + to COPY relocated symbol in the executable. See PR65780. */ +#undef TARGET_BINDS_LOCAL_P +#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 --- gcc/config/aarch64/aarch64-linux.h.jj 2015-01-05 13:07:17.000000000 +0100 +++ gcc/config/aarch64/aarch64-linux.h 2015-04-22 17:40:46.395185820 +0200 @@ -69,4 +69,10 @@ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +/* Uninitialized common symbols in non-PIE executables, even with + strong definitions in dependent shared libraries, will resolve + to COPY relocated symbol in the executable. See PR65780. */ +#undef TARGET_BINDS_LOCAL_P +#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 + #endif /* GCC_AARCH64_LINUX_H */ Jakub