This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold linker: Access section start & end address w/o using a linker script
- From: Ian Lance Taylor <iant at google dot com>
- To: Kevin <ancafe at ymail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sat, 1 Feb 2014 20:59:53 -0800
- Subject: Re: gold linker: Access section start & end address w/o using a linker script
- Authentication-results: sourceware.org; auth=none
- References: <10A84606-654D-4FBC-A66D-40BA39916061 at gmail dot com> <CAKOQZ8ym43X48NJQbM81AiB+f-THT-we-Md0OJ1u-s-MnEpn6w at mail dot gmail dot com> <E0B8D401-6A5B-4149-9ED6-08968E4E0878 at gmail dot com> <CAKOQZ8xJHQcM4VA4ggWPB_XAL8-fJ7sARtnE2Wx=R3uK=xY=Pg at mail dot gmail dot com> <0263B7F5-194E-42D0-A8BB-608F0593ED61 at gmail dot com> <CAKOQZ8zrYL8t-3jjUz6NeZHBJNmypZswBNcg4o-V05LPk31RCg at mail dot gmail dot com> <loom dot 20140202T021423-830 at post dot gmane dot org>
On Sat, Feb 1, 2014 at 5:14 PM, Kevin <ancafe@ymail.com> wrote:
> Ian Lance Taylor <iant <at> google.com> writes:
>
>>
>> On Mon, Apr 22, 2013 at 4:39 AM, Raphael Zulliger
> <zulli73 <at> gmail.com> wrote:
>> >
>> > Is there a chance to enhance gold to better support such use cases?
> Or is that out-of focus for gold? I'm not
>> familiar with linking internals, but I think that providing additional
> start/end address symbols for> section names starting with a '.' wouldn't
> be that tricky to be added, right?
>>
>> I'm fine with it. Look for uses of is_cident in the gold source code.
>>
>> Ian
>>
>>
>
>
> Thanks for the tip Ian. In that routine one could easily ignore a
> leading ".". In abstract one might want to handle "." inside the
> name, or translate characters (such as "$") allowed in ELF symbols but
> not in C (or in some other language), whereby a simple concept starts
> to get out of hand; thus:
>
> - Could we assume that standard ELF section names can be mapped to C
> identifiers just by mapping the leading "."?
>
> - What mapping would you suggest? If the leading "." is dropped then
> the resulting would collide with a common name (text or data in
> particular). This problem seems unsolvable in general, so should one
> make an effort at all (mapping "." to a single underscore for
> example)?
The linker doesn't define symbols that are the section names: it adds
"__start_" and "__stop_" before them. I think it would be fine to
just turn a leading '.' into a '_' for this purpose.
Ian