This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFH] How to teach ld to choose in an intelligent fashion whichoutputsections to use for the ensemble of input sections.
- From: Nick Clifton <nickc at redhat dot com>
- To: Björn Haase <bjoern dot m dot haase at web dot de>
- Cc: binutils at sourceware dot org
- Date: Thu, 20 Oct 2005 11:38:37 +0100
- Subject: Re: [RFH] How to teach ld to choose in an intelligent fashion whichoutputsections to use for the ensemble of input sections.
- References: <200510192333.11290.bjoern.m.haase@web.de>
Hi Björn,
You mentioned the keyword: "optimal placement": I have seen that, when doing
linker relaxation for avr one could possibly do better if the linker would
try to arrange the sequence of the differend object sections (quite a lot of
them when using -ffunction-sections) so that as many as possible jumps/calls
end up as short pc-relative insn.
The present situation is not this bad, but I am convinced that one could do
better. This might be good for up to 1% code size.
Are there targets for which the linker does this kind of shuffling
optimization in the source tree?
In the *source* tree ? No, none that I know of. Nor are there any
targets for which the linker tries to reorganise the order of the input
sections in order to allow for more relaxation opportunities. (Sorry).
Probably the best way to achieve this kind of optimisation however is
not to use the linker, but to use the compiler. For example GCC's
-funit-at-a-time and -fwhole-program optimisations ought to be able to
reorder the code to improve the locality of branches and hence provide
better opportunities for relaxation.
Cheers
Nick