This is the mail archive of the
mailing list for the binutils project.
invocation of mips_elf_multi_got can cause not enough GOT space for local GOT entries
- From: Robert Schiele <rschiele at gmail dot com>
- To: binutils at sourceware dot org
- Date: Fri, 4 Jan 2013 16:36:47 +0100
- Subject: invocation of mips_elf_multi_got can cause not enough GOT space for local GOT entries
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,
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.