This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFH] How to teach ld to choose in an intelligent fashion whichoutputsections to use for the ensemble of input sections.


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]