.got increase in -gc-sections for MIPS

Hiroki Kaminaga kaminaga@sm.sony.co.jp
Mon Dec 4 05:48:00 GMT 2006


Thiemo Seufer wrote:
> Current HEAD incrases for Hiroki's testcase by four GOT entries when using
> --gc-sections. It's not surprising it doesn't shrink, given that we don't
> do reference counting for GOT entries, but I don't see ATM where the
> increase comes from.

I tracked down with gdb, and found that, for every functions to be removed
by -gc-sections, local got got bumped up.

backtrace:
  elf_gc_sweep_symbol() -> _bfd_mips_elf_hide_symbol()

and goes to 

 9672       else if (g->global_gotno == 0 && g->global_gotsym == NULL)
 9673         /* If we haven't got through GOT allocation yet, just bump up the
 9674            number of local entries, as this symbol won't be counted as
 9675            global.  */
 9676         g->local_gotno++;

and increments MIPS_LOCAL_GOTNO.

I assume _bfd_mips_elf_hide_symbol() is for Visibility HIDDEN.
Is this bump up of local_gotno necessary for -gc-sections?


Thanks in Advance.

(Hiroki Kaminaga)
t
--



More information about the Binutils mailing list