mips gas is horribly broken

Ian Lance Taylor ian@zembu.com
Fri Jun 8 09:12:00 GMT 2001


"H . J . Lu" <hjl@lucon.org> writes:

> On Thu, Jun 07, 2001 at 09:52:37PM -0700, Ian Lance Taylor wrote:
> > 
> > If you are looking for a hack, perhaps you could add 1 to the addend
> > and subtract 1 from the contents of the object file?
> > 
> 
> How do I do it in such a way that I only have to do it for the mips
> assembler? Is 1 a valid mips addend? If 1 is not a valid mips addend,
> I can do
> 
> bfd_reloc_status_type
> _bfd_mips_elf_generic_reloc (...)
> {
>   if (output_bfd != (bfd *) NULL 
>       && (symbol->flags & BSF_SECTION_SYM) == 0
>       && (! reloc_entry->howto->partial_inplace
>           || reloc_entry->addend == 0))
>     {
>       reloc_entry->address += input_section->output_offset;
>       return bfd_reloc_ok;
>     }
> 
>   if (reloc_entry->addend == 1)
>     reloc_entry->addend = 0;
> 
>   return bfd_reloc_continue;
> }
> 
> If 1 is a valid mips addend, is there some value I can use?

I haven't looked at the code.  It's quite possible that any addend
value is legal.  I wasn't suggesting that you use
_bfd_mips_elf_generic_reloc.  I was suggesting that in the assembler
you change the addend and the object file so that the result comes out
right without ever having an addend of zero.  That is generally how
these sorts of problems are solved now: by adding hacks to gas.  Of
course, each hack makes it harder to implement the right solution.

Ian



More information about the Binutils mailing list