This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 i386 windows]: Fix weak-symbol support for 64-bit windows target


2010/11/4 Kai Tietz <Kai.Tietz@onevision.com>:
> gcc-patches-owner@gcc.gnu.org wrote on 04.11.2010 17:25:29:
>
>> On 11/04/2010 07:29 AM, Kai Tietz wrote:
>> > Hello,
>> >
>> > This patch fixes the handling of weak symbols for 64-bit windows
>> > pe-coff target and providing same feature as for 32-bit pe-coff
>> > windows targets. As this target has set
>> > the pic-flag, but pe-coff doesn't support GOT table, some trickery was
>> > necessary to avoid the emitting
>> > of GOT table dereferencing for this target.
>>
>> I think you'd better explain how weak symbols work for x64-pe.
>>
>> At minimum abusing the name GOTPCREL and failing to de-reference
>> suggests that you should be abusing a different name that's more
>> suggestive of the actual operation.
>>
>>
>> r~
>>
>
> Weak symbols for pe-coff targets are just present withing one image. The
> linker handles here the symbol replacement. In fact a weak symbol is for
> pe-coff more like an alias, but one which can be replaced by a non-weak
> symbol. As pe-coff isn't able to provide weaks over image base (an pe-coff
> image is always finally linked and neither function override, nor
> undefined symbols can be present), there is no need of a GOT table.
>
> Is this description exact enough?
>
> Regards,
> ?i.A. Kai Tietz
>
> | ?(\_/) ?This is Bunny. Copy and paste Bunny
> | (='.'=) into your signature to help him gain
> | (")_(") world domination.
>
>

Here is the updated patch for x64 weak symbols (for static libraries).
Prior patch misused the UNSPEC_GOTPCREL for expressing a pc-relative
only. I added for this to i386.md the new UNSPEC_PCREL and added
necessary checks to i386.c for handling new pic_address more correct.

Tested for x86_64-w64-mingw32. Ok for apply?

Regards,
Kai

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

Attachment: weak_x64.diff
Description: Binary data


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