-
-/* When we add new object files to the link at all symbols read time,
- these contain the real code and symbols generated from the IR files,
- and so duplicate all the definitions already supplied by the dummy
- IR-only BFDs that we created at claim files time. We use the linker's
- multiple-definitions callback hook to fix up the clash, discarding
- the symbol from the IR-only BFD in favour of the symbol from the
- real BFD. We return true if this was not-really-a-clash because
- we've fixed it up, or anyway if --allow-multiple-definition was in
- effect (before we disabled it to ensure we got called back). */
-static bfd_boolean
-plugin_multiple_definition (struct bfd_link_info *info,
- struct bfd_link_hash_entry *h,
- bfd *nbfd, asection *nsec, bfd_vma nval)
-{
- if (h->type == bfd_link_hash_defined
- && is_ir_dummy_bfd (h->u.def.section->owner))
- {
- /* Replace it with new details. */
- h->u.def.section = nsec;
- h->u.def.value = nval;
- return TRUE;
- }
-
- return (*orig_callbacks->multiple_definition) (info, h, nbfd, nsec, nval);
-}
-
-static bfd_boolean
-plugin_multiple_common (struct bfd_link_info *info,
- struct bfd_link_hash_entry *h,
- bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize)
-{
- if (h->type == bfd_link_hash_common
- && is_ir_dummy_bfd (h->u.c.p->section->owner)
- && ntype == bfd_link_hash_common
- && !is_ir_dummy_bfd (nbfd))
- {
- /* Arrange to have it replaced. */
- ASSERT (nsize != 0);
- h->u.c.size = 0;
- return TRUE;
- }
-
- return (*orig_callbacks->multiple_common) (info, h, nbfd, ntype, nsize);
-}