]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* reloc.c: Move sh relocs to where they belong.
authorAlan Modra <amodra@gmail.com>
Sat, 27 Apr 2002 08:30:16 +0000 (08:30 +0000)
committerAlan Modra <amodra@gmail.com>
Sat, 27 Apr 2002 08:30:16 +0000 (08:30 +0000)
* libbfd.h, bfd-in2.h: Regenerate.

Merge from mainline
2002-04-26  Alan Modra  <amodra@bigpond.net.au>
* opncls.c (bfd_make_readable): Call bfd_section_list_clear.
* xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
* elflink.h (elf_bfd_final_link): Ensure input bfd class is the
same as the output before calling elf_link_input_bfd.
* coffcode.h (coff_compute_section_file_positions): Set
section_tail after shuffling section list.

2002-04-23  Alan Modra  <amodra@bigpond.net.au>
* elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
under which a plt call stub is used.
(final_link_relocate): Similarly.
(allocate_plt_static): Clear h-plabel except when plt entry is
exclusively used for a plabel.
(allocate_dynrelocs): Use the above to simplify plt sizing.
(struct elf32_hppa_link_hash_table): Add has_22bit_branch.
(elf32_hppa_link_hash_table_create): Init.
(BL22_RP): Define.
(hppa_build_one_stub): Use BL22_RP if has_22bit_branch.
(elf32_hppa_check_relocs): Set has_22bit_branch.
* elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message.
(final_link_relocate): Likewise.

2002-04-20  Alan Modra  <amodra@bigpond.net.au>
* archures.c (bfd_arch_info): Add comment on list order.
(bfd_default_set_arch_mach): Use bfd_lookup_arch.
* cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default
is always at head of list.
* bfd-in2.h: Regenerate.

2002-04-16  Alan Modra  <amodra@bigpond.net.au>
* elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
type rather than just assuming entries are ELF.
* elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
* elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
* elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
* elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
rather than elf_link_hash_entry.

2002-04-15  Alan Modra  <amodra@bigpond.net.au>
* elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.

2002-04-08  Randolph Chung  <tausq@debian.org>
* elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
(elf32_hppa_final_link): Split out sorting logic to..
* elf-hppa.h (elf_hppa_sort_unwind): ..here.
(elf_hppa_final_link): Call elf_hppa_sort_unwind.

19 files changed:
bfd/ChangeLog
bfd/ChangeLog-9495
bfd/archures.c
bfd/bfd-in2.h
bfd/coffcode.h
bfd/cpu-powerpc.c
bfd/elf-hppa.h
bfd/elf32-hppa.c
bfd/elf32-m32r.c
bfd/elf32-ppc.c
bfd/elf32-sh64.c
bfd/elf64-mmix.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elflink.h
bfd/libbfd.h
bfd/opncls.c
bfd/reloc.c
bfd/xcofflink.c

index 5e7b00ff41cf8b0604ec9e777360c29a3d090286..d579edc01ea1f800c1750362e74dfeb70b68599c 100644 (file)
@@ -1,3 +1,57 @@
+2002-04-27  Alan Modra  <amodra@bigpond.net.au>
+
+       * reloc.c: Move sh relocs to where they belong.
+       * libbfd.h, bfd-in2.h: Regenerate.
+
+       Merge from mainline
+       2002-04-26  Alan Modra  <amodra@bigpond.net.au>
+       * opncls.c (bfd_make_readable): Call bfd_section_list_clear.
+       * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
+       * elflink.h (elf_bfd_final_link): Ensure input bfd class is the
+       same as the output before calling elf_link_input_bfd.
+       * coffcode.h (coff_compute_section_file_positions): Set
+       section_tail after shuffling section list.
+
+       2002-04-23  Alan Modra  <amodra@bigpond.net.au>
+       * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
+       under which a plt call stub is used.
+       (final_link_relocate): Similarly.
+       (allocate_plt_static): Clear h-plabel except when plt entry is
+       exclusively used for a plabel.
+       (allocate_dynrelocs): Use the above to simplify plt sizing.
+       (struct elf32_hppa_link_hash_table): Add has_22bit_branch.
+       (elf32_hppa_link_hash_table_create): Init.
+       (BL22_RP): Define.
+       (hppa_build_one_stub): Use BL22_RP if has_22bit_branch.
+       (elf32_hppa_check_relocs): Set has_22bit_branch.
+       * elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message.
+       (final_link_relocate): Likewise.
+
+       2002-04-20  Alan Modra  <amodra@bigpond.net.au>
+       * archures.c (bfd_arch_info): Add comment on list order.
+       (bfd_default_set_arch_mach): Use bfd_lookup_arch.
+       * cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default
+       is always at head of list.
+       * bfd-in2.h: Regenerate.
+
+       2002-04-16  Alan Modra  <amodra@bigpond.net.au>
+       * elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
+       type rather than just assuming entries are ELF.
+       * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
+       * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
+       * elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
+       * elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
+       rather than elf_link_hash_entry.
+
+       2002-04-15  Alan Modra  <amodra@bigpond.net.au>
+       * elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.
+
+       2002-04-08  Randolph Chung  <tausq@debian.org>
+       * elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
+       (elf32_hppa_final_link): Split out sorting logic to..
+       * elf-hppa.h (elf_hppa_sort_unwind): ..here.
+       (elf_hppa_final_link): Call elf_hppa_sort_unwind.
+
 2002-04-26  Richard Smith  <richard@ex-parrot.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index 4657d6683fd781996c67d8a17bd0399132e44681..a208f42991d6b5b8b0056cbdf42c4faf46493f6c 100644 (file)
@@ -6887,7 +6887,7 @@ Tue May 24 16:17:18 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
        * libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
        (elf_bad_symtab): Define new accessor macro.
        (_bfd_elf_link_hash_newfunc): Declare.
-       (_bew_elf_link_hash_table_init): Declare.
+       (_bfd_elf_link_hash_table_init): Declare.
        * elfcode.h (elf_object_p): Call backend object_p hook after
        swapping in all the section headers.
        (map_program_segments): Correct typo: Internal for External.
index 9a91424a6ef4c618c16cc5a41fc7acd1fc61904e..40102e8b0f1c82a737d601114c4db13713516421 100644 (file)
@@ -288,7 +288,9 @@ DESCRIPTION
 .  const char *arch_name;
 .  const char *printable_name;
 .  unsigned int section_align_power;
