[patch ld PE-COFF]: Use bfd target's underscoring default and add option --(no-)leading-underscore for ld

Kai Tietz ktietz70@googlemail.com
Thu Apr 1 08:57:00 GMT 2010


PING.

Ok for apply?

Cheers,
Kai

2010/3/24 Kai Tietz <Kai.Tietz@onevision.com>:
> Dave Korn <dave.korn.cygwin@googlemail.com> wrote on 23.03.2010 20:40:08:
>
>> On 23/03/2010 18:52, Kai Tietz wrote:
>>
>> > Well, I agree that those patterns are repeating. The reason why I
>> > avoid to make helper-macros here was to show logic explicit and the
>> > arguments are varying a bit, so that in fact at least two macros are
>> > necessary.
>> > But I can rework it to use a macro version for it, if you prefer.
>>
>>   I think macro definitions show the logic well enough in generalised
> form
>> that there's no real gain from writing it out longhand, plus they
> provide a
>> handy central point to comment them and explain what they're doing, so
> yes
>> please.
>>
>> >> at all.  Semantically, it amounts more to a "this one is the one
>> that gets the
>> >> special handling for ImageBase" flag than anything else, I think.
>> >
>> > Well, this issue isn't nice looking but IMHO necessary. The point here
>> > is that __ImageBase is the name of the symbol-name used in C. So an
>> > additional underscore is necessary for targets prefixing C-symbols.
>>
>>   Maybe it would be best renamed as "is_c_symbol" then, with a comment
> saying
>> "0 => assembler-level (i.e. unprefixed) symbol, 1 => C visible (i.e.
>> prefixed)" or words to that effect?
>>
>> >>  (While you're thinking about that, I'll give it a bit of testing on
> cegcc
>> >> and pals.)
>> >
>> > Hope it doesn't show side-effects there. I assume none, but well ...
>>
>>   If anything crops up, I'll fix it.  They aren't mainstream targets
> yet, but
>> I like to keep things clean in anticipation that they'll want to merge
>> upstream someday.
>>
>>     cheers,
>>       DaveK
>>
>
> So here is the modified version (I additional found another <space><tab>
> issue in printf of option tsaware and fixed it).
>
> ld/
>
> 2010-03-24  Kai Tietz  <kai.tietz@onevision.com>
>
>        * emultempl/pep.em (U): Macro modified.
>        (U_SIZE): New helper macro.
>        (GET_INIT_SYMBOL_NAME): Likewise.
>        (enum options): Add OPTION_NO_LEADING_UNDERSCORE
>        and OPTION_LEADING_UNDERSCORE enumerator-values.
>        (gld${EMULATION_NAME}_add_options): Add --(no-)leading-underscore
>        option.
>        (definfo): Add new member is_c_symbol.
>        (D): Add to macro underscore mode parameter.
>        (init): Add definition for is_c_symbol.
>        (gld_${EMULATION_NAME}_list_options): Display new options.
>        (set_pep_name): Adjust underscoring dependent fixed
>        symbol handling.
>        (gld_${EMULATION_NAME}_set_symbols): Likewise.
>        (saw_option): Likewise.
>        (gld_${EMULATION_NAME}_unrecognized_file): Likewise.
>        (set_entry_point): Initial initial_symbol_char dependent to
>        target's default and new option flag pep_leading_underscore.
>        * emultempl/pe.em (U): Macro modified.
>        (U_SIZE): New helper macro.
>        (GET_INIT_SYMBOL_NAME): Likewise.
>        (OPTION_LEADING_UNDERSCORE): Add new option define.
>        (OPTION_NO_LEADING_UNDERSCORE): Likewise.
>        (gld${EMULATION_NAME}_add_options): Add --(no-)leading-underscore
>        option.
>        (definfo): Add new member is_c_symbol.
>        (D): Add to macro underscore mode parameter.
>        (init): Add definition for is_c_symbol.
>        (gld_${EMULATION_NAME}_list_options): Display new options.
>        (set_pep_name): Adjust underscoring dependent fixed
>        symbol handling.
>        (gld_${EMULATION_NAME}_set_symbols): Likewise.
>        (saw_option): Likewise.
>        (gld_${EMULATION_NAME}_unrecognized_file): Likewise.
>        (set_entry_point): Initial initial_symbol_char dependent to
>        target's default and new option flag pep_leading_underscore.
>        * pe-dll.c (pe_leading_underscore): New flag variable.
>        (pe_detail_list): Remove const to allow modify of
>        member underscore.
>        (pe_dll_id_target): Initialize pe_details' underscore variable
>        dependent to target's default and flag pe_leading_underscore.
>        * pe-dll.h (pe_leading_underscore): Add extern declaration of
>        option flag.
>        * pep-dll.c (pe_leading_underscore): Add alias define for
>        pep_leading_underscore.
>        * pep-dll.h (pep_leading_underscore) Add extern declaration of
>        option flag.
>        * ld.texinfo: Add documentation for --(no-)leading-underscore
> option.
>
> ld/testsuite/
>
> 2010-03-24  Kai Tietz  <kai.tietz@onevision.com>
>
>        * ld-pe/orphan_nu.d: New test for --no-leading-underscore.
>        * ld-pe/orphana_nu.s: New file.
>        * ld-pe/pe.exp: Add orphan_nu test.
>
> Tested for x86_64-pc-mingw32, i686-pc-mingw32, and i686-pc-cygwin. How are
> tests for ARM doing?
>
> Cheers,
> Kai
>
>
> |  (\_/)  This is Bunny. Copy and paste Bunny
> | (='.'=) into your signature to help him gain
> | (")_(") world domination.
>



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



More information about the Binutils mailing list