This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch bfd]: Fix generation of .tls directory entry


2010/12/21 Kai Tietz <ktietz70@googlemail.com>:
> 2010/12/21 Dave Korn <dave.korn.cygwin@gmail.com>:
>> On 21/12/2010 11:03, Kai Tietz wrote:
>>> 2010/12/21 Kai Tietz <ktietz70@googlemail.com>:
>>
>>>> I found the issue.
>>
>> ?Thanks for persisting.
>>
>>>> The cause for this is that bfd searches for
>>>> '__tls_used', which is the underscored version of '_tls_used'
>>>> variable. Caused by the fact that x64 windows doesn't prefix symbols
>>>> by underscore, the symbol wasn't found, as it remains '_tls_used'.
>>>>
>>>> So we have two chances here to solve this: a) Change for windows x64
>>>> the symbol to '__tls_used', or b) search in bfd for x64 windows for
>>>> '_tls_used' instead of '_tls_used'.
>>
>> ?We should do whatever MSVC does when targeting 64-bit windows, shouldn't we?
>>
>>> This patch should fix this underscoring issue (should affect wince arm too).
>>
>> ?This is clearly a much better solution! :)
>>
>>> ? ? ? ? * peXXigen.c (_bfd_XXi_final_link_postscript): Use
>>> ? ? ? ? TARGET_UNDERSCORE to determine "_tls_used" name.
>>> ? ? ? ? (TARGET_UNDERSCORE): Define to default zero, if not present.
>>>
>>> ? ? ? ? * ld-pe/pe.exp: Add TLS directory test.
>>> ? ? ? ? * ld-pe/tlssec.s: New.
>>> ? ? ? ? * ld-pe/tlssec64.d: New.
>>> ? ? ? ? * ld-pe/tlssec32.d: New.
>>>
>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>> for apply?
>>
>> ?OK with one change: please move the TARGET_UNDERSCORE default definition up
>> to the top of the file, underneath the header includes, where there are
>> already some other macro definitions getting adjusted. ?(I think it's cleaner
>> not to have supposedly global symbols suddenly entering scope half way through
>> a file...)
>>
>> ?Also, please do verify that the MS 64-bit compiler does the same thing. ?(It
>> seems very highly likely that it does, which is why I'm OK for the patch to go
>> in first and you to adjust it afterwards if necessary.)
>>
>> ? ?cheers,
>> ? ? ?DaveK
>>
>>
>
> Ok, I remove this TARGET_UNDERSCORE use at all. It would be always the
> default definition, which is for 32-bit wrong. Instead I replace in
> patch its use by bfd_get_symbol_leading_char(abfd). Updated patch
> comes soon, after testing.

So here is the new patch (tested for the same targets without
regression). I re-read documentation on msdn about _tls_used, and
there is no special-casing for x64, which means that they are doing in
their linker here the same magic - the _tls_used is a C-symbol.

Ok for apply?

Kai

-- 
|? (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Attachment: fixtls_noprefix.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]