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/20 Dave Korn <dave.korn.cygwin@gmail.com>:
>> On 20/12/2010 19:46, Kai Tietz wrote:
>>
>>> Well, the issue here is that, if a .tls section is present, it needs
>>> to be put into directory entry.
>>
>> ?As I read the spec, the directory entry should point only and exactly to the
>> actual MS-defined TLS struct pointed to by the __tls_used symbol. ?That was
>> why I asked about whether it's always the case that we can assume a .tls
>> section is exactly that and nothing else.
>>
>>> Why this isn't happening anymore, I am a bit puzzled too.
>>
>> ?I think we should investigate this first. ?Got a testcase?
>>
>> ? ?cheers,
>> ? ? ?DaveK
>>
>
> I found the issue. 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'.
>
> Kai
> --
> |? (\_/) This is Bunny. Copy and paste
> | (='.'=) Bunny into your signature to help
> | (")_(") him gain world domination
>

This patch should fix this underscoring issue (should affect wince arm too).

ChangeLog

2010-12-21  Kai Tietz

        * 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?

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]