This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stale entries left in GOT & PLT while discarding sections


On Fri, Apr 07, 2006 at 07:09:55PM +0530, Rajat Jain wrote:
> 1) As per my understanding the reason that the (stale) entries for the
> removed sections / symbols are left in the GOT / PLT is because "ld"
> creates the GOT and PLT at an early stage and later when reading the
> linker script discards the sections as requested. It however does not
> see (and does not care) that due to the removal of certain sections,
> the entries in GOT and PLT have become inconsistent. Is my
> understanding correct?

Yes.

> 2) Is there any solution to the problem I am facing here? I mean is
> there a way to remove the entries from the GOT and PLT as well?

I think the basic machinery to do this is already in the linker
--gc-sections support.  If I was trying to do this, I would

o Break out the gc_sweep_hook calls in elflink.c:elf_gc_sweep into
  another function.  ie. Set SEC_EXCLUDE in elf_gc_sweep, but don't call
  the hook to decrement plt/got reloc counts.  The new function should
  call gc_sweep_hook on all SEC_EXCLUDE sections that have been
  processed by check_relocs.
o Arrange to call the new function immediately after
  ldlang.c:lang_process calls lang_place_orphans.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]