[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |10.0 Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #14 from Andrew Pinski --- -fno-common became the default with GCC 10 so closing as fixed.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #13 from Wilco --- (In reply to Wilco from comment #12) > (In reply to Andrew Pinski from comment #10) > > > This should be a global change and not just an aarch64 change. The reason > > is because then aarch64 is the odd man out when it comes to this. > > Agreed, see https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01549.html. It > would be great to sort that out so C and C++ finally address globals > identically. Patch: https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01847.html
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #12 from Wilco --- (In reply to Andrew Pinski from comment #10) > This should be a global change and not just an aarch64 change. The reason > is because then aarch64 is the odd man out when it comes to this. Agreed, see https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01549.html. It would be great to sort that out so C and C++ finally address globals identically.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #11 from Kamlesh Kumar --- is this good? diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 0fffe60..9fead56 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -814,6 +814,10 @@ c_common_post_options (const char **pfilename) && flag_unsafe_math_optimizations == 0) flag_fp_contract_mode = FP_CONTRACT_OFF; + /* defaults to flag_no_common unless disabled with fcommon. */ + if (!global_options_set.x_flag_no_common) + flag_no_common = 1; + /* If we are compiling C, and we are outside of a standards mode, we can permit the new values from ISO/IEC TS 18661-3 for FLT_EVAL_METHOD. Otherwise, we must restrict the possible values to
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #10 from Andrew Pinski --- (In reply to Kamlesh Kumar from comment #9) > This fixes it. > > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index 2e73f3515bb..6fb87d5f49f 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -12539,6 +12539,10 @@ aarch64_override_options_internal (struct > gcc_options *opts) >if (opts->x_flag_strict_volatile_bitfields < 0 && abi_version_at_least > (2)) > opts->x_flag_strict_volatile_bitfields = 1; > > + /* defaults to flag_no_common unless disabled with fcommon. */ > + if (!global_options_set.x_flag_no_common) > + flag_no_common = 1; > + >if (aarch64_stack_protector_guard == SSP_GLOBAL >&& opts->x_aarch64_stack_protector_guard_offset_str) > { This should be a global change and not just an aarch64 change. The reason is because then aarch64 is the odd man out when it comes to this.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #9 from Kamlesh Kumar --- This fixes it. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 2e73f3515bb..6fb87d5f49f 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -12539,6 +12539,10 @@ aarch64_override_options_internal (struct gcc_options *opts) if (opts->x_flag_strict_volatile_bitfields < 0 && abi_version_at_least (2)) opts->x_flag_strict_volatile_bitfields = 1; + /* defaults to flag_no_common unless disabled with fcommon. */ + if (!global_options_set.x_flag_no_common) + flag_no_common = 1; + if (aarch64_stack_protector_guard == SSP_GLOBAL && opts->x_aarch64_stack_protector_guard_offset_str) {
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Wilco changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2019-09-17 Ever confirmed|0 |1 --- Comment #8 from Wilco --- Confirmed btw - the difference is due to HAVE_LD_PIE_COPYRELOC in i386.c: /* For i386, common symbol is local only for non-PIE binaries. For x86-64, common symbol is local only for non-PIE binaries or linker supports copy reloc in PIE binaries. */ static bool ix86_binds_local_p (const_tree exp) { return default_binds_local_p_3 (exp, flag_shlib != 0, true, true, (!flag_pic || (TARGET_64BIT && HAVE_LD_PIE_COPYRELOC != 0))); }
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Wilco changed: What|Removed |Added CC||wilco at gcc dot gnu.org --- Comment #7 from Wilco --- (In reply to Eric Gallager from comment #6) > (In reply to Wilco from comment #4) > > (In reply to martin krastev from comment #3) > > > So it appears to be a clash between -fcommon and -fvisibility=hidden > > > during > > > -fpic -- passing either -fno-common or -fno-pic drops the GOT indirection. > > > And explicitly hiding the symbol obviously solves it. But the crux of the > > > issue, IMO, is a multi-platform one -- that behavior deviates on gcc-8.2 > > > from platform to platform. On amd64 it suffices to -fvisibility=hidden to > > > stop GOT detours, whereas on aarch64 it's -fvisibility=hidden -fno-common. > > > As a result aarch64 performance gets penalized in unsuspecting > > > multi-plats. > > > > -fno-common should really become the default, -fcommon causes way too many > > issues. > > That's bug 85678 Yes, we need to push on that one again since not much happened...
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Eric Gallager changed: What|Removed |Added Keywords||visibility CC||egallager at gcc dot gnu.org See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=85678 --- Comment #6 from Eric Gallager --- (In reply to Wilco from comment #4) > (In reply to martin krastev from comment #3) > > So it appears to be a clash between -fcommon and -fvisibility=hidden during > > -fpic -- passing either -fno-common or -fno-pic drops the GOT indirection. > > And explicitly hiding the symbol obviously solves it. But the crux of the > > issue, IMO, is a multi-platform one -- that behavior deviates on gcc-8.2 > > from platform to platform. On amd64 it suffices to -fvisibility=hidden to > > stop GOT detours, whereas on aarch64 it's -fvisibility=hidden -fno-common. > > As a result aarch64 performance gets penalized in unsuspecting multi-plats. > > -fno-common should really become the default, -fcommon causes way too many > issues. That's bug 85678
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #5 from martin krastev --- For reference, here what -fvisibility=hidden -fpic -fcommon produces on amd64 (https://godbolt.org/z/0aIyhl): foo: movl$0, room(%rip) leaqroom(%rip), %rax ret Notice the absence of GOT indirection.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Wilco changed: What|Removed |Added CC||wdijkstr at arm dot com --- Comment #4 from Wilco --- (In reply to martin krastev from comment #3) > So it appears to be a clash between -fcommon and -fvisibility=hidden during > -fpic -- passing either -fno-common or -fno-pic drops the GOT indirection. > And explicitly hiding the symbol obviously solves it. But the crux of the > issue, IMO, is a multi-platform one -- that behavior deviates on gcc-8.2 > from platform to platform. On amd64 it suffices to -fvisibility=hidden to > stop GOT detours, whereas on aarch64 it's -fvisibility=hidden -fno-common. > As a result aarch64 performance gets penalized in unsuspecting multi-plats. -fno-common should really become the default, -fcommon causes way too many issues.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #3 from martin krastev --- So it appears to be a clash between -fcommon and -fvisibility=hidden during -fpic -- passing either -fno-common or -fno-pic drops the GOT indirection. And explicitly hiding the symbol obviously solves it. But the crux of the issue, IMO, is a multi-platform one -- that behavior deviates on gcc-8.2 from platform to platform. On amd64 it suffices to -fvisibility=hidden to stop GOT detours, whereas on aarch64 it's -fvisibility=hidden -fno-common. As a result aarch64 performance gets penalized in unsuspecting multi-plats.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Andrew Pinski changed: What|Removed |Added Keywords||missed-optimization Target||aarch64-linux-gnu --- Comment #2 from Andrew Pinski --- room is a common symbol which causes issues.
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #1 from Andrew Pinski --- Try -fno-common.