This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFC] Providing init_fini_syms earlier?
On Thu, Jul 14, 2005 at 11:24:07PM +0930, Alan Modra wrote:
> On Wed, Jul 13, 2005 at 11:18:25PM +0930, Alan Modra wrote:
> > On Wed, Jul 13, 2005 at 11:02:11PM +0930, Alan Modra wrote:
> > > On Tue, Jul 12, 2005 at 05:47:12PM -0700, H. J. Lu wrote:
> > > > The final values have to be absulte.
> > >
> > > Why?
> > >
> > > > How does it support relaxation
> > > > when it will be called more then once?
> > >
> > > If they are section relative, then there is no problem with relaxation
> > > unless the init or fini sections change size, which I think is
> > > unlikely to happen. There is one disadvantage of section relative syms;
> > > They cause their output section to be kept. Hmm, I suppose we could
> > > change that. We might even be able to do without bfd_mark_used_section
> > > entirely now that vma is set correctly for stripped output sections.
> >
> > Oh, except you would need to convert the syms to absolute if their
> > output section was stripped. Was that why you were saying they needed
> > to be absolute?
>
> This is how I think we should handle these symbols.
>
> bfd/
> * bfd-in.h (_bfd_elf_fix_excluded_sec_syms): Declare.
> (_bfd_elf_provide_section_bound_symbols): Remove param name.
> Formatting.
> * bfd-in2.h: Regenerate.
> * elflink.c (bfd_elf_gc_sections): Don't call generic function.
> (_bfd_elf_provide_symbol): Formatting.
> (_bfd_elf_provide_section_bound_symbols): Remove all hacks, just
> create section relative syms.
> (fix_syms, _bfd_elf_fix_excluded_sec_syms): New functions.
> * elf32-ppc.c (ppc_elf_set_sdata_syms): Use
> _bfd_elf_provide_section_bound_symbols.
> * reloc.c (bfd_mark_used_section): Delete.
> (bfd_generic_gc_sections): Don't call the above.
> ld/
> * ldlang.c (strip_excluded_output_sections): Don't call
> bfd_gc_sections.
> * emultempl/elf32.em (gld*_provide_bound_symbols): Move.
> (gld*_provide_init_fini_syms): Move.
> (gld*_before_allocation): Call the above from here..
> (gld*_finish): ..not here. Call _bfd_elf_fix_excluded_sec_syms.
> * emultempl/hppaelf.em (hppaelf_finish): Likewise.
> * emultempl/ppc64elf.em (ppc_finish): Likewise.
>
_bfd_elf_provide_section_bound_symbols should be called at least
once after lang_size_sections. Otherwise, the section size will be
zero.
H.J.