-.  {* True if this is the default machine for the architecture.  *}
+.  {* True if this is the default machine for the architecture.
+.     The default arch should be the first entry for an arch so that
+.     all the entries for that arch can be accessed via <<next>>.  *}
 .  boolean the_default;
 .  const struct bfd_arch_info * (*compatible)
 .      PARAMS ((const struct bfd_arch_info *a,
@@ -604,21 +606,9 @@ bfd_default_set_arch_mach (abfd, arch, mach)
      enum bfd_architecture arch;
      unsigned long mach;
 {
-  const bfd_arch_info_type * const *app, *ap;
-
-  for (app = bfd_archures_list; *app != NULL; app++)
-    {
-      for (ap = *app; ap != NULL; ap = ap->next)
-       {
-         if (ap->arch == arch
-             && (ap->mach == mach
-                 || (mach == 0 && ap->the_default)))
-           {
-             abfd->arch_info = ap;
-             return true;
-           }
-       }
-    }
+  abfd->arch_info = bfd_lookup_arch (arch, mach);
+  if (abfd->arch_info != NULL)
+    return true;
 
   abfd->arch_info = &bfd_default_arch_struct;
   bfd_set_error (bfd_error_bad_value);
index 93696aeec9f42bda2ca8182de89f5d5f0cbc8c63..a69b3750ae8507b514427f49113fd7b2671e7831 100644 (file)
@@ -1657,7 +1657,9 @@ typedef struct bfd_arch_info
   const char *arch_name;
   const char *printable_name;
   unsigned int section_align_power;
-  /* True if this is the default machine for the architecture.  */
+  /* True if this is the default machine for the architecture.
+     The default arch should be the first entry for an arch so that
+     all the entries for that arch can be accessed via <<next>>.  */
   boolean the_default;
   const struct bfd_arch_info * (*compatible)
        PARAMS ((const struct bfd_arch_info *a,
@@ -2194,55 +2196,6 @@ to compensate for the borrow when the low bits are added.  */
   BFD_RELOC_MIPS_REL16,
   BFD_RELOC_MIPS_RELGOT,
   BFD_RELOC_MIPS_JALR,
-  BFD_RELOC_SH_GOT_LOW16,
-  BFD_RELOC_SH_GOT_MEDLOW16,
-  BFD_RELOC_SH_GOT_MEDHI16,
-  BFD_RELOC_SH_GOT_HI16,
-  BFD_RELOC_SH_GOTPLT_LOW16,
-  BFD_RELOC_SH_GOTPLT_MEDLOW16,
-  BFD_RELOC_SH_GOTPLT_MEDHI16,
-  BFD_RELOC_SH_GOTPLT_HI16,
-  BFD_RELOC_SH_PLT_LOW16,
-  BFD_RELOC_SH_PLT_MEDLOW16,
-  BFD_RELOC_SH_PLT_MEDHI16,
-  BFD_RELOC_SH_PLT_HI16,
-  BFD_RELOC_SH_GOTOFF_LOW16,
-  BFD_RELOC_SH_GOTOFF_MEDLOW16,
-  BFD_RELOC_SH_GOTOFF_MEDHI16,
-  BFD_RELOC_SH_GOTOFF_HI16,
-  BFD_RELOC_SH_GOTPC_LOW16,
-  BFD_RELOC_SH_GOTPC_MEDLOW16,
-  BFD_RELOC_SH_GOTPC_MEDHI16,
-  BFD_RELOC_SH_GOTPC_HI16,
-  BFD_RELOC_SH_COPY64,
-  BFD_RELOC_SH_GLOB_DAT64,
-  BFD_RELOC_SH_JMP_SLOT64,
-  BFD_RELOC_SH_RELATIVE64,
-  BFD_RELOC_SH_GOT10BY4,
-  BFD_RELOC_SH_GOT10BY8,
-  BFD_RELOC_SH_GOTPLT10BY4,
-  BFD_RELOC_SH_GOTPLT10BY8,
-  BFD_RELOC_SH_GOTPLT32,
-  BFD_RELOC_SH_SHMEDIA_CODE,
-  BFD_RELOC_SH_IMMU5,
-  BFD_RELOC_SH_IMMS6,
-  BFD_RELOC_SH_IMMS6BY32,
-  BFD_RELOC_SH_IMMU6,
-  BFD_RELOC_SH_IMMS10,
-  BFD_RELOC_SH_IMMS10BY2,
-  BFD_RELOC_SH_IMMS10BY4,
-  BFD_RELOC_SH_IMMS10BY8,
-  BFD_RELOC_SH_IMMS16,
-  BFD_RELOC_SH_IMMU16,
-  BFD_RELOC_SH_IMM_LOW16,
-  BFD_RELOC_SH_IMM_LOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDLOW16,
-  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDHI16,
-  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
-  BFD_RELOC_SH_IMM_HI16,
-  BFD_RELOC_SH_IMM_HI16_PCREL,
-  BFD_RELOC_SH_PT_16,
 
 
 /* i386/elf relocations  */
@@ -2423,6 +2376,55 @@ field in the instruction.  */
   BFD_RELOC_SH_JMP_SLOT,
   BFD_RELOC_SH_RELATIVE,
   BFD_RELOC_SH_GOTPC,
+  BFD_RELOC_SH_GOT_LOW16,
+  BFD_RELOC_SH_GOT_MEDLOW16,
+  BFD_RELOC_SH_GOT_MEDHI16,
+  BFD_RELOC_SH_GOT_HI16,
+  BFD_RELOC_SH_GOTPLT_LOW16,
+  BFD_RELOC_SH_GOTPLT_MEDLOW16,
+  BFD_RELOC_SH_GOTPLT_MEDHI16,
+  BFD_RELOC_SH_GOTPLT_HI16,
+  BFD_RELOC_SH_PLT_LOW16,
+  BFD_RELOC_SH_PLT_MEDLOW16,
+  BFD_RELOC_SH_PLT_MEDHI16,
+  BFD_RELOC_SH_PLT_HI16,
+  BFD_RELOC_SH_GOTOFF_LOW16,
+  BFD_RELOC_SH_GOTOFF_MEDLOW16,
+  BFD_RELOC_SH_GOTOFF_MEDHI16,
+  BFD_RELOC_SH_GOTOFF_HI16,
+  BFD_RELOC_SH_GOTPC_LOW16,
+  BFD_RELOC_SH_GOTPC_MEDLOW16,
+  BFD_RELOC_SH_GOTPC_MEDHI16,
+  BFD_RELOC_SH_GOTPC_HI16,
+  BFD_RELOC_SH_COPY64,
+  BFD_RELOC_SH_GLOB_DAT64,
+  BFD_RELOC_SH_JMP_SLOT64,
+  BFD_RELOC_SH_RELATIVE64,
+  BFD_RELOC_SH_GOT10BY4,
+  BFD_RELOC_SH_GOT10BY8,
+  BFD_RELOC_SH_GOTPLT10BY4,
+  BFD_RELOC_SH_GOTPLT10BY8,
+  BFD_RELOC_SH_GOTPLT32,
+  BFD_RELOC_SH_SHMEDIA_CODE,
+  BFD_RELOC_SH_IMMU5,
+  BFD_RELOC_SH_IMMS6,
+  BFD_RELOC_SH_IMMS6BY32,
+  BFD_RELOC_SH_IMMU6,
+  BFD_RELOC_SH_IMMS10,
+  BFD_RELOC_SH_IMMS10BY2,
+  BFD_RELOC_SH_IMMS10BY4,
+  BFD_RELOC_SH_IMMS10BY8,
+  BFD_RELOC_SH_IMMS16,
+  BFD_RELOC_SH_IMMU16,
+  BFD_RELOC_SH_IMM_LOW16,
+  BFD_RELOC_SH_IMM_LOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDLOW16,
+  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDHI16,
+  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
+  BFD_RELOC_SH_IMM_HI16,
+  BFD_RELOC_SH_IMM_HI16_PCREL,
+  BFD_RELOC_SH_PT_16,
 
 /* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
 be zero and is not stored in the instruction.  */
index 72690d573974399197b00ee0c94f5a41a4df8ccd..5c6704f34ecc7e55d26c7cbb6b3dfbbc8f30c836 100644 (file)
@@ -3014,6 +3014,7 @@ coff_compute_section_file_positions (abfd)
        else
          current->target_index = target_index++;
       }
+    abfd->section_tail = &current->next;
 
     free (section_list);
   }
index d812618749d430c246897910da1d2dedf15b67a2..d77b4260c1da151be8169013ac852816f2e90dca 100644 (file)
@@ -50,6 +50,65 @@ powerpc_compatible (a,b)
 
 const bfd_arch_info_type bfd_powerpc_archs[] =
 {
+#if BFD_DEFAULT_TARGET_SIZE == 64 /* default arch must come first.  */
+  {
+    64,        /* 64 bits in a word */
+    64,        /* 64 bits in an address */
+    8, /* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc64,
+    "powerpc",
+    "powerpc:common64",
+    3,
+    true, /* default for 64 bit target */
+    powerpc_compatible,
+    bfd_default_scan,
+    &bfd_powerpc_archs[1]
+  },
+  {
+    32,        /* 32 bits in a word */
+    32,        /* 32 bits in an address */
+    8, /* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
+    "powerpc",
+    "powerpc:common",
+    3,
+    false,
+    powerpc_compatible,
+    bfd_default_scan,
+    &bfd_powerpc_archs[2],
+  },
+#else
+  {
+    32,        /* 32 bits in a word */
+    32,        /* 32 bits in an address */
+    8, /* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
+    "powerpc",
+    "powerpc:common",
+    3,
+    true, /* default for 32 bit target */
+    powerpc_compatible,
+    bfd_default_scan,
+    &bfd_powerpc_archs[1],
+  },
+  {
+    64,        /* 64 bits in a word */
+    64,        /* 64 bits in an address */
+    8, /* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc64,
+    "powerpc",
+    "powerpc:common64",
+    3,
+    false,
+    powerpc_compatible,
+    bfd_default_scan,
+    &bfd_powerpc_archs[2]
+  },
+#endif
   {
     32,        /* 32 bits in a word */
     32,        /* 32 bits in an address */
@@ -62,7 +121,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[1]
+    &bfd_powerpc_archs[3]
   },
   {
     32,        /* 32 bits in a word */
@@ -76,7 +135,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[2]
+    &bfd_powerpc_archs[4]
   },
   {
     32,        /* 32 bits in a word */
@@ -90,7 +149,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[3]
+    &bfd_powerpc_archs[5]
   },
   {
     32,        /* 32 bits in a word */
@@ -104,7 +163,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[4]
+    &bfd_powerpc_archs[6]
   },
   {
     32,        /* 32 bits in a word */
@@ -118,7 +177,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[5]
+    &bfd_powerpc_archs[7]
   },
   {
     64,        /* 64 bits in a word */
@@ -132,7 +191,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[6]
+    &bfd_powerpc_archs[8]
   },
   {
     64,        /* 64 bits in a word */
@@ -146,7 +205,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[7]
+    &bfd_powerpc_archs[9]
   },
   {
     64,        /* 64 bits in a word */
@@ -160,7 +219,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[8]
+    &bfd_powerpc_archs[10]
   },
   {
     64,        /* 64 bits in a word */
@@ -174,7 +233,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[9]
+    &bfd_powerpc_archs[11]
   },
   {
     64,        /* 64 bits in a word */
@@ -188,7 +247,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[10]
+    &bfd_powerpc_archs[12]
   },
   {
     32,        /* 32 bits in a word */
@@ -202,7 +261,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[11]
+    &bfd_powerpc_archs[13]
   },
   {
     32,       /* 32 bits in a word */
@@ -216,34 +275,6 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     false, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
-    &bfd_powerpc_archs[12]
-  },
-  {
-    64,        /* 64 bits in a word */
-    64,        /* 64 bits in an address */
-    8, /* 8 bits in a byte */
-    bfd_arch_powerpc,
-    bfd_mach_ppc64,
-    "powerpc",
-    "powerpc:common64",
-    3,
-    BFD_DEFAULT_TARGET_SIZE == 64, /* default for 64 bit target */
-    powerpc_compatible,
-    bfd_default_scan,
-    &bfd_powerpc_archs[13]
-  },
-  {
-    32,        /* 32 bits in a word */
-    32,        /* 32 bits in an address */
-    8, /* 8 bits in a byte */
-    bfd_arch_powerpc,
-    bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
-    "powerpc",
-    "powerpc:common",
-    3,
-    BFD_DEFAULT_TARGET_SIZE != 64, /* default for 32 bit target */
-    powerpc_compatible,
-    bfd_default_scan,
     0
   }
 };
index 63d95c5016ed32a828bbfe912d087d87d7f2319a..99a66f4e1807397e46eb892fa3beec20b55b5e2a 100644 (file)
@@ -64,6 +64,12 @@ static boolean elf_hppa_fake_sections
 static void elf_hppa_final_write_processing
   PARAMS ((bfd *, boolean));
 
+static int hppa_unwind_entry_compare
+  PARAMS ((const PTR, const PTR));
+
+static boolean elf_hppa_sort_unwind
+  PARAMS ((bfd *));
+
 #if ARCH_SIZE == 64
 static boolean elf_hppa_add_symbol_hook
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
@@ -86,12 +92,12 @@ static boolean elf_hppa_final_link
 
 static boolean elf_hppa_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-           bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+          bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 
 static bfd_reloc_status_type elf_hppa_final_link_relocate
   PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
-           bfd_byte *, bfd_vma, struct bfd_link_info *,
-           asection *, struct elf_link_hash_entry *,
+          bfd_byte *, bfd_vma, struct bfd_link_info *,
+          asection *, struct elf_link_hash_entry *,
           struct elf64_hppa_dyn_hash_entry *));
 
 static int elf_hppa_relocate_insn
@@ -709,7 +715,7 @@ elf_hppa_reloc_final_type (abfd, base_type, format, field)
                 be a section relative relocation.  Dwarf2 (for example)
                 uses 32bit section relative relocations.  */
              if (bfd_get_arch_info (abfd)->bits_per_address != 32)
-               final_type = R_PARISC_SECREL32;
+               final_type = R_PARISC_SECREL32;
              break;
            case e_psel:
              final_type = R_PARISC_PLABEL32;
@@ -1037,6 +1043,64 @@ elf_hppa_final_write_processing (abfd, linker)
                                      | EF_PARISC_TRAPNIL);
 }
 
