This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS multigot fixes for Linux
On Thu, Nov 13, 2003 at 09:51:26AM +0000, Richard Sandiford wrote:
> Richard Sandiford <rsandifo@redhat.com> writes:
> > Daniel Jacobowitz <drow@mvista.com> writes:
> > > * elfxx-mips.c (mips_elf_set_global_got_offset): Don't set
> > > no_fn_stub.
> > > (mips_elf_set_no_stub): New function.
> > > (mips_elf_multi_got): Call it.
> > > (_bfd_mips_elf_finish_dynamic_symbol): Fill relocated GOT entries
> > > with zero for ! SGI_COMPAT. Simplify calculation of value.
> >
> > Looks good to me FWIW.
>
> Just thinking... maybe the _bfd_mips_elf_finish_dynamic_symbol code
> could look like this? Then we wouldn't have any pesky SGI_COMPAT tests.
> Haven't tested this at all though.
I'm pretty sure it won't work.
> *************** _bfd_mips_elf_finish_dynamic_symbol (out
> *** 6692,6711 ****
> offset = p->gotidx;
> rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
>
> ! MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
> !
> ! if ((info->shared
> ! || (elf_hash_table (info)->dynamic_sections_created
> ! && p->d.h != NULL
> ! && ((p->d.h->root.elf_link_hash_flags
> ! & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
> ! && ((p->d.h->root.elf_link_hash_flags
> ! & ELF_LINK_HASH_DEF_REGULAR) == 0)))
> ! && ! (mips_elf_create_dynamic_relocation
> ! (output_bfd, info, rel,
> ! e.d.h, NULL, value, &addend, sgot)))
> ! return FALSE;
> ! BFD_ASSERT (addend == 0);
> }
> }
> }
> --- 6707,6729 ----
> offset = p->gotidx;
> rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
>
> ! if (info->shared
> ! || (elf_hash_table (info)->dynamic_sections_created
> ! && p->d.h != NULL
> ! && ((p->d.h->root.elf_link_hash_flags
> ! & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
> ! && ((p->d.h->root.elf_link_hash_flags
> ! & ELF_LINK_HASH_DEF_REGULAR) == 0)))
> ! {
> ! entry = 0;
> ! if (! (mips_elf_create_dynamic_relocation
> ! (output_bfd, info, rel,
> ! e.d.h, NULL, sym->st_value, &entry, sgot)))
> ! return FALSE;
> ! }
> ! else
> ! entry = sym->st_value;
> ! MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset);
> }
> }
> }
>
The BFD_ASSERT used to not trigger. Therefore, you'll fill the GOT
entry with 0 if you create a relocation and st_value if you don't.
That will break Irix, I assume.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer