This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Why were those codes removed from bfd_elf_match_symbols_in_sections?
On Fri, Feb 22, 2008 at 03:56:51PM -0800, H.J. Lu wrote:
> Intel C++ compiler generates section group members with .gnu.linkonce.*
> section names. It is an optimization.
"It is an optimization" doesn't explain why these sections should be
treated differently from other group sections. Currently, the linker
ignores section names within a group when it is trying to find the
correct kept section. eg. If we have a comdat group "foo" with
sections ".text", ".data" and ".bss" in one file and an identical
group in another, elflink.c:_bfd_elf_section_already_linked sets up
kept_section for the second file's foo .text to point at the first
file's foo, *not* the first file's foo .text, and similarly for other
sections in the group. Then, in match_group_member, to find the real
match for the discarded foo .text, we try to match symbols against all
the kept foo's sections. This ought to match on first try, but when
finding the kept section for the discarded foo .bss we first try foo
.text, then foo .data before finally trying foo .bss. I'm not sure
why we ignore section names, but that was the way you wrote this code.
Perhaps you can explain that too, as part of explaining why sections
in a group named .gnu.linkonce.* should compare names but *not*
symbols.
--
Alan Modra
Australia Development Lab, IBM