Reloc changes to bfd/elf32-mips.c

Ian Lance Taylor
Wed Oct 6 19:35:00 GMT 1999

   Date: Thu, 7 Oct 1999 11:51:21 +1000
   From: Geoff Keating <>

   Perhaps you could explain what you think the code should be doing?
   This is often much more helpful than simply saying `I think this is
   wrong', since the usual response is `well, I think it is right'.

Sorry, I thought I had explained it.

I think that the 32 bit MIPS ELF code should compute a 64 bit reloc by
computing a 32 bit reloc in the least significant 32 bits.  The most
significant bit of the result of that computation should then be sign
extended into the most significant 32 bits.

This behaviour is independent of whether BFD64 is defined or not.
BFD64 is a host macro, and I am concerned with target behaviour.

   My test case for this is the following:

   configure --target=mipstx39-unknown-elf
   cat > test.s <<EOF
      .dword l1+16
   gas/as-new test.s -o test.o
   ld/ld-new -Ttext 0x12345678 test.o -o test.out
   binutils/objdump -j .text -s test.out

   and without my patch I see

   Contents of section .text:
    12345678 00000000 12345678                    .....4Vx        

   when I expect to see

   Contents of section .text:
    12345678 00000000 12345688                    .....4V.        

I agree that the code should produce what you expect to see.  I don't
know whether this build used BFD64 or not.

Your patch changed several different things at once.  I don't know
which are necessary to make this result.  Most of your patch looked
fine.  The odd parts were the two hunks which added #ifndef BFD64 and
#endif, and the last hunk which didn't set howto.  I don't understand
all of this code.  But especially adding the #ifndef/#endif seems

As I've tried to say before, if the three hunks I mentioned don't
change what happens, then they are fine.  If they do change what
happens, then I would like to understand how they change it.  Can you
explain that?


More information about the Binutils mailing list