From e9814417ab6c53a89c73e0fbd8ef97b610b0d351 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 6 Dec 1998 23:02:41 +0000 Subject: [PATCH] * elflink.h (elf_fix_symbol_flags): Check for case where a non-ELF file defines a symbol first mentioned in an ELF file. --- bfd/ChangeLog | 3 +++ bfd/elflink.h | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 07f7b50eefe..0c162ff6480 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,8 @@ Sun Dec 6 16:30:33 1998 Ian Lance Taylor + * elflink.h (elf_fix_symbol_flags): Check for case where a non-ELF + file defines a symbol first mentioned in an ELF file. + * bfd-in.h: Always define BFD_HOST_64_BIT and BFD_HOST_U_64_BIT if possible, rather than only if BFD64. * elflink.h (compute_bucket_count): Just check BFD_HOST_U_64_BIT, diff --git a/bfd/elflink.h b/bfd/elflink.h index decfba2a0fc..1aea0d94758 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -2983,6 +2983,25 @@ elf_fix_symbol_flags (h, eif) } } } + else + { + /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol + was first seen in a non-ELF file. Fortunately, if the symbol + was first seen in an ELF file, we're probably OK unless the + symbol was defined in a non-ELF file. Catch that case here. + FIXME: We're still in trouble if the symbol was first seen in + a dynamic object, and then later in a non-ELF regular object. */ + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && (h->root.u.def.section->owner != NULL + ? (bfd_get_flavour (h->root.u.def.section->owner) + != bfd_target_elf_flavour) + : (bfd_is_abs_section (h->root.u.def.section) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + } /* If this is a final link, and the symbol was defined as a common symbol in a regular object file, and there was no definition in -- 2.30.2