public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* invocation of mips_elf_multi_got can cause not enough GOT space for local GOT entries
@ 2013-01-04 15:37 Robert Schiele
  2013-01-08 11:10 ` Robert Schiele
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Schiele @ 2013-01-04 15:37 UTC (permalink / raw)
  To: binutils

Hi,

I ran into a problem on a huge link for mips64 Linux ELF target that
causes the linker to fail with the error message "not enough GOT space
for local GOT entries".

This is not a new problem since it happens with current master branch
as well as very old releases I went back to.

Debugging the problem so far revealed that the counting of the regular
local_gotno values goes all well and corresponds to the entries later
accumulated to assigned_gotno (excluding the page entries) but for one
specific GOT that is created during the invocation of
mips_elf_multi_got the page number added up in

      g->local_gotno += (pages < g->page_gotno ? pages : g->page_gotno);

Seems to be incorrect. In that specific case
mips_elf_make_got_pages_per_bfd gets invoked by

  /* Also count how many page entries each input bfd requires.  */
  htab_traverse (g->got_page_entries, mips_elf_make_got_pages_per_bfd,
                 &got_per_bfd_arg);

often, adding up to page_gotno of various GOTs in the line

  g->page_gotno += entry->num_pages;

For the specific GOT this line of code is triggered 3 times, each time
with a value entry->num_pages of 2, counting up to a page_gotno for
this GOT of 6. Since this number is smaller than pages (which is 98)
the 6 is used for counting.

Later it turns out though that the invocation of
mips_elf_create_local_got_entry from within mips_elf_got_page causes a
total of 7 entries, which then in the end obviously steals one slot
that would be needed later for another entry.

This is where I am at the moment. Before digging deeper into the root
cause I thought I'd give people here a chance to jump in with their
knowledge to point me into the right direction in case you have an
idea what might go wrong here.

Especially I am interested about your opinion whether this could also
be caused by corrupt object files from the compiler/assembler or
whether this for sure is a problem with ld/libbfd. Unfortunately I
cannot provide the code that is reproducing that because first of all
it is proprietary software and after all it is really huge, such that
shipping that stuff would not be very practicable. Also given the
involved code it doesn't seem that I could easily create a smaller
test case that also reproduces this.

Hopefully someone has some hints before I dig deeper into this.

Robert

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-01-15 13:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-04 15:37 invocation of mips_elf_multi_got can cause not enough GOT space for local GOT entries Robert Schiele
2013-01-08 11:10 ` Robert Schiele
2013-01-08 14:31   ` Robert Schiele
2013-01-08 19:15     ` Richard Sandiford
2013-01-09 15:10       ` Robert Schiele
2013-01-11 15:14         ` Robert Schiele
2013-01-10  9:18       ` Robert Schiele
2013-01-10  9:48         ` Robert Schiele
2013-01-14 13:07           ` Robert Schiele
2013-01-14 13:47             ` Richard Sandiford
2013-01-15 10:45               ` Robert Schiele
2013-01-15 13:27                 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).