This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
powerpc64 opd edit
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Cc: David Edelsohn <dje at watson dot ibm dot com>
- Date: Tue, 8 Oct 2002 19:14:57 +0930
- Subject: powerpc64 opd edit
The comment below tells the story.
* elf64-ppc.c (edit_opd): Correct test for discarded sections.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.65
diff -u -p -r1.65 elf64-ppc.c
--- bfd/elf64-ppc.c 7 Oct 2002 00:06:01 -0000 1.65
+++ bfd/elf64-ppc.c 8 Oct 2002 09:36:25 -0000
@@ -3675,12 +3675,16 @@ edit_opd (obfd, info)
break;
}
- if (sym_sec->output_section == bfd_abs_section_ptr)
- {
- /* OK, we've found a function that's excluded from the
- link. */
- need_edit = true;
- }
+ /* opd entries are always for functions defined in the
+ current input bfd. If the symbol isn't defined in the
+ input bfd, then we won't be using the function in this
+ bfd; It must be defined in a linkonce section in another
+ bfd, or is weak. It's also possible that we are
+ discarding the function due to a linker script /DISCARD/,
+ which we test for via the output_section. */
+ if (sym_sec->owner != ibfd
+ || sym_sec->output_section == bfd_abs_section_ptr)
+ need_edit = true;
offset += 24;
}
@@ -3754,7 +3758,8 @@ edit_opd (obfd, info)
sym->st_shndx);
}
- skip = sym_sec->output_section == bfd_abs_section_ptr;
+ skip = (sym_sec->owner != ibfd
+ || sym_sec->output_section == bfd_abs_section_ptr);
if (skip)
{
if (h != NULL)
--
Alan Modra
IBM OzLabs - Linux Technology Centre