relaxation question

Alan Modra amodra@bigpond.net.au
Wed Aug 11 11:30:00 GMT 2004


On Wed, Aug 11, 2004 at 02:37:59PM +0400, Dmitry Dikiy wrote:
> But, if the value of 'label' isn't known (it is defined in another file),
> how can I do relaxation in this case? Will linker do it? If yes, then
> XXX_elf_relax_section() will be called for every relaxation or for all
> section?

Yes, in that case the assembler can't do relaxation, and you need to
implement relaxation in the linker.  bfd_relax_section is called for
each input section in turn, not for each relocation, then if any of the
calls resulted in "again" being set, the whole process is repeated.

> Where I have to change an opcode if the instruction does not fit one word?
> In md_convert_frag() ?

Yes, that's the correct place for assembler relaxation.  See tc-i386.c

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list