[arm-gnu] GCC linker section ordering
David Brown
david at westcontrol.com
Tue Feb 5 09:20:46 UTC 2013
On 04/02/13 17:02, Murphy, Gerald wrote:
> Hi,
>
>
>
> I have a question regarding ‘Sourcery CodeBench Lite for ARM EABI’.
>
>
>
> Is it possible to control the order in which input sections with the
> same name are merged in the output image?
>
You can do that by using your own linker script. I don't have a copy of
the tools on hand at the moment, so this is just general knowledge of
gcc and the binutils linker. A typical linker script will join the
named section from all input files without a particular ordering. But
you can specify the files in an explicit order, and (I think) choose to
alphabetise the remaining files.
However, it is often preferable to give the different sections different
names, such as a numerical suffix to specify the ordering. This lets
you keep a simpler linker script - it's the same technique used by gcc
to control initialisation ordering.
More information about the arm-gnu
mailing list