* elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
authorIan Lance Taylor <ian@airs.com>
Wed, 1 Nov 1995 18:25:35 +0000 (18:25 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 1 Nov 1995 18:25:35 +0000 (18:25 +0000)
BFD is not of the right type.
(bfd_elf_get_needed_list): Likewise.
* i386linux.c (bfd_linux_size_dynamic_sections): Likewise.
* sunos.c (bfd_sunos_get_needed_list): Likewise.
* xcofflink.c (XCOFF_XVECP): Define.
(bfd_xcoff_link_record_set): Don't do anything if the BFD is not
of the right type.
(bfd_xcoff_import_symbol): Likewise.
(bfd_xcoff_export_symbol): Likewise.
(bfd_xcoff_link_count_reloc): Likewise.
(bfd_xcoff_record_link_assignment): Likewise.
(bfd_xcoff_size_dynamic_sections): Likewise.

bfd/ChangeLog
bfd/elf.c
bfd/i386linux.c
bfd/sunos.c
bfd/xcofflink.c

index a9521c4..479a788 100644 (file)
@@ -1,5 +1,19 @@
 Wed Nov  1 11:45:07 1995  Ian Lance Taylor  <ian@cygnus.com>
 
+       * elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
+       BFD is not of the right type.
+       (bfd_elf_get_needed_list): Likewise.
+       * i386linux.c (bfd_linux_size_dynamic_sections): Likewise.
+       * sunos.c (bfd_sunos_get_needed_list): Likewise.
+       * xcofflink.c (XCOFF_XVECP): Define.
+       (bfd_xcoff_link_record_set): Don't do anything if the BFD is not
+       of the right type.
+       (bfd_xcoff_import_symbol): Likewise.
+       (bfd_xcoff_export_symbol): Likewise.
+       (bfd_xcoff_link_count_reloc): Likewise.
+       (bfd_xcoff_record_link_assignment): Likewise.
+       (bfd_xcoff_size_dynamic_sections): Likewise.
+
        * sunos.c (sunos_scan_ext_relocs): Only check the reloc symbol
        table index against the number of symbols for a base relative
        reloc.
index de8bc4b..95245f5 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -446,7 +446,8 @@ bfd_elf_set_dt_needed_name (abfd, name)
      bfd *abfd;
      const char *name;
 {
-  elf_dt_needed_name (abfd) = name;
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    elf_dt_needed_name (abfd) = name;
 }
 
 /* Get the list of DT_NEEDED entries for a link.  */
@@ -456,6 +457,8 @@ bfd_elf_get_needed_list (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
+  if (info->hash->creator->flavour != bfd_target_elf_flavour)
+    return NULL;
   return elf_hash_table (info)->needed;
 }
 \f
index d46f622..92260af 100644 (file)
@@ -549,6 +549,9 @@ bfd_linux_size_dynamic_sections (output_bfd, info)
   struct fixup *f;
   asection *s;
 
+  if (output_bfd->xvec != &MY(vec))
+    return true;
+
   /* First find the fixups... */
   linux_link_hash_traverse (linux_hash_table (info),
                            linux_tally_symbols,
index a180f2f..74ab1eb 100644 (file)
@@ -1155,6 +1155,8 @@ bfd_sunos_get_needed_list (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
+  if (info->hash->creator != &MY(xvec))
+    return NULL;
   return sunos_hash_table (info)->needed;
 }
 
index a3c6612..a76a537 100644 (file)
@@ -29,6 +29,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #define STRING_SIZE_SIZE (4)
 
+/* In order to support linking different object file formats into an
+   XCOFF format, we need to be able to determine whether a particular
+   bfd_target is an XCOFF vector.  FIXME: We need to rethink this
+   whole approach.  */
+#define XCOFF_XVECP(xv) \
+  (strcmp ((xv)->name, "aixcoff-rs6000") == 0 \
+   || strcmp ((xv)->name, "xcoff-powermac") == 0)
+
 /* Get the XCOFF hash table entries for a BFD.  */
 #define obj_xcoff_sym_hashes(bfd) \
   ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
@@ -2130,6 +2138,9 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
   struct xcoff_link_size_list *n;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   /* This will hardly ever be called.  I don't want to burn four bytes
      per global symbol, so instead the size is kept on a linked list
      attached to the hash table.  */
@@ -2166,6 +2177,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
 {
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   h->flags |= XCOFF_IMPORT;
 
   if (val != (bfd_vma) -1)
@@ -2249,6 +2263,9 @@ bfd_xcoff_export_symbol (output_bfd, info, harg, syscall)
 {
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   h->flags |= XCOFF_EXPORT;
 
   /* FIXME: I'm not at all sure what syscall is supposed to mean, so
@@ -2273,6 +2290,9 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name)
 {
   struct xcoff_link_hash_entry *h;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, false, false,
                              false);
   if (h == NULL)
@@ -2303,6 +2323,9 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
 {
   struct xcoff_link_hash_entry *h;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, true,
                              false);
   if (h == NULL)
@@ -2369,6 +2392,9 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
   struct bfd_strtab_hash *debug_strtab;
   bfd_byte *debug_contents = NULL;
 
+  if (! XCOFF_XVECP (output_bfd->xvec))
+    return true;
+
   ldinfo.failed = false;
   ldinfo.output_bfd = output_bfd;
   ldinfo.info = info;