+/* Comparison function for qsort to sort unwind section during a
+   final link.  */
+
+static int
+hppa_unwind_entry_compare (a, b)
+     const PTR a;
+     const PTR b;
+{
+  const bfd_byte *ap, *bp;
+  unsigned long av, bv;
+
+  ap = (const bfd_byte *) a;
+  av = (unsigned long) ap[0] << 24;
+  av |= (unsigned long) ap[1] << 16;
+  av |= (unsigned long) ap[2] << 8;
+  av |= (unsigned long) ap[3];
+
+  bp = (const bfd_byte *) b;
+  bv = (unsigned long) bp[0] << 24;
+  bv |= (unsigned long) bp[1] << 16;
+  bv |= (unsigned long) bp[2] << 8;
+  bv |= (unsigned long) bp[3];
+
+  return av < bv ? -1 : av > bv ? 1 : 0;
+}
+
+static boolean elf_hppa_sort_unwind (abfd)
+     bfd *abfd;
+{
+  asection *s;
+
+  /* Magic section names, but this is much safer than having
+     relocate_section remember where SEGREL32 relocs occurred.
+     Consider what happens if someone inept creates a linker script
+     that puts unwind information in .text.  */
+  s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
+  if (s != NULL)
+    {
+      bfd_size_type size;
+      char *contents;
+
+      size = s->_raw_size;
+      contents = bfd_malloc (size);
+      if (contents == NULL)
+       return false;
+
+      if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size))
+       return false;
+
+      qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
+
+      if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
+       return false;
+    }
+
+  return true;
+}
+
 #if ARCH_SIZE == 64
 /* Hook called by the linker routine which adds symbols from an object
    file.  HP's libraries define symbols with HP specific section
@@ -1284,6 +1348,11 @@ elf_hppa_final_link (abfd, info)
                          elf_hppa_remark_useless_dynamic_symbols,
                          info);
 
+  /* If we're producing a final executable, sort the contents of the
+     unwind section. */
+  if (retval)
+    retval = elf_hppa_sort_unwind (abfd);
+
   return retval;
 }
 
