This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [0/20] Rework the MIPS GOT code
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 12 Feb 2013 09:55:13 +0000
- Subject: Re: [0/20] Rework the MIPS GOT code
- References: <87fw1222fy.fsf@talisman.default>
Richard Sandiford <rdsandiford@googlemail.com> writes:
> Tested by building a mips64el-linux-gnu sysroot with patched binutils
> and running the GCC testsuite on the new sysroot. Also tested by
> running the binutils testsuite for various MIPS targets.
...but not, I later realised, mips-wrs-vxworks. I applied the patch
below to fix that.
Richard
bfd/
* elfxx-mips.c (mips_elf_lay_out_got): Count VxWorks GOT relocs
in g->relocs.
Index: bfd/elfxx-mips.c
===================================================================
--- bfd/elfxx-mips.c 2013-02-11 20:29:38.000000000 +0000
+++ bfd/elfxx-mips.c 2013-02-11 20:34:58.464621415 +0000
@@ -8649,20 +8649,7 @@ mips_elf_lay_out_got (bfd *output_bfd, s
/* VxWorks does not support multiple GOTs. It initializes $gp to
__GOTT_BASE__[__GOTT_INDEX__], the value of which is set by the
dynamic loader. */
- if (htab->is_vxworks)
- {
- /* VxWorks executables do not need a GOT. */
- if (info->shared)
- {
- /* Each VxWorks GOT entry needs an explicit relocation. */
- unsigned int count;
-
- count = g->global_gotno + g->local_gotno - htab->reserved_gotno;
- if (count)
- mips_elf_allocate_dynamic_relocations (dynobj, info, count);
- }
- }
- else if (s->size > MIPS_ELF_GOT_MAX_SIZE (info))
+ if (!htab->is_vxworks && s->size > MIPS_ELF_GOT_MAX_SIZE (info))
{
if (!mips_elf_multi_got (output_bfd, info, s, page_gotno))
return FALSE;
@@ -8687,6 +8674,10 @@ mips_elf_lay_out_got (bfd *output_bfd, s
BFD_ASSERT (g->tls_assigned_gotno
== g->global_gotno + g->local_gotno + g->tls_gotno);
+ /* Each VxWorks GOT entry needs an explicit relocation. */
+ if (htab->is_vxworks && info->shared)
+ g->relocs += g->global_gotno + g->local_gotno - htab->reserved_gotno;
+
/* Allocate room for the TLS relocations. */
if (g->relocs)
mips_elf_allocate_dynamic_relocations (dynobj, info, g->relocs);