Writing addend into instructions

Torbjorn Granlund tege@swox.com
Wed Mar 14 05:52:00 GMT 2001


Alan Modra <alan@linuxcare.com.au> writes:

  On 13 Mar 2001, Torbjorn Granlund wrote:
  
  > But for ELF, writing the addends into, say, a 16-bit instruction field
  > seems like a strange thing to do.  Most ELF ABIs require that such
  > addends are ignored anyway.
  
  One (rather poor) reason why you might want to write the addend into
  the insn is to make disassembly of object files "look right".  It would be
  better to teach the disassembler how to apply the relocation.
  
Such as with for example:

        .section ".text"
        lis      3,foo+0xf000baba@h
        lwz      3,foo+0xf000baba@l(3)

This then yields this disassembly output:

   0:   3c 60 0f 00     lis     r3,-4096
                        2: R_PPC64_ADDR16_HI    foo+0xf00baba
   4:   80 63 ba ba     lwz     r3,-17734(r3)
                        6: R_PPC64_ADDR16_LO    foo+0xf00baba

That really "looks right"...  :-)

-- 
Torbjörn



More information about the Binutils mailing list