This comes up a couple times a year, so here's my try at laying it to
rest...
Background: Branches to external symbols, for MIPS, have been broken for a
long time. The definition of R_MIPS_PC16 in the ABI is pretty much useless
because it does not accomodate the two bit right shift. There was a GNU
extension (R_MIPS_GNU_REL16_S2), which did. It was only ever used for
embedded PIC.
Thiemo posted a patch here:
http://sourceware.org/ml/binutils/2003-02/msg00447.html
which changed the definition of R_MIPS_PC16 to include the right shift.
There was buy-in from most of the maintainers at the time, and I recall
seeing approving noises from MIPS also. Unfortunately the patch broke
n32/n64 branches.
Here's a refresh. The fiddly bits dealing with the branch offset are
changed, because all this code has been cleaned up since 2003. The refresh
appears to work fine on n64; I have not run any glibc tests using a patched
assembler, but I have linked mips-linux, mips64-linux, and mips-ecoff (ugh,
see the patch) executables and the relocations were always resolved
correctly. The new tests all pass. [There's lots of garbage in the MIPS
test results right now, though. All the DSP tests fail. So do most of the
MIPS-specific linker tests.]
OK? If so, what additional testing do you need?