This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Link-time call sizing and section stretching
- To: binutils at sourceware dot cygnus dot com
- Subject: Re: Link-time call sizing and section stretching
- From: msokolov at meson dot jpsystems dot com (Michael Sokolov)
- Date: Thu, 6 Jan 00 20:30:10 -0600
- Cc: john_w_marshall at palm dot com, stacy at quaker dot Uznet dot NET
Ian Lance Taylor <ian@zembu.com> wrote:
> The main advantage of ELF over COFF in an embedded system is that ELF
> permits the section alignment to set on a section by section basis.
OK, this one doesn't really matter for my platform, 4-byte alignment everywhere
is fine. In fact, it's actually a non-issue, as my ld link script puts every
section at 0. Why? As I've said, each section ends up on the embedded device at
an unpredictable address independently of other sections, making it an exercise
in futility for the linker to picture your program as having first this
section, then that section, etc. This means that the starting address the
linker thinks each section has is meaningless. On the other hand, making it 0
makes it easy to get the relative offset of a symbol from the start of its
section, which is what's really needed usually, by simply emitting an
"absolute" reference.
> This general class of problem is what the GNU linker calls relaxation.
> Relaxation is implemented for a number of targets: SH, H8/300,
> MIPS/ECOFF with -membedded-pic come to mind.
>
> The solutions more or less follow the lines you sketched out: keep all
> the relocations in assembler output, and then hack over them in the
> linker.
>
> The most interesting one to you might be the MIPS -membedded-pic work,
> since it has some similar characteristics. The MIPS only has a 18 bit
> relative branch. A call to a procedure which is more than 18 bits
> away is changed to a 5 instruction sequence. The linker relaxation
> code is in bfd/coff-mips.c.
Thanks for the pointers, with these I might actually be able to do something!
(The offer of a few days' pay for a good hacker still stands, though. We are in
Dallas, TX, USA, and we develop cool mobile communication software for handheld
devices, primarily PalmOS ones, which is the embedded platform I'm talking
about.)
--
Michael Sokolov 2695 VILLA CREEK DR STE 240
Software Engineer DALLAS TX 75234-7329 USA
JP Systems, Inc. Phone: +1-972-484-5432 x247
or +1-888-665-2460 x247
E-mail: msokolov@meson.jpsystems.com Fax: +1-972-484-4154