MIPS/ELF linker
Quoted 4 lines · Mark Mitchell
Thanks for trying the MIPS backend out. I'm eager to shake out the bugs. It seems pretty solid on IRIX6, now, but I'm sure there are issues remaining on other platforms.
Quoted 8 lines
+ /* Assume no jalx is required */
+*require_jalxp= false;
+
REQUIRE_JALXPis set unconditionally a few lines down. Why doesn't that do the trick? The caller should not be looking at the value ofrequire_jalxunlesscalculate_relocationreturns a successful error code.
So the caller _bfd_mips_elf_relocate_section does not behave appropriately when mips_elf_calculate_relocation returns bfd_reloc_undefined. Search for bfd_reloc_undefined in mips_elf_calculate_relocation; it's being returned before an actual value gets assigned to *require_jalxp.
Quoted 24 lines
/usr/bin/mips-linux-ld: not enough GOT space for local GOT entriesProbably some relocation is requiring a local GOT entry, but we're not allocating it. Look for this code in
check_relocs:if (!h && (
r_type==R_MIPS_CALL_LO16
||r_type==R_MIPS_GOT_LO16
||r_type==R_MIPS_GOT_DISP))
{
/* We may need a local GOT entry for this relocation. We
don't countR_MIPS_HI16orR_MIPS_GOT16relocations because they are always followed by aR_MIPS_LO16relocation for the value. We don'tR_MIPS_GOT_PAGEbecause we can estimate the maximum number of pages needed by looking at the size of the segment.This estimation is very conservative since we can merge duplicate entries in the GOT. In order to be less conservative, we could actually build the GOT here, rather than in
relocate_section. */
g->local_gotno++;
sgot->_raw_size+=MIPS_ELF_GOT_SIZE(dynobj);
}
Quoted 7 lines
Probably this code is not firing in some case where it should be firing. Therefore, we're not adding enough GOT space. That might help track down the bug.
If not, feel free to send me the files on your link-line in a giant tar-ball, together with how your configuring binutils, and I'll try to duplicate and fix your problem.
I'll send you a non-giant tarball of 73kb which will demonstrate the problem. Just run the Makefile in the archive. The linker has been configured for the target mips-linux which is a standard MIPS/ELF target.
Ralf
Quoted 4 lines · Mark Mitchell
Ralf --
Thanks for the tarball. I'll not be able to look at this until
tomorrow, but I will do so then.
Ok, I'm looking into things in parallel if I find the time. I'll also try to rebuild GNU libc for MIPS. That has historically proven to be a bone breaker for ld. The last time I tried a few weeks ago I got ~500 assertion messages from ld just alone for the libc final link ... Will let you know how things go.
Ralf