Avoid privatization of TLS variables
Fri Sep 26 02:17:00 GMT 2014
> The plugin API doesn't have a way to mark a symbol as TLS, but it
> doesn't really matter since the linker simply overrides the
> placeholder from the claimed file with the symbol provided in the
> replacement. Unfortunately, I excluded common symbols from this logic
> in gold, so the symbol isn't getting marked as TLS COMMON even when we
> see the real ELF file. I just need to remind myself why the exclusion
> is there and figure out how to fix it. I think all the information we
> need is there, so no changes to the plugin API should be necessary.
Thank you! Now when I have your attention, perhaps we could discuss the original
motivation of the change that exposed this bug.
I was building libreoffice with profile feedback and I run into a message
cannot load any more object with static TLS
that took me a while to track as I did not see where static TLS is comming out.
Ian pointed out to me that static variables with TLS storage also consume
static TLS even if they are in dynamic model. This is why I disabled
localization. Is there better way to handle this?
Note that the variable __gcov_indirect_call_counters_ltopriv was added to work around
that seems to be fixed. I would like to drop the hack (that will also make
profiling to work with current golds again), but I think I would like to document
when the bug went away, becuase it is only bit over a year now.
Any idea when it was fixed?
> On Thu, Sep 25, 2014 at 9:29 AM, Jan Hubicka <email@example.com> wrote:
> >> On Thu, Sep 25, 2014 at 8:37 AM, H.J. Lu <firstname.lastname@example.org> wrote:
> >> > On Thu, Sep 25, 2014 at 8:24 AM, Ian Lance Taylor <email@example.com> wrote:
> >> >> On Wed, Sep 24, 2014 at 6:58 PM, Jan Hubicka <firstname.lastname@example.org> wrote:
> >> >>>
> >> >>> b: 00 00
> >> >>> 9: R_X86_64_TPOFF32 __gcov_indirect_call_counters_ltopriv
> >> >>
> >> >> Look at the .o file where __gcov_indirect_call_counters_ltopriv is
> >> >> defined. That .o file must have the symbol marked as STT_TLS and it
> >> >> must be defined in a section with the SHF_TLS flag. If that is not
> >> >> true, then that is your problem.
> >> >
> >> > SHF_TLS isn't required.
> >> >
> >> > 16: 0000000000000008 8 TLS GLOBAL HIDDEN COM
> >> > __gcov_indirect_call_counters_ltopriv
> >> > 17: 0000000000000008 8 TLS GLOBAL HIDDEN COM
> >> > __gcov_indirect_call_callee_ltopriv
> >> >
> >> > are also sufficient.
> >> I can create a .o file with a hidden common symbol, but I can't
> >> recreate the problem. When I try, gold creates a TLS section and TLS
> >> segment itself.
> >> How exactly is gold being invoked?
> > It seems to happen with LTO compilation only, just build mainline tree
> > and try the original testcase.
> > Honza
> >> Ian
More information about the Gcc-patches