[Bug target/65780] [5/6 Regression] Uninitialized common handling in executables

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 16 12:12:00 GMT 2015


--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I've repeated my test on the various architectures, this time with additional
readelf -Ws test | grep optopt
if the link succeeds.  And indeed, x86_64 with recent linker is the only one
where optopt is defined, rather than SHN_UNDEF in the PIE.  armv7hl, s390,
s390x, i686 and x86_64 with old linker all have optopt defined in the binary
for normal executable (!flag_pic) and SHN_UNDEF for PIE.

Thus, based on this I'd say that i386 backend should pass
!flag_pic || (TARGET_64BIT && HAVE_LD_PIE_COPYRELOC != 0)
to the new param (in ix86_binds_local_p).
Then, perhaps you should make default_binds_local_p_3 also non-static and
declared in output.h, ix86_binds_local_p should perhaps use it directly, and
default_binds_local_p_2 should have just a single argument, so that arm and
s390 backends (dunno, maybe aarch64 and a few others too) could use it directly
as their TARGET_BINDS_LOCAL_P definition.  default_binds_local_p_2 would then
default_binds_local_p_3 with
exp, flag_shlib != 0, true, false, !flag_pic
arguments.  And obviously all the two (default_binds_local_p{,2}) should have
better documentation on how they differ.

More information about the Gcc-bugs mailing list