This is the mail archive of the binutils@sources.redhat.com 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]

Re: Writing addend into instructions


Andrew Haley <aph@redhat.com> writes:

  Torbjorn Granlund writes:
   > Some assembler backends write addends into relocation fields, in
   > addition to into the relocation record itself.  An example is
   > tc-ppc.c.
   > 
   > For some object file formats, that is actually desirable.  IBM's XCOFF
   > format is one example.
   > 
   > But for ELF, writing the addends into, say, a 16-bit instruction field
   > seems like a strange thing to do.
  
  I have seen uses for it, such as the ability to add multiple offsets
  into a field.
  
Hmm.  A toolchain that bases a relocation on such a value surely will
not work.  Consider a typical RISC sethi/oris/ldah type instruction.
If you put an addend that is smaller than a full address into its
(say) 16-bit field, and then let that take part of a relocation, you
lose carry.

   > Does anybody see any problems with such a change?
  
  Does it fix any bugs?
  
Well, it fixes 25 FIXME comments.

But it is also part of elf64-ppc changes we are just about to submit.
With the changes needed for that, md_apply_fix3 got even more horrible
than it was before.  That's what made us rewrite it.

(And yes, it also fixes some minor bugs, but those could be fixed
without rewriting md_apply_fix3.)

-- 
Torbjörn


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