diff --git a/binutils/bfd/coff-rs6000.c b/binutils/bfd/coff-rs6000.c index 983311a317..2b26c43eeb 100644 --- a/binutils/bfd/coff-rs6000.c +++ b/binutils/bfd/coff-rs6000.c @@ -3394,7 +3394,8 @@ xcoff_ppc_relocate_section (bfd *output_bfd, else { if (info->unresolved_syms_in_objects != RM_IGNORE - && (h->flags & XCOFF_WAS_UNDEFINED) != 0) + && (h->flags & XCOFF_WAS_UNDEFINED) != 0 + && h->root.type != bfd_link_hash_undefweak) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, @@ -3412,13 +3413,18 @@ xcoff_ppc_relocate_section (bfd *output_bfd, + sec->output_section->vma + sec->output_offset); } - else if (h->root.type == bfd_link_hash_common) - { - sec = h->root.u.c.p->section; - val = (sec->output_section->vma - + sec->output_offset); + else if (h->root.type == bfd_link_hash_common) + { + sec = h->root.u.c.p->section; + val = (sec->output_section->vma + + sec->output_offset); - } + } + else if (h->root.type == bfd_link_hash_undefweak) + { + sec = 0; + val = 0; + } else { BFD_ASSERT (info->relocatable diff --git a/binutils/bfd/xcofflink.c b/binutils/bfd/xcofflink.c index 7f321ee241..b48580a75f 100644 --- a/binutils/bfd/xcofflink.c +++ b/binutils/bfd/xcofflink.c @@ -2773,8 +2773,10 @@ xcoff_mark_symbol (struct bfd_link_info *info, struct xcoff_link_hash_entry *h) /* Treat this symbol as undefined if the descriptor was. */ if ((hds->flags & XCOFF_WAS_UNDEFINED) != 0) - h->flags |= XCOFF_WAS_UNDEFINED; - + { + if(h->root.type != bfd_link_hash_undefweak) + h->flags |= XCOFF_WAS_UNDEFINED; + } /* Allocate room for the global linkage code itself. */ sec = xcoff_hash_table (info)->linkage_section; h->root.type = bfd_link_hash_defined;