aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1998-12-06 23:02:41 +0000
committerIan Lance Taylor <ian@airs.com>1998-12-06 23:02:41 +0000
commite9814417ab6c53a89c73e0fbd8ef97b610b0d351 (patch)
treea255ff9a657fc835c33b0a40b6a22250f91c9226 /bfd
parent859a615e589069b5f8dcdfa29f869a30102b3254 (diff)
downloadgdb-e9814417ab6c53a89c73e0fbd8ef97b610b0d351.zip
gdb-e9814417ab6c53a89c73e0fbd8ef97b610b0d351.tar.gz
gdb-e9814417ab6c53a89c73e0fbd8ef97b610b0d351.tar.bz2
* elflink.h (elf_fix_symbol_flags): Check for case where a non-ELF
file defines a symbol first mentioned in an ELF file.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/elflink.h19
2 files changed, 22 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 07f7b50..0c162ff 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
Sun Dec 6 16:30:33 1998 Ian Lance Taylor <ian@cygnus.com>
+ * 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 decfba2..1aea0d9 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