The problem with linkonce sections in ELF
Ian Lance Taylor
Thu Feb 3 16:08:00 GMT 2000
Date: Thu, 3 Feb 2000 13:55:37 -0800
From: "H . J . Lu" <firstname.lastname@example.org>
> I think I found the problem. build_link_order () is called very
> late. Before that, the input section list of the output section
> is always empty. When we strip a linkonce section,
> _bfd_strip_section_from_output removes the corresponding output
> section by mistake since its input section list is empty. I don't
> know what the best fix is.
I don't understand this explanation. Why is it incorrect to remove an
output section which has no input sections? An output section with no
input sections should not occupy any space in any case.
_bfd_strip_section_from_output should only be called for sections
created by the linker. Are you saying that you have input sections
with the same name as sections which the linker creates? That could
indeed be a problem, and I don't think your patch is the correct fix
Ian, how about this patch? It seems to work for me.
First of all, I don't understand why this patch is needed or correct.
This patch appears to do extra work. I think it would be easier to
build the link order in wild_doit. I don't understand the ASSERT in
setup_output_link_order; it seems to me that it will trigger for a
linkonce section which is being discarded.
I don't think it is appropriate to change bfd_new_link_order in this
fashion. That function is very simple, and I think it should remain
simple. Instead, if this is in fact the right way to go, we should
change the linker to do something else.
More information about the Binutils