@@ -1416,7 +1485,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
                relocation = 0;
            }
          /* Allow undefined symbols in shared libraries.  */
-          else if (info->shared && !info->no_undefined
+         else if (info->shared && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            {
              if (info->symbolic)
@@ -2006,7 +2075,7 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
          }
 
        /* We want the value of the OPD offset for this symbol, not
-           the symbol's actual address.  */
+          the symbol's actual address.  */
        value = (dyn_h->opd_offset
                 + hppa_info->opd_sec->output_offset
                 + hppa_info->opd_sec->output_section->vma);
@@ -2047,7 +2116,7 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
          bfd_put_32 (input_bfd, value, hit_data);
        else
          bfd_put_64 (input_bfd, value, hit_data);
-        return bfd_reloc_ok;
+       return bfd_reloc_ok;
       }
 
     /* Something we don't know how to handle.  */
index a8d0a446099db5ee67e3848d6773e46ef1250812..ec65f92e6dd7022b49f7039a976c4990324aa57c 100644 (file)
@@ -71,14 +71,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    (single sub-space version)
    :           addil LR'lt_ptr+ltoff,%dp       ; get procedure entry point
    :           ldw RR'lt_ptr+ltoff(%r1),%r21
-   :            bv %r0(%r21)
+   :           bv %r0(%r21)
    :           ldw RR'lt_ptr+ltoff+4(%r1),%r19 ; get new dlt value.
 
    Import stub to call shared library routine from shared library
    (single sub-space version)
    :           addil LR'ltoff,%r19             ; get procedure entry point
    :           ldw RR'ltoff(%r1),%r21
-   :            bv %r0(%r21)
+   :           bv %r0(%r21)
    :           ldw RR'ltoff+4(%r1),%r19        ; get new dlt value.
 
    Import stub to call shared library routine from normal object file
@@ -203,9 +203,6 @@ struct elf32_hppa_link_hash_entry {
 #endif
   } *dyn_relocs;
 
-  /* Set during a static link if we detect a function is PIC.  */
-  unsigned int maybe_pic_call:1;
-
   /* Set if the only reason we need a .plt entry is for a non-PIC to
      PIC function call.  */
   unsigned int pic_call:1;
@@ -255,10 +252,11 @@ struct elf32_hppa_link_hash_table {
   /* Whether we support multiple sub-spaces for shared libs.  */
   unsigned int multi_subspace:1;
 
-  /* Flags set when PCREL12F and PCREL17F branches detected.  Used to
+  /* Flags set when various size branches are detected.  Used to
      select suitable defaults for the stub group size.  */
   unsigned int has_12bit_branch:1;
   unsigned int has_17bit_branch:1;
+  unsigned int has_22bit_branch:1;
 
   /* Set if we need a .plt stub to support lazy dynamic linking.  */
   unsigned int need_plt_stub:1;
@@ -373,9 +371,6 @@ static boolean elf32_hppa_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
           bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 
-static int hppa_unwind_entry_compare
-  PARAMS ((const PTR, const PTR));
-
 static boolean elf32_hppa_finish_dynamic_symbol
   PARAMS ((bfd *, struct bfd_link_info *,
           struct elf_link_hash_entry *, Elf_Internal_Sym *));
@@ -460,7 +455,6 @@ hppa_link_hash_newfunc (entry, table, string)
       eh = (struct elf32_hppa_link_hash_entry *) entry;
       eh->stub_cache = NULL;
       eh->dyn_relocs = NULL;
-      eh->maybe_pic_call = 0;
       eh->pic_call = 0;
       eh->plabel = 0;
     }
@@ -508,6 +502,7 @@ elf32_hppa_link_hash_table_create (abfd)
   ret->multi_subspace = 0;
   ret->has_12bit_branch = 0;
   ret->has_17bit_branch = 0;
+  ret->has_22bit_branch = 0;
   ret->need_plt_stub = 0;
   ret->sym_sec.abfd = NULL;
 
@@ -670,21 +665,12 @@ hppa_type_of_stub (input_sec, rel, hash, destination)
   unsigned int r_type;
 
   if (hash != NULL
-      && (((hash->elf.root.type == bfd_link_hash_defined
-           || hash->elf.root.type == bfd_link_hash_defweak)
-          && hash->elf.root.u.def.section->output_section == NULL)
-         || (hash->elf.root.type == bfd_link_hash_defweak
-             && hash->elf.dynindx != -1
-             && hash->elf.plt.offset != (bfd_vma) -1)
-         || hash->elf.root.type == bfd_link_hash_undefweak
-         || hash->elf.root.type == bfd_link_hash_undefined
-         || (hash->maybe_pic_call && !(input_sec->flags & SEC_HAS_GOT_REF))))
+      && hash->elf.plt.offset != (bfd_vma) -1
+      && (hash->elf.dynindx != -1 || hash->pic_call)
+      && !hash->plabel)
     {
-      /* If output_section is NULL, then it's a symbol defined in a
-        shared library.  We will need an import stub.  Decide between
-        hppa_stub_import and hppa_stub_import_shared later.  For
-        shared links we need stubs for undefined or weak syms too;
-        They will presumably be resolved by the dynamic linker.  */
+      /* We need an import stub.  Decide between hppa_stub_import
+        and hppa_stub_import_shared later.  */
       return hppa_stub_import;
     }
 
@@ -742,6 +728,7 @@ hppa_type_of_stub (input_sec, rel, hash, destination)
 #define BE_SR0_R21     0xe2a00000      /* be    0(%sr0,%r21)           */
 #define STW_RP         0x6bc23fd1      /* stw   %rp,-24(%sr0,%sp)      */
 
+#define BL22_RP                0xe800a002      /* b,l,n XXX,%rp                */
 #define BL_RP          0xe8400002      /* b,l,n XXX,%rp                */
 #define NOP            0x08000240      /* nop                          */
 #define LDW_RP         0x4bc23fd1      /* ldw   -24(%sr0,%sp),%rp      */
