PATCH for 64-bit MIPS ELF buglets
Ian Lance Taylor
ian@zembu.com
Mon Jul 12 12:20:00 GMT 1999
From: Mark Mitchell <mark@codesourcery.com>
Date: Mon, 12 Jul 1999 12:12:19 -0700
The only controversy I can spot in this patch is this hunk:
@@ -678,22 +679,19 @@ static reloc_howto_type elf_mips_howto_t
0x000007c4, /* dst_mask */
false), /* pcrel_offset */
- /* A 64 bit relocation. This is used in 32 bit ELF when addresses
- are 64 bits long; the upper 32 bits are simply a sign extension.
- The fields of the howto should be the same as for R_MIPS_32,
- other than the type, name, and special_function. */
+ /* A 64 bit relocation. */
HOWTO (R_MIPS_64, /* type */
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mips32_64bit_reloc, /* special_function */
"R_MIPS_64", /* name */
true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
false), /* pcrel_offset */
/* Displacement in the global offset table. */
I don't understand the comment; R_MIPS_64 is clearly documented as a
64-bit relocation in the MIPS ABI. Period.
What is going on here is that some people use elf32-mips when
compiling ISA level III code. This works fine, provided you always
load the code at an address from 0 to 0x7fffffff or 0xffffffff80000000
to 0xffffffffffffffff. The R_MIPS_64 reloc in elf32-mips supports
this usage: it is a 64 bit relocation formed by sign extending a 32
bit address.
There used to be code in mips_elf_relocate_section which handled this
usage. However, I see that you have removed it.
I now see that you have also removed the support for R_MIPS16_26 while
you shuffled code from mips_elf_relocate_section to
mips_elf_calculate_relocation. That's rather disturbing. I wish you
had explicitly pointed that out. It's obviously very important that
BFD continue to support existing targets. It's definitely not OK to
break that.
Cases like R_MIPS16_26 and the 32 bit version of R_MIPS_64 arise on
embedded systems. You must not assume that the MIPS ELF code is only
used on native Unix systems.
Ian
More information about the Binutils
mailing list