This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: .init .text .fini
- From: Ian Lance Taylor <ian at airs dot com>
- To: Shaun Jackman <sjackman at gmail dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 05 May 2005 00:52:00 -0400
- Subject: Re: .init .text .fini
- References: <7f45d9390505042133324516f0@mail.gmail.com>
Shaun Jackman <sjackman@gmail.com> writes:
> Why do the symbols _init and _fini sit in their own segments .init and
> .fini rather than in .text?
I can't think of any critical reason, but it is traditional, and it
makes it easy to look at the init and fini code.
> I'm trying to generate a binary suitable
> for a flash image in an embedded system where the start symbol is at
> the first address, but with the default linker script -- armelf.xc in
> my case -- _init from .init is being placed before _mainCRTStartup
> from .text.
>
> Could the default order in ld/scripttempl/elf.sc be changed to .text
> .init .fini rather than the current .init .text .fini, or would this
> break something? Even better, could _init and _fini be placed in
> .text?
People developing for embedded systems must normally write their own
linker script anyhow, so this is not a very convincing reason to
change the default script.
Ian