This is the mail archive of the binutils@sources.redhat.com 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: Multiple sections with the same name again


On Mon, May 24, 2004 at 01:10:52PM +0930, Alan Modra wrote:
> So I think there is a more fundamental design problem here.  The merge
> code shouldn't be trying to guess what the linker will do in
> ldlang.c:map_input_to_output_sections.  There's a comment in ldlang.c

I assumed that by making the sections mergeable you promise not to do
anything weird with the sections in the linker script.

> lang_process before the bfd_merge_sections call that says in part:
> 
>      This has to be done after GC of sections,
>      so that GCed sections are not merged, but before assigning output
>      sections, since removing whole input sections is hard then.
> 
> That's not strictly true, as it isn't so hard to remove output sections
> after map_input_to_output_sections.  For example, many of the backend
> size_dynamic_section routines remove sections.  Where it becomes truly
> hard is after the lang_process -> ldemul_before_allocate ->
> bfd_elf_size_dynamic_sections -> _bfd_elf_link_renumber_dynsyms call and
> dynamic symbols have been sized.
> 
> I think what should be done is
> - Remove the _bfd_merge_section call in elf_link_add_object_symbols.
>   This is primarily collecting information on what sections should be
>   merged.
> - Move the bfd_merge_sections call in lang_process after
>   lang_place_orphans and before ldemul_before_allocation.
> - Traverse the linker script in bfd_merge_sections to determine which
>   sections should be merged.
> 
> Jakub, do you see any problem in doing things this way?

It has been a few years since I wrote that, so I don't remember the details
and things probably changed in that area too.
But I remember I have been fighting badly with section removal at that time,
at some point setting SEC_EXCLUDE no longer worked and clearing _cooked_size
never actually worked (the size would be reset from _raw_size).
If it works now, I have certainly no problems with moving the call.

	Jakub


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