@@ -931,7 +918,9 @@ hppa_build_one_stub (gen_entry, in_arg)
                    + stub_sec->output_offset
                    + stub_sec->output_section->vma);
 
-      if (sym_value - 8 + 0x40000 >= 0x80000)
+      if (sym_value - 8 + (1 << (17 + 1)) >= (1 << (17 + 2))
+         && (!htab->has_22bit_branch
+             || sym_value - 8 + (1 << (22 + 1)) >= (1 << (22 + 2))))
        {
          (*_bfd_error_handler)
            (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"),
@@ -944,7 +933,10 @@ hppa_build_one_stub (gen_entry, in_arg)
        }
 
       val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_fsel) >> 2;
-      insn = hppa_rebuild_insn ((int) BL_RP, val, 17);
+      if (!htab->has_22bit_branch)
+       insn = hppa_rebuild_insn ((int) BL_RP, val, 17);
+      else
+       insn = hppa_rebuild_insn ((int) BL22_RP, val, 22);
       bfd_put_32 (stub_bfd, insn, loc);
 
       bfd_put_32 (stub_bfd, (bfd_vma) NOP,         loc + 4);
@@ -1263,12 +1255,16 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
 
        case R_PARISC_PCREL12F:
          htab->has_12bit_branch = 1;
-         /* Fall thru.  */
+         goto branch_common;
+
        case R_PARISC_PCREL17C:
        case R_PARISC_PCREL17F:
          htab->has_17bit_branch = 1;
-         /* Fall thru.  */
+         goto branch_common;
+
        case R_PARISC_PCREL22F:
+         htab->has_22bit_branch = 1;
+       branch_common:
          /* Function calls might need to go through the .plt, and
             might require long branch stubs.  */
          if (h == NULL)
@@ -1322,7 +1318,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
        case R_PARISC_DIR14F: /* Used for load/store from absolute locn.  */
        case R_PARISC_DIR14R:
        case R_PARISC_DIR21L: /* As above, and for ext branches too.  */
-#if 1
+#if 0
          /* Help debug shared library creation.  Any of the above
             relocs can be used in shared libs, but they may cause
             pages to become unshared.  */
