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: Raphael Zulliger <zulli73 at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Sun, 21 Apr 2013 21:27:14 +0200
- Subject: Re: gold linker: Access section start & end address w/o using a linker script
- References: <10A84606-654D-4FBC-A66D-40BA39916061 at gmail dot com> <CAKOQZ8ym43X48NJQbM81AiB+f-THT-we-Md0OJ1u-s-MnEpn6w at mail dot gmail dot com>
Thanks Ian!
__start_SECNAME / __stop_SECNAME: I've been googling for something like this almost for hours…
That certainly answers my question for "project specific" section names. But I cant see yet how it solve my question for pre-defined sections like .sbss, .sdata, etc.? Is there another trick I don't know yet? E.g. can I create section-aliasses or something like that? (again, a short google session didn't give useful results)
Raphael
On Apr 21, 2013, at 7:42 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Sun, Apr 21, 2013 at 9:04 AM, Raphael Zulliger <zulli73@gmail.com> wrote:
>>
>> After having read several things about gold in the net, my impression is that gold mainly supports linker scripts to be backward compatible to the bfd linker. But the "gold style of linking" is to avoid using linker scripts. Am I roughly right with this conclusion?
>
> Yes.
>
>> The problem that arises when no linker script should be used is that our RTOS (and probably embedded system in general) requires to know the start address and end address of certain sections, such as data, sbss, etc. We need to know these addresses in order to create copies of these section during startup to support 'soft reset OS' features.
>
> With both gold and GNU ld, if the name of the section is a valid C
> identifier (e.g., does not start with '.') then the symbols
> __start_SECNAME and __stop_SECNAME will be automatically defined by
> the linker and available for use by the program.
>
> Ian