This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Reloc changes to bfd/elf32-mips.c
>>>>> "Geoff" == Geoff Keating <geoffk@ozemail.com.au> writes:
Geoff> For instance, the following .s file:
Geoff> l1: b l2 l3: lw $5,%lo(l1+0x10004)($2) b l4 l2: lui
Geoff> $2,%hi(l1+0x10004) add $3,$2,$3 lw $4,%lo(l1+0x10004)($3) b
Geoff> l3 l4:
Geoff> produces the following relocs from gas:
Geoff> RELOCATION RECORDS FOR [.text]: OFFSET TYPE VALUE
Geoff> 000000000000000c R_MIPS_LO16 .text 0000000000000010
Geoff> R_MIPS_HI16 .text 000000000000001c R_MIPS_LO16 .text
Geoff> Contents of section .text: 0000 10000003 00000000 10000005
Geoff> 8c450004 .............E.. 0010 3c020001 00431820 1000fffb
Geoff> 8c640004 <....C. .....d..
Geoff> which used to cause ld to fail with an error. gcc can
Geoff> generate control flows like this (although some of the
Geoff> branches have to be conditional).
I think it's OK to have `ld' (as an extension) handle this case. But,
we really should fix GAS. It would be useful (I know this because
customers have told me so :-)) to be able to assemble things with GAS,
but link them with the MIPS linker. The .o files that GAS creates are
not ABI-compliant, and not for any particularly good reason. (In
other words, I don't see a real performance improvement/useful feature
that the "incorrect" ordering buys you.)
That's an irrelevant paragraph, from the point of view of the goodness
of your patch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com