aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-02-01 23:15:23 +0000
committerIan Lance Taylor <ian@airs.com>1996-02-01 23:15:23 +0000
commit869b7d80d3988e8677d9da2337313d98e2895aad (patch)
treea55114afd3cdc9395ba17cfc8518b80699fc3811 /bfd/elflink.h
parent626a6542ec68cdc8c7763f0cf2cbaeedd6799be3 (diff)
downloadgdb-869b7d80d3988e8677d9da2337313d98e2895aad.zip
gdb-869b7d80d3988e8677d9da2337313d98e2895aad.tar.gz
gdb-869b7d80d3988e8677d9da2337313d98e2895aad.tar.bz2
* elf-bfd.h (ELF_LINK_NON_ELF): Define.
* elf.c (_bfd_elf_link_hash_newfunc): Set elf_link_hash_flags to ELF_LINK_NON_ELF. * elflink.h (elf_link_add_object_symbols): Reset ELF_LINK_NON_ELF flag for a newly defined symbol. (NAME(bfd_elf,record_link_assignment)): Likewise. (elf_adjust_dynamic_symbol): If ELF_LINK_NON_ELF is set, try to set the DEF or REF_REGULAR flags correctly.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index f1cf498..beab0d0 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -643,6 +643,9 @@ elf_link_add_object_symbols (abfd, info)
goto error_return;
*sym_hash = h;
+ if (h->root.type == bfd_link_hash_new)
+ h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1231,6 +1234,9 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
if (h == NULL)
return false;
+ if (h->root.type == bfd_link_hash_new)
+ h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+
/* If this symbol is being provided by the linker script, and it is
currently defined by a dynamic object, but not by a regular
object, then mark it as undefined so that the generic linker will
@@ -1507,6 +1513,35 @@ elf_adjust_dynamic_symbol (h, data)
bfd *dynobj;
struct elf_backend_data *bed;
+ /* If this symbol was mentioned in a non-ELF file, try to set
+ DEF_REGULAR and REF_REGULAR correctly. This is the only way to
+ permit a non-ELF file to correctly refer to a symbol defined in
+ an ELF dynamic object. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0)
+ {
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
+ else
+ {
+ if (bfd_get_flavour (h->root.u.def.section->owner)
+ == bfd_target_elf_flavour)
+ h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
+ else
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ }
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
+ {
+ if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
+ {
+ eif->failed = true;
+ return false;
+ }
+ }
+ }
+
/* If -Bsymbolic was used (which means to bind references to global
symbols to the definition within the shared object), and this
symbol was defined in a regular object, then it actually doesn't