Relocation question (was: RE: Unsupported targets slated for removal)

Alan Modra amodra@bigpond.net.au
Wed Apr 6 12:46:00 GMT 2005


On Wed, Apr 06, 2005 at 12:23:47PM +0200, Christian Groessler wrote:
> > ----- Alan Modra wrote -----
> > On Tue, Mar 22, 2005 at 06:08:30PM +0100, Christian Groessler wrote:
> > > >     z8k-*-*           Christian, please update z8k to use bfd!
> > >
> > > Is there a guide how to do this somewhere, or should I simply start
> > > defining BFD_ASSEMBLER and then fix what breaks...
> >
> > Yes, set bfd_gas=yes in configure.tgt, then fix what breaks.  Compare
> > target object files before and after..

Actually, I probably should have mentioned that the critical thing is
that after final linking you get the same result.

> While doing this I've encountered the following problem. Consider this
> source file:
> 
>                 .text
>                 .long   INITFN
> INITFN:         nop
> 
> 
> 
> If I compile it with the old assembler, I get the following relocation
> entry in the object file:
> 
> 
> /tmp/yyy.o:     file format coff-z8k
> 
> RELOCATION RECORDS FOR [.text]:
> OFFSET   TYPE              VALUE
> 00000000 r_imm32           INITFN
> 
> 
> If I compile it with my BFD_ASSEMBLER modified version, I get
> 
> 
> /tmp/zzz.o:     file format coff-z8k
> 
> RELOCATION RECORDS FOR [.text]:
> OFFSET   TYPE              VALUE
> 00000000 r_imm32           .text
> 
> 
> Please note the different VALUEs.

Either of these is likely OK.  In the second case, a reloc against a
local symbol INITFN is being reduced to a reloc against a section
symbol.  With larger assembly files this optimization can reduce the
size of the symbol table.  You can tweak which relocs may be reduced
with tc_fix_adjustable.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list