From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: rth@cygnus.com Cc: binutils@sourceware.cygnus.com Subject: Re: .dynsym pain Date: Wed, 14 Jul 1999 01:03:00 -0000 Message-id: <19990714010018W.mitchell@codesourcery.com> References: <19990713191248.A4175@cygnus.com> <19990713224423R.mitchell@codesourcery.com> <19990714000728.D7058@cygnus.com> X-SW-Source: 1999-q3/msg00197.html >>>>> "Richard" == Richard Henderson writes: Richard> On Tue, Jul 13, 1999 at 10:44:23PM -0700, Mark Mitchell Richard> wrote: >> Is MIPS really broken, or do you just think it is? Richard> I know it is. OK. Richard> I'm doubly convinced another sort is needed. OK. In that case, your patch looks reasonable to me, I guess. But, I'm nervous about the need for *two* sorts. The reason for the first sort is to calculate the size of the GOT: /* There has to be a global GOT entry for every symbol with a dynamic symbol table index of DT_MIPS_GOTSYM or higher. Therefore, it make sense to put those symbols that need GOT entries at the end of the symbol table. We do that here. */ if (!mips_elf_sort_hash_table (info)) return false; i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx; s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj); So, if we resort, and the GOT gets bigger, that's very bad. I assume that this can't happen. Perhaps you could add an assertion to check that this situation does not occur? Just checking `elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx' before and after the second sort should do it. -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com