This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Your change may have broken linkonce support
On Fri, Jun 13, 2003 at 02:26:32PM +0930, Alan Modra wrote:
> On Thu, Jun 12, 2003 at 01:01:27PM -0700, H. J. Lu wrote:
> > Alan,
> >
> > I believe your change mentioned in
> >
> > http://sources.redhat.com/ml/binutils/2001-09/msg00499.html
> >
> > breaks linkonce support with debug:
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7671
>
> I doubt that changing section ordering has anything to do with this
> problem. The real problem is that we have debug info for a removed
> section, with relocations that are left dangling. The debug info
> ought to be removed along with the section, preferably by using
> section groups.
>
The current code is wrong. We should check discarded local definitions
for relocatable output since they may not be be resolved later. This
is not a patch. I will try to find a better fix.
H.J.
----
--- bfd/elflink.h.debug 2003-06-12 07:13:40.000000000 -0700
+++ bfd/elflink.h 2003-06-12 23:59:00.000000000 -0700
@@ -5047,8 +5047,7 @@ elf_link_input_bfd (finfo, input_bfd)
removed link-once sections. Complain about relocs
against discarded sections. Zero relocs against removed
link-once sections. */
- if (!finfo->info->relocateable
- && !elf_section_ignore_discarded_relocs (o))
+ if (!elf_section_ignore_discarded_relocs (o))
{
Elf_Internal_Rela *rel, *relend;
@@ -5064,6 +5063,10 @@ elf_link_input_bfd (finfo, input_bfd)
{
struct elf_link_hash_entry *h;
+ /* It may be resolved later. */
+ if (finfo->info->relocateable)
+ continue;
+
h = sym_hashes[r_symndx - extsymoff];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)