@@ -1838,19 +1834,10 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
   unsigned int power_of_two;
 
   /* If this is a function, put it in the procedure linkage table.  We
-     will fill in the contents of the procedure linkage table later,
-     when we know the address of the .got section.  */
+     will fill in the contents of the procedure linkage table later.  */
   if (h->type == STT_FUNC
       || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
-      if (!info->shared
-         && h->plt.refcount > 0
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
-         && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0)
-       {
-         ((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call = 1;
-       }
-
       if (h->plt.refcount <= 0
          || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
              && h->root.type != bfd_link_hash_defweak
@@ -1867,7 +1854,10 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
 
          /* As a special sop to the hppa ABI, we keep a .plt entry
             for functions in sections containing PIC code.  */
-         if (((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call)
+         if (!info->shared
+             && h->plt.refcount > 0
+             && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+             && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0)
            ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1;
          else
            {
@@ -1918,7 +1908,7 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
     }
 
   /* If we didn't find any dynamic relocs in read-only sections, then
-     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */ 
+     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
   if (p == NULL)
     {
       h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
@@ -1996,7 +1986,6 @@ mark_PIC_calls (h, inf)
     }
 
   h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-  ((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call = 1;
   ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1;
 
   return true;
@@ -2026,6 +2015,7 @@ allocate_plt_static (h, inf)
     {
       /* Make an entry in the .plt section for non-pic code that is
         calling pic code.  */
+      ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0;
       s = htab->splt;
       h->plt.offset = s->_raw_size;
       s->_raw_size += PLT_ENTRY_SIZE;
@@ -2045,7 +2035,11 @@ allocate_plt_static (h, inf)
 
       if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
        {
-         /* Allocate these later.  */
+         /* Allocate these later.  From this point on, h->plabel
+            means that the plt entry is only used by a plabel.
+            We'll be using a normal plt entry for this symbol, so
+            clear the plabel indicator.  */
+         ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0;
        }
       else if (((struct elf32_hppa_link_hash_entry *) h)->plabel)
        {
@@ -2096,7 +2090,7 @@ allocate_dynrelocs (h, inf)
   if (htab->elf.dynamic_sections_created
       && h->plt.offset != (bfd_vma) -1
       && !((struct elf32_hppa_link_hash_entry *) h)->pic_call
-      && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      && !((struct elf32_hppa_link_hash_entry *) h)->plabel)
     {
       /* Make an entry in the .plt section.  */
       s = htab->splt;
@@ -3267,37 +3261,13 @@ elf32_hppa_final_link (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  asection *s;
-
   /* Invoke the regular ELF linker to do all the work.  */
   if (!bfd_elf32_bfd_final_link (abfd, info))
     return false;
 
   /* If we're producing a final executable, sort the contents of the
-     unwind section.  Magic section names, but this is much safer than
-     having elf32_hppa_relocate_section remember where SEGREL32 relocs
-     occurred.  Consider what happens if someone inept creates a
-     linker script that puts unwind information in .text.  */
-  s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
-  if (s != NULL)
-    {
-      bfd_size_type size;
-      char *contents;
-
-      size = s->_raw_size;
-      contents = bfd_malloc (size);
-      if (contents == NULL)
-       return false;
-
-      if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size))
-       return false;
-
-      qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
-
-      if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
-       return false;
-    }
-  return true;
+     unwind section.  */
+  return elf_hppa_sort_unwind (abfd);
 }
 
 /* Record the lowest address for the data and text segments.  */
@@ -3370,19 +3340,14 @@ final_link_relocate (input_section, contents, rel, value, htab, sym_sec, h)
     case R_PARISC_PCREL12F:
     case R_PARISC_PCREL17F:
     case R_PARISC_PCREL22F:
-      /* If this is a call to a function defined in another dynamic
-        library, or if it is a call to a PIC function in the same
-        object, or if this is a shared link and it is a call to a
-        weak symbol which may or may not be in the same object, then
-        find the import stub in the stub hash.  */
+      /* If this call should go via the plt, find the import stub in
+        the stub hash.  */
       if (sym_sec == NULL
          || sym_sec->output_section == NULL
          || (h != NULL
-             && ((h->maybe_pic_call
-                  && !(input_section->flags & SEC_HAS_GOT_REF))
-                 || (h->elf.root.type == bfd_link_hash_defweak
-                     && h->elf.dynindx != -1
-                     && h->elf.plt.offset != (bfd_vma) -1))))
+             && h->elf.plt.offset != (bfd_vma) -1
+             && (h->elf.dynindx != -1 || h->pic_call)
+             && !h->plabel))
        {
          stub_entry = hppa_get_stub_entry (input_section, sym_sec,
                                            h, rel, htab);
@@ -3437,7 +3402,7 @@ final_link_relocate (input_section, contents, rel, value, htab, sym_sec, h)
              == (((int) OP_ADDIL << 26) | (27 << 21)))
            {
              insn &= ~ (0x1f << 21);
-#if 1 /* debug them.  */
+#if 0 /* debug them.  */
              (*_bfd_error_handler)
                (_("%s(%s+0x%lx): fixing %s"),
                 bfd_archive_filename (input_bfd),
@@ -4108,32 +4073,6 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
   return true;
 }
 
-/* Comparison function for qsort to sort unwind section during a
-   final link.  */
-
-static int
-hppa_unwind_entry_compare (a, b)
-     const PTR a;
-     const PTR b;
-{
-  const bfd_byte *ap, *bp;
-  unsigned long av, bv;
-
-  ap = (const bfd_byte *) a;
-  av = (unsigned long) ap[0] << 24;
-  av |= (unsigned long) ap[1] << 16;
-  av |= (unsigned long) ap[2] << 8;
-  av |= (unsigned long) ap[3];
-
-  bp = (const bfd_byte *) b;
-  bv = (unsigned long) bp[0] << 24;
-  bv |= (unsigned long) bp[1] << 16;
-  bv |= (unsigned long) bp[2] << 8;
-  bv |= (unsigned long) bp[3];
-
-  return av < bv ? -1 : av > bv ? 1 : 0;
-}
-
 /* Finish up dynamic symbol handling.  We set the contents of various
    dynamic sections here.  */
 
index 1ce1827acae511bdd4feb443076596f7f06e8b77..b3b6220489369a48ae43b88e5965f3c0ae0a902e 100644 (file)
@@ -838,7 +838,8 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
 {
   if (! info->relocateable
       && (*namep)[0] == '_' && (*namep)[1] == 'S'
-      && strcmp (*namep, "_SDA_BASE_") == 0)
+      && strcmp (*namep, "_SDA_BASE_") == 0
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       /* This is simpler than using _bfd_elf_create_linker_section
         (our needs are simpler than ppc's needs).  Also
index be6cfabb19508943553f0f2530ddef5af6582b20..9549d29367e9847b2e264ede75c0777d635a4938 100644 (file)
@@ -2542,7 +2542,8 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
 {
   if (sym->st_shndx == SHN_COMMON
       && !info->relocateable
-      && sym->st_size <= elf_gp_size (abfd))
+      && sym->st_size <= elf_gp_size (abfd)
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       /* Common symbols less than or equal to -G nn bytes are automatically
         put into .sdata.  */
index 5c85d36c2dd29bd3a90ddae3479d2ecc174448af..5e7ccdd68223b57819623e164ba8a35592a5c9c1 100644 (file)
@@ -389,7 +389,8 @@ sh64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd_vma *valp;
 {
   /* We want to do this for relocatable as well as final linking.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
+  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       struct elf_link_hash_entry *h;
 
index 3bda435c987cc9727fc94752bfaf1a6531d9c924..96146ed016e2fdaec00af44561d35d96bce654c1 100644 (file)
@@ -1953,16 +1953,16 @@ mmix_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
                       strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0)
     {
       /* See if we have another one.  */
-      struct elf_link_hash_entry *h
-       = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash,
-                                                              *namep,
-                                                              false,
-                                                              false, false);
+      struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,
+                                                           *namep,
+                                                           false,
+                                                           false,
+                                                           false);
 
-      if (h != NULL && h->root.type != bfd_link_hash_undefined)
+      if (h != NULL && h->type != bfd_link_hash_undefined)
        {
          /* How do we get the asymbol (or really: the filename) from h?
-            h->root.u.def.section->owner is NULL.  */
+            h->u.def.section->owner is NULL.  */
          ((*_bfd_error_handler)
           (_("%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n"),
            bfd_get_filename (abfd), *namep,
index dee4a44d97aea387d56696046b812d1c3d3f7bf5..7b91b9df5e11cfa28da6086cbe7227fabdc00223 100644 (file)
@@ -2929,7 +2929,8 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd_vma *valp;
 {
   /* We want to do this for relocatable as well as final linking.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
+  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       struct elf_link_hash_entry *h;
 
index 78d2a560f67b4472ce8ce73c666cc6276134ce42..d04a1d3b58044e2bedf33303ee2c67bd39024448 100644 (file)
@@ -1,5 +1,5 @@
 /* SPARC-specific support for 64-bit ELF
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -1385,9 +1385,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
       *namep = NULL;
       return true;
     }
-  else if (! *namep || ! **namep)
-    return true;
-  else
+  else if (*namep && **namep
+          && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       int i;
       struct sparc64_elf_app_reg *p;
index d43d8612d15edfbfd8332e8df2a6b333d3fc8f58..06035b31beeed603c852163826306286379aaa96 100644 (file)
@@ -5347,21 +5347,11 @@ elf_bfd_final_link (abfd, info)
     {
       for (p = o->link_order_head; p != NULL; p = p->next)
        {
-         Elf_Internal_Shdr *rhdr;
-
          if (p->type == bfd_indirect_link_order
-             && (bfd_get_flavour (p->u.indirect.section->owner)
+             && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
                  == bfd_target_elf_flavour)
-             && (((rhdr = &elf_section_data (p->u.indirect.section)->rel_hdr)
-                  ->sh_entsize == 0)
-                 || rhdr->sh_entsize == sizeof (Elf_External_Rel)
-                 || rhdr->sh_entsize == sizeof (Elf_External_Rela))
-             && (((rhdr = elf_section_data (p->u.indirect.section)->rel_hdr2)
-                  == NULL)
-                 || rhdr->sh_entsize == sizeof (Elf_External_Rel)
-                 || rhdr->sh_entsize == sizeof (Elf_External_Rela)))
+             && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
            {
-             sub = p->u.indirect.section->owner;
              if (! sub->output_has_begun)
                {
                  if (! elf_link_input_bfd (&finfo, sub))
index e7ba1c58e4f102e05b4b583f5bb738235a273aa4..55d192cc048cebbdcdbeb9b1a74deff95828c3f0 100644 (file)
@@ -752,55 +752,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_MIPS_REL16",
   "BFD_RELOC_MIPS_RELGOT",
   "BFD_RELOC_MIPS_JALR",
-  "BFD_RELOC_SH_GOT_LOW16",
-  "BFD_RELOC_SH_GOT_MEDLOW16",
-  "BFD_RELOC_SH_GOT_MEDHI16",
-  "BFD_RELOC_SH_GOT_HI16",
-  "BFD_RELOC_SH_GOTPLT_LOW16",
-  "BFD_RELOC_SH_GOTPLT_MEDLOW16",
-  "BFD_RELOC_SH_GOTPLT_MEDHI16",
-  "BFD_RELOC_SH_GOTPLT_HI16",
-  "BFD_RELOC_SH_PLT_LOW16",
-  "BFD_RELOC_SH_PLT_MEDLOW16",
-  "BFD_RELOC_SH_PLT_MEDHI16",
-  "BFD_RELOC_SH_PLT_HI16",
-  "BFD_RELOC_SH_GOTOFF_LOW16",
-  "BFD_RELOC_SH_GOTOFF_MEDLOW16",
-  "BFD_RELOC_SH_GOTOFF_MEDHI16",
-  "BFD_RELOC_SH_GOTOFF_HI16",
-  "BFD_RELOC_SH_GOTPC_LOW16",
-  "BFD_RELOC_SH_GOTPC_MEDLOW16",
-  "BFD_RELOC_SH_GOTPC_MEDHI16",
-  "BFD_RELOC_SH_GOTPC_HI16",
-  "BFD_RELOC_SH_COPY64",
-  "BFD_RELOC_SH_GLOB_DAT64",
-  "BFD_RELOC_SH_JMP_SLOT64",
-  "BFD_RELOC_SH_RELATIVE64",
-  "BFD_RELOC_SH_GOT10BY4",
-  "BFD_RELOC_SH_GOT10BY8",
-  "BFD_RELOC_SH_GOTPLT10BY4",
-  "BFD_RELOC_SH_GOTPLT10BY8",
-  "BFD_RELOC_SH_GOTPLT32",
-  "BFD_RELOC_SH_SHMEDIA_CODE",
-  "BFD_RELOC_SH_IMMU5",
-  "BFD_RELOC_SH_IMMS6",
-  "BFD_RELOC_SH_IMMS6BY32",
-  "BFD_RELOC_SH_IMMU6",
-  "BFD_RELOC_SH_IMMS10",
-  "BFD_RELOC_SH_IMMS10BY2",
-  "BFD_RELOC_SH_IMMS10BY4",
-  "BFD_RELOC_SH_IMMS10BY8",
-  "BFD_RELOC_SH_IMMS16",
-  "BFD_RELOC_SH_IMMU16",
-  "BFD_RELOC_SH_IMM_LOW16",
-  "BFD_RELOC_SH_IMM_LOW16_PCREL",
-  "BFD_RELOC_SH_IMM_MEDLOW16",
-  "BFD_RELOC_SH_IMM_MEDLOW16_PCREL",
-  "BFD_RELOC_SH_IMM_MEDHI16",
-  "BFD_RELOC_SH_IMM_MEDHI16_PCREL",
-  "BFD_RELOC_SH_IMM_HI16",
-  "BFD_RELOC_SH_IMM_HI16_PCREL",
-  "BFD_RELOC_SH_PT_16",
 
   "BFD_RELOC_386_GOT32",
   "BFD_RELOC_386_PLT32",
@@ -947,6 +898,55 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_SH_JMP_SLOT",
   "BFD_RELOC_SH_RELATIVE",
   "BFD_RELOC_SH_GOTPC",
+  "BFD_RELOC_SH_GOT_LOW16",
+  "BFD_RELOC_SH_GOT_MEDLOW16",
+  "BFD_RELOC_SH_GOT_MEDHI16",
+  "BFD_RELOC_SH_GOT_HI16",
+  "BFD_RELOC_SH_GOTPLT_LOW16",
+  "BFD_RELOC_SH_GOTPLT_MEDLOW16",
+  "BFD_RELOC_SH_GOTPLT_MEDHI16",
+  "BFD_RELOC_SH_GOTPLT_HI16",
+  "BFD_RELOC_SH_PLT_LOW16",
+  "BFD_RELOC_SH_PLT_MEDLOW16",
+  "BFD_RELOC_SH_PLT_MEDHI16",
+  "BFD_RELOC_SH_PLT_HI16",
+  "BFD_RELOC_SH_GOTOFF_LOW16",
+  "BFD_RELOC_SH_GOTOFF_MEDLOW16",
+  "BFD_RELOC_SH_GOTOFF_MEDHI16",
+  "BFD_RELOC_SH_GOTOFF_HI16",
+  "BFD_RELOC_SH_GOTPC_LOW16",
+  "BFD_RELOC_SH_GOTPC_MEDLOW16",
+  "BFD_RELOC_SH_GOTPC_MEDHI16",
+  "BFD_RELOC_SH_GOTPC_HI16",
+  "BFD_RELOC_SH_COPY64",
+  "BFD_RELOC_SH_GLOB_DAT64",
+  "BFD_RELOC_SH_JMP_SLOT64",
+  "BFD_RELOC_SH_RELATIVE64",
+  "BFD_RELOC_SH_GOT10BY4",
+  "BFD_RELOC_SH_GOT10BY8",
+  "BFD_RELOC_SH_GOTPLT10BY4",
+  "BFD_RELOC_SH_GOTPLT10BY8",
+  "BFD_RELOC_SH_GOTPLT32",
+  "BFD_RELOC_SH_SHMEDIA_CODE",
+  "BFD_RELOC_SH_IMMU5",
+  "BFD_RELOC_SH_IMMS6",
+  "BFD_RELOC_SH_IMMS6BY32",
+  "BFD_RELOC_SH_IMMU6",
+  "BFD_RELOC_SH_IMMS10",
+  "BFD_RELOC_SH_IMMS10BY2",
+  "BFD_RELOC_SH_IMMS10BY4",
+  "BFD_RELOC_SH_IMMS10BY8",
+  "BFD_RELOC_SH_IMMS16",
+  "BFD_RELOC_SH_IMMU16",
+  "BFD_RELOC_SH_IMM_LOW16",
+  "BFD_RELOC_SH_IMM_LOW16_PCREL",
+  "BFD_RELOC_SH_IMM_MEDLOW16",
+  "BFD_RELOC_SH_IMM_MEDLOW16_PCREL",
+  "BFD_RELOC_SH_IMM_MEDHI16",
+  "BFD_RELOC_SH_IMM_MEDHI16_PCREL",
+  "BFD_RELOC_SH_IMM_HI16",
+  "BFD_RELOC_SH_IMM_HI16_PCREL",
+  "BFD_RELOC_SH_PT_16",
   "BFD_RELOC_THUMB_PCREL_BRANCH9",
   "BFD_RELOC_THUMB_PCREL_BRANCH12",
   "BFD_RELOC_THUMB_PCREL_BRANCH23",
index 0b285d4b8ceda14e65696582d122e4971c36b4cf..31af2bd0c35ffff9ab99bffd801b0ea753d5ff23 100644 (file)
@@ -1,6 +1,6 @@
 /* opncls.c -- open and close a BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001
+   2001, 2002
    Free Software Foundation, Inc.
 
    Written by Cygnus Support.
@@ -618,7 +618,6 @@ bfd_make_readable(abfd)
   abfd->arch_info = &bfd_default_arch_struct;
 
   abfd->where = 0;
-  abfd->sections = (asection *) NULL;
   abfd->format = bfd_unknown;
   abfd->my_archive = (bfd *) NULL;
   abfd->origin = 0;
@@ -637,6 +636,7 @@ bfd_make_readable(abfd)
   abfd->outsymbols = 0;
   abfd->tdata.any = 0;
 
+  bfd_section_list_clear (abfd);
   bfd_check_format(abfd, bfd_object);
 
   return true;
index 559a351dfd74e6f901d42d34bd8fddda38aab069..c701fe0d4032c31293255b87a542cfffebcef34a 100644 (file)
@@ -2051,106 +2051,6 @@ ENUMX
   BFD_RELOC_MIPS_JALR
 COMMENT
 COMMENT
-ENUMX
-  BFD_RELOC_SH_GOT_LOW16
-ENUMX
-  BFD_RELOC_SH_GOT_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_GOT_MEDHI16
-ENUMX
-  BFD_RELOC_SH_GOT_HI16
-ENUMX
-  BFD_RELOC_SH_GOTPLT_LOW16
-ENUMX
-  BFD_RELOC_SH_GOTPLT_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_GOTPLT_MEDHI16
-ENUMX
-  BFD_RELOC_SH_GOTPLT_HI16
-ENUMX
-  BFD_RELOC_SH_PLT_LOW16
-ENUMX
-  BFD_RELOC_SH_PLT_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_PLT_MEDHI16
-ENUMX
-  BFD_RELOC_SH_PLT_HI16
-ENUMX
-  BFD_RELOC_SH_GOTOFF_LOW16
-ENUMX
-  BFD_RELOC_SH_GOTOFF_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_GOTOFF_MEDHI16
-ENUMX
-  BFD_RELOC_SH_GOTOFF_HI16
-ENUMX
-  BFD_RELOC_SH_GOTPC_LOW16
-ENUMX
-  BFD_RELOC_SH_GOTPC_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_GOTPC_MEDHI16
-ENUMX
-  BFD_RELOC_SH_GOTPC_HI16
-ENUMX
-  BFD_RELOC_SH_COPY64
-ENUMX
-  BFD_RELOC_SH_GLOB_DAT64
-ENUMX
-  BFD_RELOC_SH_JMP_SLOT64
-ENUMX
-  BFD_RELOC_SH_RELATIVE64
-ENUMX
-  BFD_RELOC_SH_GOT10BY4
-ENUMX
-  BFD_RELOC_SH_GOT10BY8
-ENUMX
-  BFD_RELOC_SH_GOTPLT10BY4
-ENUMX
-  BFD_RELOC_SH_GOTPLT10BY8
-ENUMX
-  BFD_RELOC_SH_GOTPLT32
-COMMENT
-ENUMX
-  BFD_RELOC_SH_SHMEDIA_CODE
-ENUMX
-  BFD_RELOC_SH_IMMU5
-ENUMX
-  BFD_RELOC_SH_IMMS6
-ENUMX
-  BFD_RELOC_SH_IMMS6BY32
-ENUMX
-  BFD_RELOC_SH_IMMU6
-ENUMX
-  BFD_RELOC_SH_IMMS10
-ENUMX
-  BFD_RELOC_SH_IMMS10BY2
-ENUMX
-  BFD_RELOC_SH_IMMS10BY4
-ENUMX
-  BFD_RELOC_SH_IMMS10BY8
-ENUMX
-  BFD_RELOC_SH_IMMS16
-ENUMX
-  BFD_RELOC_SH_IMMU16
-ENUMX
-  BFD_RELOC_SH_IMM_LOW16
-ENUMX
-  BFD_RELOC_SH_IMM_LOW16_PCREL
-ENUMX
-  BFD_RELOC_SH_IMM_MEDLOW16
-ENUMX
-  BFD_RELOC_SH_IMM_MEDLOW16_PCREL
-ENUMX
-  BFD_RELOC_SH_IMM_MEDHI16
-ENUMX
-  BFD_RELOC_SH_IMM_MEDHI16_PCREL
-ENUMX
-  BFD_RELOC_SH_IMM_HI16
-ENUMX
-  BFD_RELOC_SH_IMM_HI16_PCREL
-ENUMX
-  BFD_RELOC_SH_PT_16
-COMMENT
 ENUMDOC
   MIPS ELF relocations.
 
@@ -2487,6 +2387,104 @@ ENUMX
   BFD_RELOC_SH_RELATIVE
 ENUMX
   BFD_RELOC_SH_GOTPC
+ENUMX
+  BFD_RELOC_SH_GOT_LOW16
+ENUMX
+  BFD_RELOC_SH_GOT_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_GOT_MEDHI16
+ENUMX
+  BFD_RELOC_SH_GOT_HI16
+ENUMX
+  BFD_RELOC_SH_GOTPLT_LOW16
+ENUMX
+  BFD_RELOC_SH_GOTPLT_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_GOTPLT_MEDHI16
+ENUMX
+  BFD_RELOC_SH_GOTPLT_HI16
+ENUMX
+  BFD_RELOC_SH_PLT_LOW16
+ENUMX
+  BFD_RELOC_SH_PLT_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_PLT_MEDHI16
+ENUMX
+  BFD_RELOC_SH_PLT_HI16
+ENUMX
+  BFD_RELOC_SH_GOTOFF_LOW16
+ENUMX
+  BFD_RELOC_SH_GOTOFF_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_GOTOFF_MEDHI16
+ENUMX
+  BFD_RELOC_SH_GOTOFF_HI16
+ENUMX
+  BFD_RELOC_SH_GOTPC_LOW16
+ENUMX
+  BFD_RELOC_SH_GOTPC_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_GOTPC_MEDHI16
+ENUMX
+  BFD_RELOC_SH_GOTPC_HI16
+ENUMX
+  BFD_RELOC_SH_COPY64
+ENUMX
+  BFD_RELOC_SH_GLOB_DAT64
+ENUMX
+  BFD_RELOC_SH_JMP_SLOT64
+ENUMX
+  BFD_RELOC_SH_RELATIVE64
+ENUMX
+  BFD_RELOC_SH_GOT10BY4
+ENUMX
+  BFD_RELOC_SH_GOT10BY8
+ENUMX
+  BFD_RELOC_SH_GOTPLT10BY4
+ENUMX
+  BFD_RELOC_SH_GOTPLT10BY8
+ENUMX
+  BFD_RELOC_SH_GOTPLT32
+ENUMX
+  BFD_RELOC_SH_SHMEDIA_CODE
+ENUMX
+  BFD_RELOC_SH_IMMU5
+ENUMX
+  BFD_RELOC_SH_IMMS6
+ENUMX
+  BFD_RELOC_SH_IMMS6BY32
+ENUMX
+  BFD_RELOC_SH_IMMU6
+ENUMX
+  BFD_RELOC_SH_IMMS10
+ENUMX
+  BFD_RELOC_SH_IMMS10BY2
+ENUMX
+  BFD_RELOC_SH_IMMS10BY4
+ENUMX
+  BFD_RELOC_SH_IMMS10BY8
+ENUMX
+  BFD_RELOC_SH_IMMS16
+ENUMX
+  BFD_RELOC_SH_IMMU16
+ENUMX
+  BFD_RELOC_SH_IMM_LOW16
+ENUMX
+  BFD_RELOC_SH_IMM_LOW16_PCREL
+ENUMX
+  BFD_RELOC_SH_IMM_MEDLOW16
+ENUMX
+  BFD_RELOC_SH_IMM_MEDLOW16_PCREL
+ENUMX
+  BFD_RELOC_SH_IMM_MEDHI16
+ENUMX
+  BFD_RELOC_SH_IMM_MEDHI16_PCREL
+ENUMX
+  BFD_RELOC_SH_IMM_HI16
+ENUMX
+  BFD_RELOC_SH_IMM_HI16_PCREL
+ENUMX
+  BFD_RELOC_SH_PT_16
 ENUMDOC
   Hitachi SH relocs.  Not all of these appear in object files.
 
index a939b5cc3e30247384acf1ff94d0ea6ddabd86bf..2e5ca5dcfa139330ad5f897cf114e33e7f15717a 100644 (file)
@@ -2114,7 +2114,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
 
   /* Remove the sections from this object, so that they do not get
      included in the link.  */
-  abfd->sections = NULL;
+  bfd_section_list_clear (abfd);
 
   bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);