This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Avoid privatization of TLS variables
- From: Cary Coutant <ccoutant at google dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Ian Lance Taylor <iant at google dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Markus Trippelsdorf <markus at trippelsdorf dot de>, Ian Lance Taylor <ian at airs dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 25 Sep 2014 19:09:34 -0700
- Subject: Re: Avoid privatization of TLS variables
- Authentication-results: sourceware.org; auth=none
- References: <20140920031617 dot GB2325 at kam dot mff dot cuni dot cz> <20140924175326 dot GE29454 at x4> <20140924181836 dot GE6871 at kam dot mff dot cuni dot cz> <CAKOQZ8xMx8bpXGTXN8pd2RC2T9i31brdQTH13ZWiYdooTVq_aw at mail dot gmail dot com> <20140925015835 dot GC26922 at atrey dot karlin dot mff dot cuni dot cz> <CAKOQZ8zwpGfLE02C55iLnDX6rNYAH89nkGFXay2zSTmPidef4w at mail dot gmail dot com> <CAMe9rOqez8GmTu0ZGfyfORJq=fGY8j9J79Ar=LEied=34cgqxw at mail dot gmail dot com> <CAKOQZ8yMkZeaRnmH4Y+coGOFUeK0p5cSuQvsCPDCTn+DHeqw+w at mail dot gmail dot com> <20140925162957 dot GD9303 at kam dot mff dot cuni dot cz>
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.
-cary
On Thu, Sep 25, 2014 at 9:29 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On Thu, Sep 25, 2014 at 8:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > On Thu, Sep 25, 2014 at 8:24 AM, Ian Lance Taylor <iant@google.com> wrote:
>> >> On Wed, Sep 24, 2014 at 6:58 PM, Jan Hubicka <hubicka@ucw.cz> 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