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: Raphael Zulliger <zulli73 at gmail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Sun, 21 Apr 2013 10:42:40 -0700
- 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>
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