]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/elflink.h
Fix the behaviour of --allow-shlib-undefined, so that it does what it claims
[thirdparty/binutils-gdb.git] / bfd / elflink.h
index c94519478288ee4a3848b0f748da3f61892096c0..e034e36c777db7d97ec6ffd944da7b3a05b534b1 100644 (file)
@@ -1,22 +1,22 @@
 /* ELF linker support.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* ELF linker code.  */
 
@@ -25,49 +25,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 struct elf_info_failed
 {
-  boolean failed;
+  bfd_boolean failed;
   struct bfd_link_info *info;
   struct bfd_elf_version_tree *verdefs;
 };
 
-static boolean is_global_data_symbol_definition
+static bfd_boolean is_global_data_symbol_definition
   PARAMS ((bfd *, Elf_Internal_Sym *));
-static boolean elf_link_is_defined_archive_symbol
+static bfd_boolean elf_link_is_defined_archive_symbol
   PARAMS ((bfd *, carsym *));
-static boolean elf_link_add_object_symbols
+static bfd_boolean elf_link_add_object_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_link_add_archive_symbols
+static bfd_boolean elf_link_add_archive_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_merge_symbol
+static bfd_boolean elf_merge_symbol
   PARAMS ((bfd *, struct bfd_link_info *, const char *,
           Elf_Internal_Sym *, asection **, bfd_vma *,
-          struct elf_link_hash_entry **, boolean *, boolean *,
-          boolean *, boolean));
-static boolean elf_add_default_symbol
+          struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *,
+          bfd_boolean *, bfd_boolean));
+static bfd_boolean elf_add_default_symbol
   PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
           const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
-          boolean *, boolean, boolean));
-static boolean elf_export_symbol
+          bfd_boolean *, bfd_boolean, bfd_boolean));
+static bfd_boolean elf_export_symbol
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_finalize_dynstr
+static bfd_boolean elf_finalize_dynstr
   PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_fix_symbol_flags
+static bfd_boolean elf_fix_symbol_flags
   PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *));
-static boolean elf_adjust_dynamic_symbol
+static bfd_boolean elf_adjust_dynamic_symbol
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_find_version_dependencies
+static bfd_boolean elf_link_find_version_dependencies
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_assign_sym_version
+static bfd_boolean elf_link_assign_sym_version
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_collect_hash_codes
+static bfd_boolean elf_collect_hash_codes
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_read_relocs_from_section
+static bfd_boolean elf_link_read_relocs_from_section
   PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
 static size_t compute_bucket_count
   PARAMS ((struct bfd_link_info *));
-static boolean elf_link_output_relocs
+static bfd_boolean elf_link_output_relocs
   PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
-static boolean elf_link_size_reloc_section
+static bfd_boolean elf_link_size_reloc_section
   PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
 static void elf_link_adjust_relocs
   PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int,
@@ -78,13 +78,13 @@ static int elf_link_sort_cmp2
   PARAMS ((const void *, const void *));
 static size_t elf_link_sort_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection **));
-static boolean elf_section_ignore_discarded_relocs
+static bfd_boolean elf_section_ignore_discarded_relocs
   PARAMS ((asection *));
 
 /* Given an ELF BFD, add symbols to the global hash table as
    appropriate.  */
 
-boolean
+bfd_boolean
 elf_bfd_link_add_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -97,12 +97,12 @@ elf_bfd_link_add_symbols (abfd, info)
       return elf_link_add_archive_symbols (abfd, info);
     default:
       bfd_set_error (bfd_error_wrong_format);
-      return false;
+      return FALSE;
     }
 }
 \f
-/* Return true iff this is a non-common, definition of a non-function symbol.  */
-static boolean
+/* Return TRUE iff this is a non-common, definition of a non-function symbol.  */
+static bfd_boolean
 is_global_data_symbol_definition (abfd, sym)
      bfd * abfd ATTRIBUTE_UNUSED;
      Elf_Internal_Sym * sym;
@@ -110,20 +110,20 @@ is_global_data_symbol_definition (abfd, sym)
   /* Local symbols do not count, but target specific ones might.  */
   if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
       && ELF_ST_BIND (sym->st_info) < STB_LOOS)
-    return false;
+    return FALSE;
 
   /* Function symbols do not count.  */
   if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
-    return false;
+    return FALSE;
 
   /* If the section is undefined, then so is the symbol.  */
   if (sym->st_shndx == SHN_UNDEF)
-    return false;
+    return FALSE;
 
   /* If the symbol is defined in the common section, then
      it is a common definition and so does not count.  */
   if (sym->st_shndx == SHN_COMMON)
-    return false;
+    return FALSE;
 
   /* If the symbol is in a target specific section then we
      must rely upon the backend to tell us what it is.  */
@@ -135,15 +135,15 @@ is_global_data_symbol_definition (abfd, sym)
        Instead for now assume that the definition is not global,
        Even if this is wrong, at least the linker will behave
        in the same way that it used to do.  */
-    return false;
+    return FALSE;
 
-  return true;
+  return TRUE;
 }
 
 /* Search the symbol table of the archive element of the archive ABFD
    whose archive map contains a mention of SYMDEF, and determine if
    the symbol is defined in this element.  */
-static boolean
+static bfd_boolean
 elf_link_is_defined_archive_symbol (abfd, symdef)
      bfd * abfd;
      carsym * symdef;
@@ -155,21 +155,21 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
   Elf_Internal_Sym *isymbuf;
   Elf_Internal_Sym *isym;
   Elf_Internal_Sym *isymend;
-  boolean result;
+  bfd_boolean result;
 
   abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
   if (abfd == (bfd *) NULL)
-    return false;
+    return FALSE;
 
   if (! bfd_check_format (abfd, bfd_object))
-    return false;
+    return FALSE;
 
   /* If we have already included the element containing this symbol in the
      link then we do not need to include it again.  Just claim that any symbol
      it contains is not a definition, so that our caller will not decide to
      (re)include this element.  */
   if (abfd->archive_pass)
-    return false;
+    return FALSE;
 
   /* Select the appropriate symbol table.  */
   if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
@@ -193,16 +193,16 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
     }
 
   if (extsymcount == 0)
-    return false;
+    return FALSE;
 
   /* Read in the symbol table.  */
   isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
                                  NULL, NULL, NULL);
   if (isymbuf == NULL)
-    return false;
+    return FALSE;
 
   /* Scan the symbol table looking for SYMDEF.  */
-  result = false;
+  result = FALSE;
   for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
     {
       const char *name;
@@ -249,25 +249,25 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
    Unfortunately, we do have to make multiple passes over the symbol
    table until nothing further is resolved.  */
 
-static boolean
+static bfd_boolean
 elf_link_add_archive_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
   symindex c;
-  boolean *defined = NULL;
-  boolean *included = NULL;
+  bfd_boolean *defined = NULL;
+  bfd_boolean *included = NULL;
   carsym *symdefs;
-  boolean loop;
+  bfd_boolean loop;
   bfd_size_type amt;
 
   if (! bfd_has_map (abfd))
     {
       /* An empty archive is a special case.  */
       if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
-       return true;
+       return TRUE;
       bfd_set_error (bfd_error_no_armap);
-      return false;
+      return FALSE;
     }
 
   /* Keep track of all symbols we know to be already defined, and all
@@ -275,12 +275,12 @@ elf_link_add_archive_symbols (abfd, info)
      second and subsequent passes.  */
   c = bfd_ardata (abfd)->symdef_count;
   if (c == 0)
-    return true;
+    return TRUE;
   amt = c;
-  amt *= sizeof (boolean);
-  defined = (boolean *) bfd_zmalloc (amt);
-  included = (boolean *) bfd_zmalloc (amt);
-  if (defined == (boolean *) NULL || included == (boolean *) NULL)
+  amt *= sizeof (bfd_boolean);
+  defined = (bfd_boolean *) bfd_zmalloc (amt);
+  included = (bfd_boolean *) bfd_zmalloc (amt);
+  if (defined == (bfd_boolean *) NULL || included == (bfd_boolean *) NULL)
     goto error_return;
 
   symdefs = bfd_ardata (abfd)->symdefs;
@@ -292,7 +292,7 @@ elf_link_add_archive_symbols (abfd, info)
       carsym *symdef;
       carsym *symdefend;
 
-      loop = false;
+      loop = FALSE;
       last = -1;
 
       symdef = symdefs;
@@ -308,12 +308,12 @@ elf_link_add_archive_symbols (abfd, info)
            continue;
          if (symdef->file_offset == last)
            {
-             included[i] = true;
+             included[i] = TRUE;
              continue;
            }
 
          h = elf_link_hash_lookup (elf_hash_table (info), symdef->name,
-                                   false, false, false);
+                                   FALSE, FALSE, FALSE);
 
          if (h == NULL)
            {
@@ -340,7 +340,7 @@ elf_link_add_archive_symbols (abfd, info)
              memcpy (copy + first, symdef->name + first + 1, len - first);
 
              h = elf_link_hash_lookup (elf_hash_table (info), copy,
-                                       false, false, false);
+                                       FALSE, FALSE, FALSE);
 
              if (h == NULL)
                {
@@ -349,7 +349,7 @@ elf_link_add_archive_symbols (abfd, info)
 
                  copy[first - 1] = '\0';
                  h = elf_link_hash_lookup (elf_hash_table (info),
-                                           copy, false, false, false);
+                                           copy, FALSE, FALSE, FALSE);
                }
 
              bfd_release (abfd, copy);
@@ -378,7 +378,7 @@ elf_link_add_archive_symbols (abfd, info)
          else if (h->root.type != bfd_link_hash_undefined)
            {
              if (h->root.type != bfd_link_hash_undefweak)
-               defined[i] = true;
+               defined[i] = TRUE;
              continue;
            }
 
@@ -416,14 +416,14 @@ elf_link_add_archive_symbols (abfd, info)
             does not require another pass.  This isn't a bug, but it
             does make the code less efficient than it could be.  */
          if (undefs_tail != info->hash->undefs_tail)
-           loop = true;
+           loop = TRUE;
 
          /* Look backward to mark all symbols from this object file
             which we have already seen in this pass.  */
          mark = i;
          do
            {
-             included[mark] = true;
+             included[mark] = TRUE;
              if (mark == 0)
                break;
              --mark;
@@ -440,14 +440,14 @@ elf_link_add_archive_symbols (abfd, info)
   free (defined);
   free (included);
 
-  return true;
+  return TRUE;
 
  error_return:
-  if (defined != (boolean *) NULL)
+  if (defined != (bfd_boolean *) NULL)
     free (defined);
-  if (included != (boolean *) NULL)
+  if (included != (bfd_boolean *) NULL)
     free (included);
-  return false;
+  return FALSE;
 }
 
 /* This function is called when we want to define a new symbol.  It
@@ -462,7 +462,7 @@ elf_link_add_archive_symbols (abfd, info)
    change. DT_NEEDED indicates if it comes from a DT_NEEDED entry of
    a shared object.  */
 
-static boolean
+static bfd_boolean
 elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
                  override, type_change_ok, size_change_ok, dt_needed)
      bfd *abfd;
@@ -472,35 +472,35 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
      asection **psec;
      bfd_vma *pvalue;
      struct elf_link_hash_entry **sym_hash;
-     boolean *override;
-     boolean *type_change_ok;
-     boolean *size_change_ok;
-     boolean dt_needed;
+     bfd_boolean *override;
+     bfd_boolean *type_change_ok;
+     bfd_boolean *size_change_ok;
+     bfd_boolean dt_needed;
 {
   asection *sec;
   struct elf_link_hash_entry *h;
   int bind;
   bfd *oldbfd;
-  boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
+  bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
 
-  *override = false;
+  *override = FALSE;
 
   sec = *psec;
   bind = ELF_ST_BIND (sym->st_info);
 
   if (! bfd_is_und_section (sec))
-    h = elf_link_hash_lookup (elf_hash_table (info), name, true, false, false);
+    h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
   else
     h = ((struct elf_link_hash_entry *)
-        bfd_wrapped_link_hash_lookup (abfd, info, name, true, false, false));
+        bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, FALSE, FALSE));
   if (h == NULL)
-    return false;
+    return FALSE;
   *sym_hash = h;
 
   /* This code is for coping with dynamic objects, and is only useful
      if we are doing an ELF link.  */
   if (info->hash->creator != abfd->xvec)
-    return true;
+    return TRUE;
 
   /* For merging, we only care about real symbols.  */
 
@@ -515,7 +515,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
   if (h->root.type == bfd_link_hash_new)
     {
       h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
-      return true;
+      return TRUE;
     }
 
   /* OLDBFD is a BFD associated with the existing symbol.  */
@@ -550,15 +550,15 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
   if (abfd == oldbfd
       && ((abfd->flags & DYNAMIC) == 0
          || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
-    return true;
+    return TRUE;
 
   /* NEWDYN and OLDDYN indicate whether the new or old symbol,
      respectively, is from a dynamic object.  */
 
   if ((abfd->flags & DYNAMIC) != 0)
-    newdyn = true;
+    newdyn = TRUE;
   else
-    newdyn = false;
+    newdyn = FALSE;
 
   if (oldbfd != NULL)
     olddyn = (oldbfd->flags & DYNAMIC) != 0;
@@ -585,7 +585,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
        }
 
       if (hsec == NULL)
-       olddyn = false;
+       olddyn = FALSE;
       else
        olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0;
     }
@@ -594,16 +594,16 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
      respectively, appear to be a definition rather than reference.  */
 
   if (bfd_is_und_section (sec) || bfd_is_com_section (sec))
-    newdef = false;
+    newdef = FALSE;
   else
-    newdef = true;
+    newdef = TRUE;
 
   if (h->root.type == bfd_link_hash_undefined
       || h->root.type == bfd_link_hash_undefweak
       || h->root.type == bfd_link_hash_common)
-    olddef = false;
+    olddef = FALSE;
   else
-    olddef = true;
+    olddef = TRUE;
 
   /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
      symbol, respectively, appears to be a common symbol in a dynamic
@@ -635,9 +635,9 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
       && sym->st_size > 0
       && bind != STB_WEAK
       && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
-    newdyncommon = true;
+    newdyncommon = TRUE;
   else
-    newdyncommon = false;
+    newdyncommon = FALSE;
 
   if (olddyn
       && olddef
@@ -647,9 +647,9 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
       && (h->root.u.def.section->flags & SEC_LOAD) == 0
       && h->size > 0
       && h->type != STT_FUNC)
-    olddyncommon = true;
+    olddyncommon = TRUE;
   else
-    olddyncommon = false;
+    olddyncommon = FALSE;
 
   /* It's OK to change the type if either the existing symbol or the
      new symbol is weak unless it comes from a DT_NEEDED entry of
@@ -659,14 +659,14 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
   if ((! dt_needed && h->root.type == bfd_link_hash_defweak)
       || h->root.type == bfd_link_hash_undefweak
       || bind == STB_WEAK)
-    *type_change_ok = true;
+    *type_change_ok = TRUE;
 
   /* It's OK to change the size if either the existing symbol or the
      new symbol is weak, or if the old symbol is undefined.  */
 
   if (*type_change_ok
       || h->root.type == bfd_link_hash_undefined)
-    *size_change_ok = true;
+    *size_change_ok = TRUE;
 
   /* If both the old and the new symbols look like common symbols in a
      dynamic object, set the size of the symbol to the larger of the
@@ -685,12 +685,12 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
       if (! ((*info->callbacks->multiple_common)
             (info, h->root.root.string, oldbfd, bfd_link_hash_common,
              h->size, abfd, bfd_link_hash_common, sym->st_size)))
-       return false;
+       return FALSE;
 
       if (sym->st_size > h->size)
        h->size = sym->st_size;
 
-      *size_change_ok = true;
+      *size_change_ok = TRUE;
     }
 
   /* If we are looking at a dynamic object, and we have found a
@@ -722,12 +722,12 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
          || dt_needed
          || bind == STB_WEAK))
     {
-      *override = true;
-      newdef = false;
-      newdyncommon = false;
+      *override = TRUE;
+      newdef = FALSE;
+      newdyncommon = FALSE;
 
       *psec = sec = bfd_und_section_ptr;
-      *size_change_ok = true;
+      *size_change_ok = TRUE;
 
       /* If we get here when the old symbol is a common symbol, then
         we are explicitly letting it override a weak symbol or
@@ -736,7 +736,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
         change warning may still be appropriate.  */
 
       if (h->root.type == bfd_link_hash_common)
-       *type_change_ok = true;
+       *type_change_ok = TRUE;
     }
 
   /* Handle the special case of an old common symbol merging with a
@@ -748,12 +748,12 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
   if (newdyncommon
       && h->root.type == bfd_link_hash_common)
     {
-      *override = true;
-      newdef = false;
-      newdyncommon = false;
+      *override = TRUE;
+      newdef = FALSE;
+      newdyncommon = FALSE;
       *pvalue = sym->st_size;
       *psec = sec = bfd_com_section_ptr;
-      *size_change_ok = true;
+      *size_change_ok = TRUE;
     }
 
   /* If the old symbol is from a dynamic object, and the new symbol is
@@ -786,16 +786,16 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
 
       h->root.type = bfd_link_hash_undefined;
       h->root.u.undef.abfd = h->root.u.def.section->owner;
-      *size_change_ok = true;
+      *size_change_ok = TRUE;
 
-      olddef = false;
-      olddyncommon = false;
+      olddef = FALSE;
+      olddyncommon = FALSE;
 
       /* We again permit a type change when a common symbol may be
         overriding a function.  */
 
       if (bfd_is_com_section (sec))
-       *type_change_ok = true;
+       *type_change_ok = TRUE;
 
       /* This union may have been set to be non-NULL when this symbol
         was seen in a dynamic object.  We must force the union to be
@@ -828,7 +828,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
       if (! ((*info->callbacks->multiple_common)
             (info, h->root.root.string, oldbfd, bfd_link_hash_common,
              h->size, abfd, bfd_link_hash_common, sym->st_size)))
-       return false;
+       return FALSE;
 
       /* If the predumed common symbol in the dynamic object is
         larger, pretend that the new symbol has its size.  */
@@ -840,14 +840,14 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
         in the dynamic object, so we just wind up using the one from
         the regular object.  */
 
-      olddef = false;
-      olddyncommon = false;
+      olddef = FALSE;
+      olddyncommon = FALSE;
 
       h->root.type = bfd_link_hash_undefined;
       h->root.u.undef.abfd = h->root.u.def.section->owner;
 
-      *size_change_ok = true;
-      *type_change_ok = true;
+      *size_change_ok = TRUE;
+      *type_change_ok = TRUE;
 
       h->verinfo.vertree = NULL;
     }
@@ -892,9 +892,9 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
       && newdef
       && ! newdyn
       && bind == STB_WEAK)
-    *override = true;
+    *override = TRUE;
 
-  return true;
+  return TRUE;
 }
 
 /* This function is called to create an indirect symbol from the
@@ -903,7 +903,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
    set DYNSYM if the new indirect symbol is dynamic. DT_NEEDED
    indicates if it comes from a DT_NEEDED entry of a shared object.  */
 
-static boolean
+static bfd_boolean
 elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
                        dynsym, override, dt_needed)
      bfd *abfd;
@@ -913,18 +913,18 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
      Elf_Internal_Sym *sym;
      asection **psec;
      bfd_vma *value;
-     boolean *dynsym;
-     boolean override;
-     boolean dt_needed;
+     bfd_boolean *dynsym;
+     bfd_boolean override;
+     bfd_boolean dt_needed;
 {
-  boolean type_change_ok;
-  boolean size_change_ok;
+  bfd_boolean type_change_ok;
+  bfd_boolean size_change_ok;
   char *shortname;
   struct elf_link_hash_entry *hi;
   struct bfd_link_hash_entry *bh;
   struct elf_backend_data *bed;
-  boolean collect;
-  boolean dynamic;
+  bfd_boolean collect;
+  bfd_boolean dynamic;
   char *p;
   size_t len, shortlen;
   asection *sec;
@@ -935,23 +935,23 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
      specify a version to be bound to this version of the symbol.  */
   p = strchr (name, ELF_VER_CHR);
   if (p == NULL || p[1] != ELF_VER_CHR)
-    return true;
+    return TRUE;
 
   if (override)
     {
       /* We are overridden by an old defition. We need to check if we
         need to create the indirect symbol from the default name.  */
-      hi = elf_link_hash_lookup (elf_hash_table (info), name, true,
-                                false, false);
+      hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE,
+                                FALSE, FALSE);
       BFD_ASSERT (hi != NULL);
       if (hi == h)
-       return true;
+       return TRUE;
       while (hi->root.type == bfd_link_hash_indirect
             || hi->root.type == bfd_link_hash_warning)
        {
          hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
          if (hi == h)
-           return true;
+           return TRUE;
        }
     }
 
@@ -962,7 +962,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
   shortlen = p - name;
   shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
   if (shortname == NULL)
-    return false;
+    return FALSE;
   memcpy (shortname, name, shortlen);
   shortname[shortlen] = '\0';
 
@@ -970,21 +970,21 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
      symbol with this name.  For the purposes of the merge, act as
      though we were defining the symbol we just defined, although we
      actually going to define an indirect symbol.  */
-  type_change_ok = false;
-  size_change_ok = false;
+  type_change_ok = FALSE;
+  size_change_ok = FALSE;
   sec = *psec;
   if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
                          &hi, &override, &type_change_ok,
                          &size_change_ok, dt_needed))
-    return false;
+    return FALSE;
 
   if (! override)
     {
       bh = &hi->root;
       if (! (_bfd_generic_link_add_one_symbol
             (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
-             (bfd_vma) 0, name, false, collect, &bh)))
-       return false;
+             (bfd_vma) 0, name, FALSE, collect, &bh)))
+       return FALSE;
       hi = (struct elf_link_hash_entry *) bh;
     }
   else
@@ -1022,7 +1022,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
                 | ELF_LINK_HASH_DEF_REGULAR))
            {
              if (! _bfd_elf_link_record_dynamic_symbol (info, hi))
-               return false;
+               return FALSE;
            }
        }
 
@@ -1057,13 +1057,13 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
              if (info->shared
                  || ((hi->elf_link_hash_flags
                       & ELF_LINK_HASH_REF_DYNAMIC) != 0))
-               *dynsym = true;
+               *dynsym = TRUE;
            }
          else
            {
              if ((hi->elf_link_hash_flags
                   & ELF_LINK_HASH_REF_REGULAR) != 0)
-               *dynsym = true;
+               *dynsym = TRUE;
            }
        }
     }
@@ -1074,18 +1074,18 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
   len = strlen (name);
   shortname = bfd_hash_allocate (&info->hash->table, len);
   if (shortname == NULL)
-    return false;
+    return FALSE;
   memcpy (shortname, name, shortlen);
   memcpy (shortname + shortlen, p + 1, len - shortlen);
 
   /* Once again, merge with any existing symbol.  */
-  type_change_ok = false;
-  size_change_ok = false;
+  type_change_ok = FALSE;
+  size_change_ok = FALSE;
   sec = *psec;
   if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
                          &hi, &override, &type_change_ok,
                          &size_change_ok, dt_needed))
-    return false;
+    return FALSE;
 
   if (override)
     {
@@ -1103,8 +1103,8 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
       bh = &hi->root;
       if (! (_bfd_generic_link_add_one_symbol
             (info, abfd, shortname, BSF_INDIRECT,
-             bfd_ind_section_ptr, (bfd_vma) 0, name, false, collect, &bh)))
-       return false;
+             bfd_ind_section_ptr, (bfd_vma) 0, name, FALSE, collect, &bh)))
+       return FALSE;
       hi = (struct elf_link_hash_entry *) bh;
 
       /* If there is a duplicate definition somewhere, then HI may not
@@ -1130,49 +1130,51 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
                  if (info->shared
                      || ((hi->elf_link_hash_flags
                           & ELF_LINK_HASH_REF_DYNAMIC) != 0))
-                   *dynsym = true;
+                   *dynsym = TRUE;
                }
              else
                {
                  if ((hi->elf_link_hash_flags
                       & ELF_LINK_HASH_REF_REGULAR) != 0)
-                   *dynsym = true;
+                   *dynsym = TRUE;
                }
            }
        }
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Add symbols from an ELF object file to the linker hash table.  */
 
-static boolean
+static bfd_boolean
 elf_link_add_object_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  boolean (*add_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *,
-                                     const Elf_Internal_Sym *,
-                                     const char **, flagword *,
-                                     asection **, bfd_vma *));
-  boolean (*check_relocs) PARAMS ((bfd *, struct bfd_link_info *,
-                                  asection *, const Elf_Internal_Rela *));
-  boolean collect;
+  bfd_boolean (*add_symbol_hook)
+    PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+            const char **, flagword *, asection **, bfd_vma *));
+  bfd_boolean (*check_relocs)
+    PARAMS ((bfd *, struct bfd_link_info *, asection *,
+            const Elf_Internal_Rela *));
+  bfd_boolean collect;
   Elf_Internal_Shdr *hdr;
   bfd_size_type symcount;
   bfd_size_type extsymcount;
   bfd_size_type extsymoff;
   struct elf_link_hash_entry **sym_hash;
-  boolean dynamic;
+  bfd_boolean dynamic;
   Elf_External_Versym *extversym = NULL;
   Elf_External_Versym *ever;
   struct elf_link_hash_entry *weaks;
+  struct elf_link_hash_entry **nondeflt_vers = NULL;
+  bfd_size_type nondeflt_vers_cnt = 0;
   Elf_Internal_Sym *isymbuf = NULL;
   Elf_Internal_Sym *isym;
   Elf_Internal_Sym *isymend;
   struct elf_backend_data *bed;
-  boolean dt_needed;
+  bfd_boolean dt_needed;
   struct elf_link_hash_table * hash_table;
   bfd_size_type amt;
 
@@ -1183,10 +1185,10 @@ elf_link_add_object_symbols (abfd, info)
   collect = bed->collect;
 
   if ((abfd->flags & DYNAMIC) == 0)
-    dynamic = false;
+    dynamic = FALSE;
   else
     {
-      dynamic = true;
+      dynamic = TRUE;
 
       /* You can't use -r against a dynamic object.  Also, there's no
         hope of using a dynamic object which does not exactly match
@@ -1232,7 +1234,7 @@ elf_link_add_object_symbols (abfd, info)
                  struct elf_link_hash_entry *h;
 
                  h = elf_link_hash_lookup (hash_table, name,
-                                           false, false, true);
+                                           FALSE, FALSE, TRUE);
 
                  /* FIXME: What about bfd_link_hash_common?  */
                  if (h != NULL
@@ -1259,7 +1261,7 @@ elf_link_add_object_symbols (abfd, info)
 
              if (! (_bfd_generic_link_add_one_symbol
                     (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg,
-                     false, collect, (struct bfd_link_hash_entry **) NULL)))
+                     FALSE, collect, (struct bfd_link_hash_entry **) NULL)))
                goto error_return;
 
              if (! info->relocateable)
@@ -1272,7 +1274,7 @@ elf_link_add_object_symbols (abfd, info)
        }
     }
 
-  dt_needed = false;
+  dt_needed = FALSE;
   if (! dynamic)
     {
       /* If we are creating a shared library, create all the dynamic
@@ -1294,7 +1296,7 @@ elf_link_add_object_symbols (abfd, info)
   else
     {
       asection *s;
-      boolean add_needed;
+      bfd_boolean add_needed;
       const char *name;
       bfd_size_type oldsize;
       bfd_size_type strindex;
@@ -1304,7 +1306,7 @@ elf_link_add_object_symbols (abfd, info)
         Test for --just-symbols by looking at info set up by
         _bfd_elf_link_just_syms.  */
       if ((s = abfd->sections) != NULL
-         && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+         && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
        goto error_return;
 
       /* Find the name to use in a DT_NEEDED entry that refers to this
@@ -1314,7 +1316,7 @@ elf_link_add_object_symbols (abfd, info)
         name.  If the generic linker put a null string into
         elf_dt_name, we don't make a DT_NEEDED entry at all, even if
         there is a DT_SONAME entry.  */
-      add_needed = true;
+      add_needed = TRUE;
       name = bfd_get_filename (abfd);
       if (elf_dt_name (abfd) != NULL)
        {
@@ -1322,9 +1324,9 @@ elf_link_add_object_symbols (abfd, info)
          if (*name == '\0')
            {
              if (elf_dt_soname (abfd) != NULL)
-               dt_needed = true;
+               dt_needed = TRUE;
 
-             add_needed = false;
+             add_needed = FALSE;
            }
        }
       s = bfd_get_section_by_name (abfd, ".dynamic");
@@ -1482,7 +1484,7 @@ elf_link_add_object_symbols (abfd, info)
        {
          /* Add a DT_NEEDED entry for this dynamic object.  */
          oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
-         strindex = _bfd_elf_strtab_add (hash_table->dynstr, name, false);
+         strindex = _bfd_elf_strtab_add (hash_table->dynstr, name, FALSE);
          if (strindex == (bfd_size_type) -1)
            goto error_return;
 
@@ -1511,7 +1513,7 @@ elf_link_add_object_symbols (abfd, info)
                      && dyn.d_un.d_val == strindex)
                    {
                      _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
-                     return true;
+                     return TRUE;
                    }
                }
            }
@@ -1606,13 +1608,13 @@ elf_link_add_object_symbols (abfd, info)
       flagword flags;
       const char *name;
       struct elf_link_hash_entry *h;
-      boolean definition;
-      boolean size_change_ok, type_change_ok;
-      boolean new_weakdef;
+      bfd_boolean definition;
+      bfd_boolean size_change_ok, type_change_ok;
+      bfd_boolean new_weakdef;
       unsigned int old_alignment;
-      boolean override;
+      bfd_boolean override;
 
-      override = false;
+      override = FALSE;
 
       flags = BSF_NO_FLAGS;
       sec = NULL;
@@ -1708,11 +1710,11 @@ elf_link_add_object_symbols (abfd, info)
 
       if (bfd_is_und_section (sec)
          || bfd_is_com_section (sec))
-       definition = false;
+       definition = FALSE;
       else
-       definition = true;
+       definition = TRUE;
 
-      size_change_ok = false;
+      size_change_ok = FALSE;
       type_change_ok = get_elf_backend_data (abfd)->type_change_ok;
       old_alignment = 0;
       if (info->hash->creator->flavour == bfd_target_elf_flavour)
@@ -1821,7 +1823,7 @@ elf_link_add_object_symbols (abfd, info)
            goto error_free_vers;
 
          if (override)
-           definition = false;
+           definition = FALSE;
 
          h = *sym_hash;
          while (h->root.type == bfd_link_hash_indirect
@@ -1845,7 +1847,7 @@ elf_link_add_object_symbols (abfd, info)
 
       if (! (_bfd_generic_link_add_one_symbol
             (info, abfd, name, flags, sec, value, (const char *) NULL,
-             false, collect, (struct bfd_link_hash_entry **) sym_hash)))
+             FALSE, collect, (struct bfd_link_hash_entry **) sym_hash)))
        goto error_free_vers;
 
       h = *sym_hash;
@@ -1854,7 +1856,7 @@ elf_link_add_object_symbols (abfd, info)
        h = (struct elf_link_hash_entry *) h->root.u.i.link;
       *sym_hash = h;
 
-      new_weakdef = false;
+      new_weakdef = FALSE;
       if (dynamic
          && definition
          && (flags & BSF_WEAK) != 0
@@ -1876,7 +1878,7 @@ elf_link_add_object_symbols (abfd, info)
 
          h->weakdef = weaks;
          weaks = h;
-         new_weakdef = true;
+         new_weakdef = TRUE;
        }
 
       /* Set the alignment of a common symbol.  */
@@ -1896,7 +1898,7 @@ elf_link_add_object_symbols (abfd, info)
       if (info->hash->creator->flavour == bfd_target_elf_flavour)
        {
          int old_flags;
-         boolean dynsym;
+         bfd_boolean dynsym;
          int new_flag;
 
          /* Remember the symbol size and type.  */
@@ -1957,7 +1959,7 @@ elf_link_add_object_symbols (abfd, info)
             is one which is referenced or defined by both a regular
             object and a shared object.  */
          old_flags = h->elf_link_hash_flags;
-         dynsym = false;
+         dynsym = FALSE;
          if (! dynamic)
            {
              if (! definition)
@@ -1971,7 +1973,7 @@ elf_link_add_object_symbols (abfd, info)
              if (info->shared
                  || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
                                   | ELF_LINK_HASH_REF_DYNAMIC)) != 0)
-               dynsym = true;
+               dynsym = TRUE;
            }
          else
            {
@@ -1984,7 +1986,7 @@ elf_link_add_object_symbols (abfd, info)
                  || (h->weakdef != NULL
                      && ! new_weakdef
                      && h->weakdef->dynindx != -1))
-               dynsym = true;
+               dynsym = TRUE;
            }
 
          h->elf_link_hash_flags |= new_flag;
@@ -1997,6 +1999,23 @@ elf_link_add_object_symbols (abfd, info)
                                          override, dt_needed))
              goto error_free_vers;
 
+         if (definition && (abfd->flags & DYNAMIC) == 0)
+           {
+             char *p = strchr (name, ELF_VER_CHR);
+             if (p != NULL && p[1] != ELF_VER_CHR)
+               {
+                 /* Queue non-default versions so that .symver x, x@FOO
+                    aliases can be checked.  */
+                 if (! nondeflt_vers)
+                   {
+                     amt = (isymend - isym + 1)
+                           * sizeof (struct elf_link_hash_entry *);
+                     nondeflt_vers = bfd_malloc (amt);
+                   }
+                 nondeflt_vers [nondeflt_vers_cnt++] = h;
+               }
+           }
+
          if (dynsym && h->dynindx == -1)
            {
              if (! _bfd_elf_link_record_dynamic_symbol (info, h))
@@ -2017,7 +2036,7 @@ elf_link_add_object_symbols (abfd, info)
              {
              case STV_INTERNAL:
              case STV_HIDDEN:
-               (*bed->elf_backend_hide_symbol) (info, h, true);
+               (*bed->elf_backend_hide_symbol) (info, h, TRUE);
                break;
              }
 
@@ -2035,10 +2054,10 @@ elf_link_add_object_symbols (abfd, info)
                 the regular object to create a dynamic executable. We
                 have to make sure there is a DT_NEEDED entry for it.  */
 
-             dt_needed = false;
+             dt_needed = FALSE;
              oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
              strindex = _bfd_elf_strtab_add (hash_table->dynstr,
-                                             elf_dt_soname (abfd), false);
+                                             elf_dt_soname (abfd), FALSE);
              if (strindex == (bfd_size_type) -1)
                goto error_free_vers;
 
@@ -2071,6 +2090,55 @@ elf_link_add_object_symbols (abfd, info)
        }
     }
 
+  /* Now that all the symbols from this input file are created, handle
+     .symver foo, foo@BAR such that any relocs against foo become foo@BAR.  */
+  if (nondeflt_vers != NULL)
+    {
+      bfd_size_type cnt, symidx;
+
+      for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
+       {
+         struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
+         char *shortname, *p;
+
+         p = strchr (h->root.root.string, ELF_VER_CHR);
+         if (p == NULL
+             || (h->root.type != bfd_link_hash_defined
+                 && h->root.type != bfd_link_hash_defweak))
+           continue;
+
+         amt = p - h->root.root.string;
+         shortname = bfd_malloc (amt + 1);
+         memcpy (shortname, h->root.root.string, amt);
+         shortname[amt] = '\0';
+
+         hi = (struct elf_link_hash_entry *)
+              bfd_link_hash_lookup (info->hash, shortname,
+                                    FALSE, FALSE, FALSE);
+         if (hi != NULL
+             && hi->root.type == h->root.type
+             && hi->root.u.def.value == h->root.u.def.value
+             && hi->root.u.def.section == h->root.u.def.section)
+           {
+             (*bed->elf_backend_hide_symbol) (info, hi, TRUE);
+             hi->root.type = bfd_link_hash_indirect;
+             hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
+             (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+             sym_hash = elf_sym_hashes (abfd);
+             if (sym_hash)
+               for (symidx = 0; symidx < extsymcount; ++symidx)
+                 if (sym_hash[symidx] == hi)
+                   {
+                     sym_hash[symidx] = h;
+                     break;
+                   }
+           }
+         free (shortname);
+       }
+      free (nondeflt_vers);
+      nondeflt_vers = NULL;
+    }
+
   if (extversym != NULL)
     {
       free (extversym);
@@ -2180,7 +2248,7 @@ elf_link_add_object_symbols (abfd, info)
       for (o = abfd->sections; o != NULL; o = o->next)
        {
          Elf_Internal_Rela *internal_relocs;
-         boolean ok;
+         bfd_boolean ok;
 
          if ((o->flags & SEC_RELOC) == 0
              || o->reloc_count == 0
@@ -2234,7 +2302,7 @@ elf_link_add_object_symbols (abfd, info)
                                             &secdata->sec_info))
                goto error_return;
              if (secdata->sec_info)
-               secdata->sec_info_type = ELF_INFO_TYPE_STABS;
+               stab->sec_info_type = ELF_INFO_TYPE_STABS;
            }
        }
     }
@@ -2256,7 +2324,7 @@ elf_link_add_object_symbols (abfd, info)
                                      s, &secdata->sec_info))
              goto error_return;
            else if (secdata->sec_info)
-             secdata->sec_info_type = ELF_INFO_TYPE_MERGE;
+             s->sec_info_type = ELF_INFO_TYPE_MERGE;
          }
     }
 
@@ -2274,16 +2342,18 @@ elf_link_add_object_symbols (abfd, info)
       hash_table->loaded = n;
     }
 
-  return true;
+  return TRUE;
 
  error_free_vers:
+  if (nondeflt_vers != NULL)
+    free (nondeflt_vers);
   if (extversym != NULL)
     free (extversym);
  error_free_sym:
   if (isymbuf != NULL)
     free (isymbuf);
  error_return:
-  return false;
+  return FALSE;
 }
 
 /* Create some sections which will be filled in with dynamic linking
@@ -2293,7 +2363,7 @@ elf_link_add_object_symbols (abfd, info)
    addresses are assigned to the output sections.  We work out the
    actual contents and size of these sections later.  */
 
-boolean
+bfd_boolean
 elf_link_create_dynamic_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -2305,10 +2375,10 @@ elf_link_create_dynamic_sections (abfd, info)
   struct elf_backend_data *bed;
 
   if (! is_elf_hash_table (info))
-    return false;
+    return FALSE;
 
   if (elf_hash_table (info)->dynamic_sections_created)
-    return true;
+    return TRUE;
 
   /* Make sure that all dynamic sections use the same input BFD.  */
   if (elf_hash_table (info)->dynobj == NULL)
@@ -2328,7 +2398,7 @@ elf_link_create_dynamic_sections (abfd, info)
       s = bfd_make_section (abfd, ".interp");
       if (s == NULL
          || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
-       return false;
+       return FALSE;
     }
 
   if (! info->traditional_format
@@ -2338,7 +2408,7 @@ elf_link_create_dynamic_sections (abfd, info)
       if (s == NULL
          || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
          || ! bfd_set_section_alignment (abfd, s, 2))
-       return false;
+       return FALSE;
       elf_hash_table (info)->eh_info.hdr_sec = s;
     }
 
@@ -2348,44 +2418,44 @@ elf_link_create_dynamic_sections (abfd, info)
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
-    return false;
+    return FALSE;
 
   s = bfd_make_section (abfd, ".gnu.version");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, 1))
-    return false;
+    return FALSE;
 
   s = bfd_make_section (abfd, ".gnu.version_r");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
-    return false;
+    return FALSE;
 
   s = bfd_make_section (abfd, ".dynsym");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
-    return false;
+    return FALSE;
 
   s = bfd_make_section (abfd, ".dynstr");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
-    return false;
+    return FALSE;
 
   /* Create a strtab to hold the dynamic symbol names.  */
   if (elf_hash_table (info)->dynstr == NULL)
     {
       elf_hash_table (info)->dynstr = _bfd_elf_strtab_init ();
       if (elf_hash_table (info)->dynstr == NULL)
-       return false;
+       return FALSE;
     }
 
   s = bfd_make_section (abfd, ".dynamic");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
-    return false;
+    return FALSE;
 
   /* The special symbol _DYNAMIC is always set to the start of the
      .dynamic section.  This call occurs before we have processed the
@@ -2398,15 +2468,15 @@ elf_link_create_dynamic_sections (abfd, info)
   bh = NULL;
   if (! (_bfd_generic_link_add_one_symbol
         (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0,
-         (const char *) 0, false, get_elf_backend_data (abfd)->collect, &bh)))
-    return false;
+         (const char *) 0, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
+    return FALSE;
   h = (struct elf_link_hash_entry *) bh;
   h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
   h->type = STT_OBJECT;
 
   if (info->shared
       && ! _bfd_elf_link_record_dynamic_symbol (info, h))
-    return false;
+    return FALSE;
 
   bed = get_elf_backend_data (abfd);
 
@@ -2414,23 +2484,23 @@ elf_link_create_dynamic_sections (abfd, info)
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
-    return false;
+    return FALSE;
   elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
 
   /* Let the backend create the rest of the sections.  This lets the
      backend set the right flags.  The backend will normally create
      the .got and .plt sections.  */
   if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
-    return false;
+    return FALSE;
 
-  elf_hash_table (info)->dynamic_sections_created = true;
+  elf_hash_table (info)->dynamic_sections_created = TRUE;
 
-  return true;
+  return TRUE;
 }
 
 /* Add an entry to the .dynamic table.  */
 
-boolean
+bfd_boolean
 elf_add_dynamic_entry (info, tag, val)
      struct bfd_link_info *info;
      bfd_vma tag;
@@ -2443,7 +2513,7 @@ elf_add_dynamic_entry (info, tag, val)
   bfd_byte *newcontents;
 
   if (! is_elf_hash_table (info))
-    return false;
+    return FALSE;
 
   dynobj = elf_hash_table (info)->dynobj;
 
@@ -2453,7 +2523,7 @@ elf_add_dynamic_entry (info, tag, val)
   newsize = s->_raw_size + sizeof (Elf_External_Dyn);
   newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
   if (newcontents == NULL)
-    return false;
+    return FALSE;
 
   dyn.d_tag = tag;
   dyn.d_un.d_val = val;
@@ -2463,7 +2533,7 @@ elf_add_dynamic_entry (info, tag, val)
   s->_raw_size = newsize;
   s->contents = newcontents;
 
-  return true;
+  return TRUE;
 }
 \f
 /* Read and swap the relocs from the section indicated by SHDR.  This
@@ -2473,9 +2543,9 @@ elf_add_dynamic_entry (info, tag, val)
    The EXTERNAL_RELOCS are a buffer where the external form of the
    relocations should be stored.
 
-   Returns false if something goes wrong.  */
+   Returns FALSE if something goes wrong.  */
 
-static boolean
+static bfd_boolean
 elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
                                   internal_relocs)
      bfd *abfd;
@@ -2484,73 +2554,44 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
      Elf_Internal_Rela *internal_relocs;
 {
   struct elf_backend_data *bed;
-  bfd_size_type amt;
+  void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+  const bfd_byte *erela;
+  const bfd_byte *erelaend;
+  Elf_Internal_Rela *irela;
 
   /* If there aren't any relocations, that's OK.  */
   if (!shdr)
-    return true;
+    return TRUE;
 
   /* Position ourselves at the start of the section.  */
   if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
-    return false;
+    return FALSE;
 
   /* Read the relocations.  */
   if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
-    return false;
+    return FALSE;
 
   bed = get_elf_backend_data (abfd);
 
   /* Convert the external relocations to the internal format.  */
   if (shdr->sh_entsize == sizeof (Elf_External_Rel))
-    {
-      Elf_External_Rel *erel;
-      Elf_External_Rel *erelend;
-      Elf_Internal_Rela *irela;
-      Elf_Internal_Rel *irel;
-
-      erel = (Elf_External_Rel *) external_relocs;
-      erelend = erel + NUM_SHDR_ENTRIES (shdr);
-      irela = internal_relocs;
-      amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
-      irel = bfd_alloc (abfd, amt);
-      for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel)
-       {
-         unsigned int i;
-
-         if (bed->s->swap_reloc_in)
-           (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
-         else
-           elf_swap_reloc_in (abfd, erel, irel);
-
-         for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i)
-           {
-             irela[i].r_offset = irel[i].r_offset;
-             irela[i].r_info = irel[i].r_info;
-             irela[i].r_addend = 0;
-           }
-       }
-    }
+    swap_in = bed->s->swap_reloc_in;
+  else if (shdr->sh_entsize == sizeof (Elf_External_Rela))
+    swap_in = bed->s->swap_reloca_in;
   else
-    {
-      Elf_External_Rela *erela;
-      Elf_External_Rela *erelaend;
-      Elf_Internal_Rela *irela;
-
-      BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela));
+    abort ();
 
-      erela = (Elf_External_Rela *) external_relocs;
-      erelaend = erela + NUM_SHDR_ENTRIES (shdr);
-      irela = internal_relocs;
-      for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel)
-       {
-         if (bed->s->swap_reloca_in)
-           (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
-         else
-           elf_swap_reloca_in (abfd, erela, irela);
-       }
+  erela = external_relocs;
+  erelaend = erela + NUM_SHDR_ENTRIES (shdr) * shdr->sh_entsize;
+  irela = internal_relocs;
+  while (erela < erelaend)
+    {
+      (*swap_in) (abfd, erela, irela);
+      irela += bed->s->int_rels_per_ext_rel;
+      erela += shdr->sh_entsize;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Read and swap the relocs for a section O.  They may have been
@@ -2570,7 +2611,7 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
      asection *o;
      PTR external_relocs;
      Elf_Internal_Rela *internal_relocs;
-     boolean keep_memory;
+     bfd_boolean keep_memory;
 {
   Elf_Internal_Shdr *rel_hdr;
   PTR alloc1 = NULL;
@@ -2646,21 +2687,21 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
 /* Record an assignment to a symbol made by a linker script.  We need
    this in case some dynamic object refers to this symbol.  */
 
-boolean
+bfd_boolean
 NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
      bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      const char *name;
-     boolean provide;
+     bfd_boolean provide;
 {
   struct elf_link_hash_entry *h;
 
   if (info->hash->creator->flavour != bfd_target_elf_flavour)
-    return true;
+    return TRUE;
 
-  h = elf_link_hash_lookup (elf_hash_table (info), name, true, true, false);
+  h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
   if (h == NULL)
-    return false;
+    return FALSE;
 
   if (h->root.type == bfd_link_hash_new)
     h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
@@ -2691,7 +2732,7 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
       && h->dynindx == -1)
     {
       if (! _bfd_elf_link_record_dynamic_symbol (info, h))
-       return false;
+       return FALSE;
 
       /* If this is a weak defined symbol, and we know a corresponding
         real symbol from the same dynamic object, make sure the real
@@ -2700,11 +2741,11 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
          && h->weakdef->dynindx == -1)
        {
          if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
-           return false;
+           return FALSE;
        }
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* This structure is used to pass information to
@@ -2719,7 +2760,7 @@ struct elf_assign_sym_version_info
   /* Version tree.  */
   struct bfd_elf_version_tree *verdefs;
   /* Whether we had a failure.  */
-  boolean failed;
+  bfd_boolean failed;
 };
 
 /* This structure is used to pass information to
@@ -2734,7 +2775,7 @@ struct elf_find_verdep_info
   /* The number of dependencies.  */
   unsigned int vers;
   /* Whether we had a failure.  */
-  boolean failed;
+  bfd_boolean failed;
 };
 
 /* Array used to determine the number of hash table buckets to use
@@ -2900,7 +2941,7 @@ compute_bucket_count (info)
    must set the sizes of the sections before the linker sets the
    addresses of the various sections.  */
 
-boolean
+bfd_boolean
 NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                     filter_shlib,
                                     auxiliary_filters, info, sinterpptr,
@@ -2924,31 +2965,31 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
   soname_indx = (bfd_size_type) -1;
 
   if (info->hash->creator->flavour != bfd_target_elf_flavour)
-    return true;
+    return TRUE;
 
   if (! is_elf_hash_table (info))
-    return true;
+    return TRUE;
 
   /* Any syms created from now on start with -1 in
      got.refcount/offset and plt.refcount/offset.  */
-  elf_hash_table (info)->init_refcount = -1;
+  elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset;
 
   /* The backend may have to create some sections regardless of whether
      we're dynamic or not.  */
   bed = get_elf_backend_data (output_bfd);
   if (bed->elf_backend_always_size_sections
       && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
-    return false;
+    return FALSE;
 
   dynobj = elf_hash_table (info)->dynobj;
 
   /* If there were no dynamic objects in the link, there is nothing to
      do here.  */
   if (dynobj == NULL)
-    return true;
+    return TRUE;
 
   if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
-    return false;
+    return FALSE;
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
@@ -2957,7 +2998,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       asection *dynstr;
       struct bfd_elf_version_tree *t;
       struct bfd_elf_version_expr *d;
-      boolean all_defined;
+      bfd_boolean all_defined;
 
       *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
       BFD_ASSERT (*sinterpptr != NULL || info->shared);
@@ -2965,18 +3006,18 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       if (soname != NULL)
        {
          soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
-                                            soname, true);
+                                            soname, TRUE);
          if (soname_indx == (bfd_size_type) -1
              || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME,
                                          soname_indx))
-           return false;
+           return FALSE;
        }
 
       if (info->symbolic)
        {
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC,
                                       (bfd_vma) 0))
-           return false;
+           return FALSE;
          info->flags |= DF_SYMBOLIC;
        }
 
@@ -2985,7 +3026,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          bfd_size_type indx;
 
          indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
-                                     true);
+                                     TRUE);
          if (info->new_dtags)
            _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
          if (indx == (bfd_size_type) -1
@@ -2993,7 +3034,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              || (info->new_dtags
                  && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH,
                                              indx)))
-           return false;
+           return FALSE;
        }
 
       if (filter_shlib != NULL)
@@ -3001,10 +3042,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          bfd_size_type indx;
 
          indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
-                                     filter_shlib, true);
+                                     filter_shlib, TRUE);
          if (indx == (bfd_size_type) -1
              || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx))
-           return false;
+           return FALSE;
        }
 
       if (auxiliary_filters != NULL)
@@ -3016,17 +3057,17 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              bfd_size_type indx;
 
              indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
-                                         *p, true);
+                                         *p, TRUE);
              if (indx == (bfd_size_type) -1
                  || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY,
                                              indx))
-               return false;
+               return FALSE;
            }
        }
 
       eif.info = info;
       eif.verdefs = verdefs;
-      eif.failed = false;
+      eif.failed = FALSE;
 
       /* If we are supposed to export all symbols into the dynamic symbol
         table (this is not the normal case), then do so.  */
@@ -3035,7 +3076,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
                                  (PTR) &eif);
          if (eif.failed)
-           return false;
+           return FALSE;
        }
 
       /* Make all global versions with definiton.  */
@@ -3052,11 +3093,11 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              namelen = strlen (name);
              verstr = t->name;
              verlen = strlen (verstr);
-             newlen = namelen + verlen + 3; 
+             newlen = namelen + verlen + 3;
 
              newname = (char *) bfd_malloc ((bfd_size_type) newlen);
              if (newname == NULL)
-               return false;
+               return FALSE;
              memcpy (newname, name, namelen);
 
              /* Check the hidden versioned definition.  */
@@ -3064,8 +3105,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              *p++ = ELF_VER_CHR;
              memcpy (p, verstr, verlen + 1);
              newh = elf_link_hash_lookup (elf_hash_table (info),
-                                          newname, false, false,
-                                          false);
+                                          newname, FALSE, FALSE,
+                                          FALSE);
              if (newh == NULL
                  || (newh->root.type != bfd_link_hash_defined
                      && newh->root.type != bfd_link_hash_defweak))
@@ -3074,8 +3115,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                  *p++ = ELF_VER_CHR;
                  memcpy (p, verstr, verlen + 1);
                  newh = elf_link_hash_lookup (elf_hash_table (info),
-                                              newname, false, false,
-                                              false);
+                                              newname, FALSE, FALSE,
+                                              FALSE);
                }
              free (newname);
 
@@ -3093,18 +3134,18 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       asvinfo.output_bfd = output_bfd;
       asvinfo.info = info;
       asvinfo.verdefs = verdefs;
-      asvinfo.failed = false;
+      asvinfo.failed = FALSE;
 
       elf_link_hash_traverse (elf_hash_table (info),
                              elf_link_assign_sym_version,
                              (PTR) &asvinfo);
       if (asvinfo.failed)
-       return false;
+       return FALSE;
 
       if (!info->allow_undefined_version)
        {
          /* Check if all global versions have a definiton.  */
-         all_defined = true;
+         all_defined = TRUE;
          for (t = verdefs; t != NULL; t = t->next)
            for (d = t->globals; d != NULL; d = d->next)
              if (!d->symver && !d->script
@@ -3113,13 +3154,13 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                  (*_bfd_error_handler)
                    (_("%s: undefined version: %s"),
                     d->pattern, t->name);
-                 all_defined = false;
+                 all_defined = FALSE;
                }
 
          if (!all_defined)
            {
              bfd_set_error (bfd_error_bad_value);
-             return false;
+             return FALSE;
            }
        }
 
@@ -3129,7 +3170,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                              elf_adjust_dynamic_symbol,
                              (PTR) &eif);
       if (eif.failed)
-       return false;
+       return FALSE;
 
       /* Add some entries to the .dynamic section.  We fill in some of the
         values later, in elf_bfd_final_link, but we must add the entries
@@ -3139,27 +3180,27 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
         call then add the corresponding DT_INIT/DT_FINI entries.  */
       h = (info->init_function
           ? elf_link_hash_lookup (elf_hash_table (info),
-                                  info->init_function, false,
-                                  false, false)
+                                  info->init_function, FALSE,
+                                  FALSE, FALSE)
           : NULL);
       if (h != NULL
          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
        {
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
       h = (info->fini_function
           ? elf_link_hash_lookup (elf_hash_table (info),
-                                  info->fini_function, false,
-                                  false, false)
+                                  info->fini_function, FALSE,
+                                  FALSE, FALSE)
           : NULL);
       if (h != NULL
          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
        {
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
 
       if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
@@ -3183,14 +3224,14 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                    }
 
              bfd_set_error (bfd_error_nonrepresentable_section);
-             return false;
+             return FALSE;
            }
 
          if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY,
                                      (bfd_vma) 0)
              || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ,
                                         (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
       if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
        {
@@ -3198,7 +3239,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                      (bfd_vma) 0)
              || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ,
                                         (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
       if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
        {
@@ -3206,7 +3247,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                      (bfd_vma) 0)
              || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ,
                                         (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
 
       dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
@@ -3225,7 +3266,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize)
              || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT,
                                          (bfd_vma) sizeof (Elf_External_Sym)))
-           return false;
+           return FALSE;
        }
     }
 
@@ -3233,7 +3274,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
      sections.  */
   if (bed->elf_backend_size_dynamic_sections
       && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
-    return false;
+    return FALSE;
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
@@ -3289,7 +3330,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          s->_raw_size = size;
          s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
          if (s->contents == NULL && s->_raw_size != 0)
-           return false;
+           return FALSE;
 
          /* Fill in the version definition section.  */
 
@@ -3318,9 +3359,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              name = basename (output_bfd->filename);
              def.vd_hash = bfd_elf_hash (name);
              indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
-                                         name, false);
+                                         name, FALSE);
              if (indx == (bfd_size_type) -1)
-               return false;
+               return FALSE;
              defaux.vda_name = indx;
            }
          defaux.vda_next = 0;
@@ -3347,9 +3388,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              bh = NULL;
              if (! (_bfd_generic_link_add_one_symbol
                     (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
-                     (bfd_vma) 0, (const char *) NULL, false,
+                     (bfd_vma) 0, (const char *) NULL, FALSE,
                      get_elf_backend_data (dynobj)->collect, &bh)))
-               return false;
+               return FALSE;
              h = (struct elf_link_hash_entry *) bh;
              h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF;
              h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
@@ -3357,7 +3398,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
              h->verinfo.vertree = t;
 
              if (! _bfd_elf_link_record_dynamic_symbol (info, h))
-               return false;
+               return FALSE;
 
              def.vd_version = VER_DEF_CURRENT;
              def.vd_flags = 0;
@@ -3418,7 +3459,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0)
              || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM,
                                          (bfd_vma) cdefs))
-           return false;
+           return FALSE;
 
          elf_tdata (output_bfd)->cverdefs = cdefs;
        }
@@ -3426,7 +3467,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
        {
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags))
-           return false;
+           return FALSE;
        }
 
       if (info->flags_1)
@@ -3437,7 +3478,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                | DF_1_NOOPEN);
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1,
                                       info->flags_1))
-           return false;
+           return FALSE;
        }
 
       /* Work out the size of the version reference section.  */
@@ -3452,7 +3493,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
        sinfo.vers = elf_tdata (output_bfd)->cverdefs;
        if (sinfo.vers == 0)
          sinfo.vers = 1;
-       sinfo.failed = false;
+       sinfo.failed = FALSE;
 
        elf_link_hash_traverse (elf_hash_table (info),
                                elf_link_find_version_dependencies,
@@ -3485,7 +3526,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
            s->_raw_size = size;
            s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
            if (s->contents == NULL)
-             return false;
+             return FALSE;
 
            p = s->contents;
            for (t = elf_tdata (output_bfd)->verref;
@@ -3506,9 +3547,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                            elf_dt_name (t->vn_bfd) != NULL
                                            ? elf_dt_name (t->vn_bfd)
                                            : basename (t->vn_bfd->filename),
-                                           false);
+                                           FALSE);
                if (indx == (bfd_size_type) -1)
-                 return false;
+                 return FALSE;
                t->vn_file = indx;
                t->vn_aux = sizeof (Elf_External_Verneed);
                if (t->vn_nextref == NULL)
@@ -3525,9 +3566,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                  {
                    a->vna_hash = bfd_elf_hash (a->vna_nodename);
                    indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
-                                               a->vna_nodename, false);
+                                               a->vna_nodename, FALSE);
                    if (indx == (bfd_size_type) -1)
-                     return false;
+                     return FALSE;
                    a->vna_name = indx;
                    if (a->vna_nextptr == NULL)
                      a->vna_next = 0;
@@ -3544,7 +3585,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                         (bfd_vma) 0)
                || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM,
                                            (bfd_vma) crefs))
-             return false;
+             return FALSE;
 
            elf_tdata (output_bfd)->cverrefs = crefs;
          }
@@ -3573,10 +3614,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
          s->_raw_size = dynsymcount * sizeof (Elf_External_Versym);
          s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
          if (s->contents == NULL)
-           return false;
+           return FALSE;
 
          if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0))
-           return false;
+           return FALSE;
        }
 
       /* Set the size of the .dynsym and .hash sections.  We counted
@@ -3590,7 +3631,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       s->_raw_size = dynsymcount * sizeof (Elf_External_Sym);
       s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
-       return false;
+       return FALSE;
 
       if (dynsymcount != 0)
        {
@@ -3616,7 +3657,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
       s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
       s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
       if (s->contents == NULL)
-       return false;
+       return FALSE;
 
       bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount,
               s->contents);
@@ -3634,19 +3675,19 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
 
       for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
        if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0))
-         return false;
+         return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* This function is used to adjust offsets into .dynstr for
    dynamic symbols.  This is called via elf_link_hash_traverse.  */
 
-static boolean elf_adjust_dynstr_offsets
-PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_adjust_dynstr_offsets
+  PARAMS ((struct elf_link_hash_entry *, PTR));
 
-static boolean
+static bfd_boolean
 elf_adjust_dynstr_offsets (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -3658,13 +3699,13 @@ elf_adjust_dynstr_offsets (h, data)
 
   if (h->dynindx != -1)
     h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
-  return true;
+  return TRUE;
 }
 
 /* Assign string offsets in .dynstr, update all structures referencing
    them.  */
 
-static boolean
+static bfd_boolean
 elf_finalize_dynstr (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
@@ -3784,7 +3825,7 @@ elf_finalize_dynstr (output_bfd, info)
       while (need.vn_next);
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Fix up the flags for a symbol.  This handles various cases which
@@ -3793,7 +3834,7 @@ elf_finalize_dynstr (output_bfd, info)
    assign_sym_version, which is unnecessary but perhaps more robust in
    the face of future changes.  */
 
-static boolean
+static bfd_boolean
 elf_fix_symbol_flags (h, eif)
      struct elf_link_hash_entry *h;
      struct elf_info_failed *eif;
@@ -3828,8 +3869,8 @@ elf_fix_symbol_flags (h, eif)
        {
          if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
            {
-             eif->failed = true;
-             return false;
+             eif->failed = TRUE;
+             return FALSE;
            }
        }
     }
@@ -3882,7 +3923,7 @@ elf_fix_symbol_flags (h, eif)
       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
     {
       struct elf_backend_data *bed;
-      boolean force_local;
+      bfd_boolean force_local;
 
       bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
 
@@ -3922,14 +3963,14 @@ elf_fix_symbol_flags (h, eif)
        }
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Make the backend pick a good value for a dynamic symbol.  This is
    called via elf_link_hash_traverse, and also calls itself
    recursively.  */
 
-static boolean
+static bfd_boolean
 elf_adjust_dynamic_symbol (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -3938,10 +3979,13 @@ elf_adjust_dynamic_symbol (h, data)
   bfd *dynobj;
   struct elf_backend_data *bed;
 
+  if (! is_elf_hash_table (eif->info))
+    return FALSE;
+
   if (h->root.type == bfd_link_hash_warning)
     {
-      h->plt.offset = (bfd_vma) -1;
-      h->got.offset = (bfd_vma) -1;
+      h->plt = elf_hash_table (eif->info)->init_offset;
+      h->got = elf_hash_table (eif->info)->init_offset;
 
       /* When warning symbols are created, they **replace** the "real"
         entry in the hash table, thus we never get to see the real
@@ -3951,14 +3995,11 @@ elf_adjust_dynamic_symbol (h, data)
 
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->root.type == bfd_link_hash_indirect)
-    return true;
-
-  if (! is_elf_hash_table (eif->info))
-    return false;
+    return TRUE;
 
   /* Fix the symbol flags.  */
   if (! elf_fix_symbol_flags (h, eif))
-    return false;
+    return FALSE;
 
   /* If this symbol does not require a PLT entry, and it is not
      defined by a dynamic object, or is not referenced by a regular
@@ -3973,14 +4014,14 @@ elf_adjust_dynamic_symbol (h, data)
          || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
              && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
     {
-      h->plt.offset = (bfd_vma) -1;
-      return true;
+      h->plt = elf_hash_table (eif->info)->init_offset;
+      return TRUE;
     }
 
   /* If we've already adjusted this symbol, don't do it again.  This
      can happen via a recursive call.  */
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
-    return true;
+    return TRUE;
 
   /* Don't look at this symbol again.  Note that we must set this
      after checking the above conditions, because we may look at a
@@ -4025,7 +4066,7 @@ elf_adjust_dynamic_symbol (h, data)
       h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
 
       if (! elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif))
-       return false;
+       return FALSE;
     }
 
   /* If a symbol has no type and no size and does not require a PLT
@@ -4044,17 +4085,17 @@ elf_adjust_dynamic_symbol (h, data)
   bed = get_elf_backend_data (dynobj);
   if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
     {
-      eif->failed = true;
-      return false;
+      eif->failed = TRUE;
+      return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* This routine is used to export all defined symbols into the dynamic
    symbol table.  It is called via elf_link_hash_traverse.  */
 
-static boolean
+static bfd_boolean
 elf_export_symbol (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -4063,7 +4104,7 @@ elf_export_symbol (h, data)
 
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->root.type == bfd_link_hash_indirect)
-    return true;
+    return TRUE;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -4091,7 +4132,7 @@ elf_export_symbol (h, data)
              for (d = t->locals ; d != NULL; d = d->next)
                {
                  if ((*d->match) (d, h->root.root.string))
-                   return true;
+                   return TRUE;
                }
            }
        }
@@ -4101,13 +4142,13 @@ elf_export_symbol (h, data)
        doit:
          if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
            {
-             eif->failed = true;
-             return false;
+             eif->failed = TRUE;
+             return FALSE;
            }
        }
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* Look through the symbols which are defined in other shared
@@ -4115,7 +4156,7 @@ elf_export_symbol (h, data)
    dependencies.  This will be put into the .gnu.version_r section.
    This function is called via elf_link_hash_traverse.  */
 
-static boolean
+static bfd_boolean
 elf_link_find_version_dependencies (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -4134,7 +4175,7 @@ elf_link_find_version_dependencies (h, data)
       || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
       || h->dynindx == -1
       || h->verinfo.verdef == NULL)
-    return true;
+    return TRUE;
 
   /* See if we already know about this version.  */
   for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref)
@@ -4144,7 +4185,7 @@ elf_link_find_version_dependencies (h, data)
 
       for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
        if (a->vna_nodename == h->verinfo.verdef->vd_nodename)
-         return true;
+         return TRUE;
 
       break;
     }
@@ -4157,8 +4198,8 @@ elf_link_find_version_dependencies (h, data)
       t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt);
       if (t == NULL)
        {
-         rinfo->failed = true;
-         return false;
+         rinfo->failed = TRUE;
+         return FALSE;
        }
 
       t->vn_bfd = h->verinfo.verdef->vd_bfd;
@@ -4185,7 +4226,7 @@ elf_link_find_version_dependencies (h, data)
 
   t->vn_auxptr = a;
 
-  return true;
+  return TRUE;
 }
 
 /* Figure out appropriate versions for all the symbols.  We may not
@@ -4193,7 +4234,7 @@ elf_link_find_version_dependencies (h, data)
    files, so until that point we don't know which symbols should be
    local.  This function is called via elf_link_hash_traverse.  */
 
-static boolean
+static bfd_boolean
 elf_link_assign_sym_version (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -4212,35 +4253,35 @@ elf_link_assign_sym_version (h, data)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
   /* Fix the symbol flags.  */
-  eif.failed = false;
+  eif.failed = FALSE;
   eif.info = info;
   if (! elf_fix_symbol_flags (h, &eif))
     {
       if (eif.failed)
-       sinfo->failed = true;
-      return false;
+       sinfo->failed = TRUE;
+      return FALSE;
     }
 
   /* We only need version numbers for symbols defined in regular
      objects.  */
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-    return true;
+    return TRUE;
 
   bed = get_elf_backend_data (sinfo->output_bfd);
   p = strchr (h->root.root.string, ELF_VER_CHR);
   if (p != NULL && h->verinfo.vertree == NULL)
     {
       struct bfd_elf_version_tree *t;
-      boolean hidden;
+      bfd_boolean hidden;
 
-      hidden = true;
+      hidden = TRUE;
 
       /* There are two consecutive ELF_VER_CHR characters if this is
         not a hidden symbol.  */
       ++p;
       if (*p == ELF_VER_CHR)
        {
-         hidden = false;
+         hidden = FALSE;
          ++p;
        }
 
@@ -4249,7 +4290,7 @@ elf_link_assign_sym_version (h, data)
        {
          if (hidden)
            h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
-         return true;
+         return TRUE;
        }
 
       /* Look for the version.  If we find it, it is no longer weak.  */
@@ -4264,14 +4305,14 @@ elf_link_assign_sym_version (h, data)
              len = p - h->root.root.string;
              alc = bfd_malloc ((bfd_size_type) len);
              if (alc == NULL)
-               return false;
+               return FALSE;
              memcpy (alc, h->root.root.string, len - 1);
              alc[len - 1] = '\0';
              if (alc[len - 2] == ELF_VER_CHR)
                alc[len - 2] = '\0';
 
              h->verinfo.vertree = t;
-             t->used = true;
+             t->used = TRUE;
              d = NULL;
 
              if (t->globals != NULL)
@@ -4293,7 +4334,7 @@ elf_link_assign_sym_version (h, data)
                              && info->shared
                              && ! info->export_dynamic)
                            {
-                             (*bed->elf_backend_hide_symbol) (info, h, true);
+                             (*bed->elf_backend_hide_symbol) (info, h, TRUE);
                            }
 
                          break;
@@ -4316,15 +4357,15 @@ elf_link_assign_sym_version (h, data)
          /* If we aren't going to export this symbol, we don't need
             to worry about it.  */
          if (h->dynindx == -1)
-           return true;
+           return TRUE;
 
          amt = sizeof *t;
          t = ((struct bfd_elf_version_tree *)
               bfd_alloc (sinfo->output_bfd, amt));
          if (t == NULL)
            {
-             sinfo->failed = true;
-             return false;
+             sinfo->failed = TRUE;
+             return FALSE;
            }
 
          t->next = NULL;
@@ -4333,7 +4374,7 @@ elf_link_assign_sym_version (h, data)
          t->locals = NULL;
          t->deps = NULL;
          t->name_indx = (unsigned int) -1;
-         t->used = true;
+         t->used = TRUE;
 
          version_index = 1;
          /* Don't count anonymous version tag.  */
@@ -4355,8 +4396,8 @@ elf_link_assign_sym_version (h, data)
            (_("%s: undefined versioned symbol name %s"),
             bfd_get_filename (sinfo->output_bfd), h->root.root.string);
          bfd_set_error (bfd_error_bad_value);
-         sinfo->failed = true;
-         return false;
+         sinfo->failed = TRUE;
+         return FALSE;
        }
 
       if (hidden)
@@ -4379,15 +4420,15 @@ elf_link_assign_sym_version (h, data)
        {
          if (t->globals != NULL)
            {
-             boolean matched;
+             bfd_boolean matched;
 
-             matched = false;
+             matched = FALSE;
              for (d = t->globals; d != NULL; d = d->next)
                {
                  if ((*d->match) (d, h->root.root.string))
                    {
                      if (d->symver)
-                       matched = true;
+                       matched = TRUE;
                      else
                        {
                          /* There is a version without definition.  Make
@@ -4406,7 +4447,7 @@ elf_link_assign_sym_version (h, data)
              else if (matched)
                /* There is no undefined version for this symbol. Hide the
                   default one.  */
-               (*bed->elf_backend_hide_symbol) (info, h, true);
+               (*bed->elf_backend_hide_symbol) (info, h, TRUE);
            }
 
          if (t->locals != NULL)
@@ -4436,12 +4477,12 @@ elf_link_assign_sym_version (h, data)
              && info->shared
              && ! info->export_dynamic)
            {
-             (*bed->elf_backend_hide_symbol) (info, h, true);
+             (*bed->elf_backend_hide_symbol) (info, h, TRUE);
            }
        }
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* Final phase of ELF linker.  */
@@ -4496,20 +4537,20 @@ struct elf_final_link_info
   size_t shndxbuf_size;
 };
 
-static boolean elf_link_output_sym
+static bfd_boolean elf_link_output_sym
   PARAMS ((struct elf_final_link_info *, const char *,
           Elf_Internal_Sym *, asection *));
-static boolean elf_link_flush_output_syms
+static bfd_boolean elf_link_flush_output_syms
   PARAMS ((struct elf_final_link_info *));
-static boolean elf_link_output_extsym
+static bfd_boolean elf_link_output_extsym
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_sec_merge_syms
+static bfd_boolean elf_link_sec_merge_syms
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_check_versioned_symbol
+static bfd_boolean elf_link_check_versioned_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf_link_input_bfd
+static bfd_boolean elf_link_input_bfd
   PARAMS ((struct elf_final_link_info *, bfd *));
-static boolean elf_reloc_link_order
+static bfd_boolean elf_reloc_link_order
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           struct bfd_link_order *));
 
@@ -4517,15 +4558,15 @@ static boolean elf_reloc_link_order
 
 struct elf_outext_info
 {
-  boolean failed;
-  boolean localsyms;
+  bfd_boolean failed;
+  bfd_boolean localsyms;
   struct elf_final_link_info *finfo;
 };
 
 /* Compute the size of, and allocate space for, REL_HDR which is the
    section header for a section containing relocations for O.  */
 
-static boolean
+static bfd_boolean
 elf_link_size_reloc_section (abfd, rel_hdr, o)
      bfd *abfd;
      Elf_Internal_Shdr *rel_hdr;
@@ -4553,7 +4594,7 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
      we zero the allocated space.  */
   rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
   if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
-    return false;
+    return FALSE;
 
   /* We only allocate one set of hash entries, so we only do it the
      first time we are called.  */
@@ -4566,12 +4607,12 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
           bfd_zmalloc (num_rel_hashes
                        * sizeof (struct elf_link_hash_entry *)));
       if (p == NULL)
-       return false;
+       return FALSE;
 
       elf_section_data (o)->rel_hashes = p;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* When performing a relocateable link, the input relocations are
@@ -4588,91 +4629,51 @@ elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
 {
   unsigned int i;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  Elf_Internal_Rel *irel;
-  Elf_Internal_Rela *irela;
-  bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel;
+  bfd_byte *erela;
+  void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+  void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
 
-  irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
-  if (irel == NULL)
+  if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
     {
-      (*_bfd_error_handler) (_("Error: out of memory"));
-      abort ();
+      swap_in = bed->s->swap_reloc_in;
+      swap_out = bed->s->swap_reloc_out;
     }
-
-  amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
-  irela = (Elf_Internal_Rela *) bfd_zmalloc (amt);
-  if (irela == NULL)
+  else if (rel_hdr->sh_entsize == sizeof (Elf_External_Rela))
     {
-      (*_bfd_error_handler) (_("Error: out of memory"));
-      abort ();
+      swap_in = bed->s->swap_reloca_in;
+      swap_out = bed->s->swap_reloca_out;
     }
+  else
+    abort ();
+
+  if (bed->s->int_rels_per_ext_rel > MAX_INT_RELS_PER_EXT_REL)
+    abort ();
 
-  for (i = 0; i < count; i++, rel_hash++)
+  erela = rel_hdr->contents;
+  for (i = 0; i < count; i++, rel_hash++, erela += rel_hdr->sh_entsize)
     {
+      Elf_Internal_Rela irela[MAX_INT_RELS_PER_EXT_REL];
+      unsigned int j;
+
       if (*rel_hash == NULL)
        continue;
 
       BFD_ASSERT ((*rel_hash)->indx >= 0);
 
-      if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
-       {
-         Elf_External_Rel *erel;
-         unsigned int j;
-
-         erel = (Elf_External_Rel *) rel_hdr->contents + i;
-         if (bed->s->swap_reloc_in)
-           (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
-         else
-           elf_swap_reloc_in (abfd, erel, irel);
-
-         for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
-           irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
-                                        ELF_R_TYPE (irel[j].r_info));
-
-         if (bed->s->swap_reloc_out)
-           (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel);
-         else
-           elf_swap_reloc_out (abfd, irel, erel);
-       }
-      else
-       {
-         Elf_External_Rela *erela;
-         unsigned int j;
-
-         BFD_ASSERT (rel_hdr->sh_entsize
-                     == sizeof (Elf_External_Rela));
-
-         erela = (Elf_External_Rela *) rel_hdr->contents + i;
-         if (bed->s->swap_reloca_in)
-           (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
-         else
-           elf_swap_reloca_in (abfd, erela, irela);
-
-         for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
-           irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
-                                         ELF_R_TYPE (irela[j].r_info));
-
-         if (bed->s->swap_reloca_out)
-           (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela);
-         else
-           elf_swap_reloca_out (abfd, irela, erela);
-       }
+      (*swap_in) (abfd, erela, irela);
+      for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
+       irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
+                                     ELF_R_TYPE (irela[j].r_info));
+      (*swap_out) (abfd, irela, erela);
     }
-
-  free (irel);
-  free (irela);
 }
 
 struct elf_link_sort_rela
 {
   bfd_vma offset;
   enum elf_reloc_type_class type;
-  union
-  {
-    /* We use these as arrays of size int_rels_per_ext_rel.  */
-    Elf_Internal_Rel rel[1];
-    Elf_Internal_Rela rela[1];
-  } u;
+  /* We use this as an array of size int_rels_per_ext_rel.  */
+  Elf_Internal_Rela rela[1];
 };
 
 static int
@@ -4691,13 +4692,13 @@ elf_link_sort_cmp1 (A, B)
     return 1;
   if (relativea > relativeb)
     return -1;
-  if (ELF_R_SYM (a->u.rel->r_info) < ELF_R_SYM (b->u.rel->r_info))
+  if (ELF_R_SYM (a->rela->r_info) < ELF_R_SYM (b->rela->r_info))
     return -1;
-  if (ELF_R_SYM (a->u.rel->r_info) > ELF_R_SYM (b->u.rel->r_info))
+  if (ELF_R_SYM (a->rela->r_info) > ELF_R_SYM (b->rela->r_info))
     return 1;
-  if (a->u.rel->r_offset < b->u.rel->r_offset)
+  if (a->rela->r_offset < b->rela->r_offset)
     return -1;
-  if (a->u.rel->r_offset > b->u.rel->r_offset)
+  if (a->rela->r_offset > b->rela->r_offset)
     return 1;
   return 0;
 }
@@ -4721,9 +4722,9 @@ elf_link_sort_cmp2 (A, B)
     return -1;
   if (copya > copyb)
     return 1;
-  if (a->u.rel->r_offset < b->u.rel->r_offset)
+  if (a->rela->r_offset < b->rela->r_offset)
     return -1;
-  if (a->u.rel->r_offset > b->u.rel->r_offset)
+  if (a->rela->r_offset > b->rela->r_offset)
     return 1;
   return 0;
 }
@@ -4736,12 +4737,14 @@ elf_link_sort_relocs (abfd, info, psec)
 {
   bfd *dynobj = elf_hash_table (info)->dynobj;
   asection *reldyn, *o;
-  boolean rel = false;
   bfd_size_type count, size;
-  size_t i, j, ret;
-  struct elf_link_sort_rela *rela;
+  size_t i, ret, sort_elt, ext_size;
+  bfd_byte *sort, *s_non_relative, *p;
+  struct elf_link_sort_rela *sq;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
   int i2e = bed->s->int_rels_per_ext_rel;
+  void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+  void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
 
   reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
   if (reldyn == NULL || reldyn->_raw_size == 0)
@@ -4749,11 +4752,17 @@ elf_link_sort_relocs (abfd, info, psec)
       reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
       if (reldyn == NULL || reldyn->_raw_size == 0)
        return 0;
-      rel = true;
-      count = reldyn->_raw_size / sizeof (Elf_External_Rel);
+      ext_size = sizeof (Elf_External_Rel);
+      swap_in = bed->s->swap_reloc_in;
+      swap_out = bed->s->swap_reloc_out;
     }
   else
-    count = reldyn->_raw_size / sizeof (Elf_External_Rela);
+    {
+      ext_size = sizeof (Elf_External_Rela);
+      swap_in = bed->s->swap_reloca_in;
+      swap_out = bed->s->swap_reloca_out;
+    }
+  count = reldyn->_raw_size / ext_size;
 
   size = 0;
   for (o = dynobj->sections; o != NULL; o = o->next)
@@ -4765,24 +4774,10 @@ elf_link_sort_relocs (abfd, info, psec)
   if (size != reldyn->_raw_size)
     return 0;
 
-  /* We waste some memory here when N = i2e is greater than 1, since
-     we allocate space for N * sizeof (*rela) where sizeof (*rela) +
-     (N - 1) * sizeof (Elf_Internal_Rel/Rela) would do.  Also, we use
-     rela[k] only when k is a multiple of N, and then we index the
-     array within the union, such that rela[k].u.rel[i], i < N, is the
-     (i+1)th internal relocation corresponding to the (k/N)th external
-     relocation.  This is done such that the relocation swap-in and
-     swap-out functions can gen pointers to arrays of internal
-     relocations that form a single external relocation.
-
-     If C permitted arrays of structures with dynamic sizes, we could
-     do better, but trying to avoid wasting space at the end of the
-     chunk from rela[k] to rela[k+N-1] would require us to allocate a
-     separate array of pointers and since most ports have N == 1, this
-     would be more wasteful.  */
-  rela = (struct elf_link_sort_rela *) bfd_zmalloc
-    (sizeof (*rela) * count * i2e);
-  if (rela == NULL)
+  sort_elt = (sizeof (struct elf_link_sort_rela)
+             + (i2e - 1) * sizeof (Elf_Internal_Rela));
+  sort = bfd_zmalloc (sort_elt * count);
+  if (sort == NULL)
     {
       (*info->callbacks->warning)
        (info, _("Not enough memory to sort relocations"), 0, abfd, 0,
@@ -4795,116 +4790,75 @@ elf_link_sort_relocs (abfd, info, psec)
        == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
        && o->output_section == reldyn)
       {
-       if (rel)
-         {
-           Elf_External_Rel *erel, *erelend;
-           struct elf_link_sort_rela *s;
+       bfd_byte *erel, *erelend;
 
-           erel = (Elf_External_Rel *) o->contents;
-           erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
-           s = rela + (o->output_offset / sizeof (Elf_External_Rel) * i2e);
-           for (; erel < erelend; erel++, s += i2e)
-             {
-               if (bed->s->swap_reloc_in)
-                 (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel,
-                                           s->u.rel);
-               else
-                 elf_swap_reloc_in (abfd, erel, s->u.rel);
-
-               s->type = (*bed->elf_backend_reloc_type_class) (s->u.rela);
-             }
-         }
-       else
+       erel = o->contents;
+       erelend = o->contents + o->_raw_size;
+       p = sort + o->output_offset / ext_size * sort_elt;
+       while (erel < erelend)
          {
-           Elf_External_Rela *erela, *erelaend;
-           struct elf_link_sort_rela *s;
-
-           erela = (Elf_External_Rela *) o->contents;
-           erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
-           s = rela + (o->output_offset / sizeof (Elf_External_Rela) * i2e);
-           for (; erela < erelaend; erela++, s += i2e)
-             {
-               if (bed->s->swap_reloca_in)
-                 (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela,
-                                            s->u.rela);
-               else
-                 elf_swap_reloca_in (dynobj, erela, s->u.rela);
-
-               s->type = (*bed->elf_backend_reloc_type_class) (s->u.rela);
-             }
+           struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+           (*swap_in) (abfd, erel, s->rela);
+           s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
+           p += sort_elt;
+           erel += ext_size;
          }
       }
 
-  qsort (rela, (size_t) count, sizeof (*rela) * i2e, elf_link_sort_cmp1);
-  for (ret = 0; ret < count * i2e && rela[ret].type == reloc_class_relative;
-       ret += i2e)
-    ;
-  for (i = ret, j = ret; i < count * i2e; i += i2e)
+  qsort (sort, (size_t) count, sort_elt, elf_link_sort_cmp1);
+
+  for (i = 0, p = sort; i < count; i++, p += sort_elt)
+    {
+      struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+      if (s->type != reloc_class_relative)
+       break;
+    }
+  ret = i;
+  s_non_relative = p;
+
+  sq = (struct elf_link_sort_rela *) s_non_relative;
+  for (; i < count; i++, p += sort_elt)
     {
-      if (ELF_R_SYM (rela[i].u.rel->r_info)
-         != ELF_R_SYM (rela[j].u.rel->r_info))
-       j = i;
-      rela[i].offset = rela[j].u.rel->r_offset;
+      struct elf_link_sort_rela *sp = (struct elf_link_sort_rela *) p;
+      if (ELF_R_SYM (sp->rela->r_info) != ELF_R_SYM (sq->rela->r_info))
+       sq = sp;
+      sp->offset = sq->rela->r_offset;
     }
-  ret /= i2e;
-  qsort (rela + ret, (size_t) count - ret,
-        sizeof (*rela) * i2e, elf_link_sort_cmp2);
+
+  qsort (s_non_relative, (size_t) count - ret, sort_elt, elf_link_sort_cmp2);
 
   for (o = dynobj->sections; o != NULL; o = o->next)
     if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
        == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
        && o->output_section == reldyn)
       {
-       if (rel)
-         {
-           Elf_External_Rel *erel, *erelend;
-           struct elf_link_sort_rela *s;
+       bfd_byte *erel, *erelend;
 
-           erel = (Elf_External_Rel *) o->contents;
-           erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
-           s = rela + (o->output_offset / sizeof (Elf_External_Rel) * i2e);
-           for (; erel < erelend; erel++, s += i2e)
-             {
-               if (bed->s->swap_reloc_out)
-                 (*bed->s->swap_reloc_out) (abfd, s->u.rel,
-                                            (bfd_byte *) erel);
-               else
-                 elf_swap_reloc_out (abfd, s->u.rel, erel);
-             }
-         }
-       else
+       erel = o->contents;
+       erelend = o->contents + o->_raw_size;
+       p = sort + o->output_offset / ext_size * sort_elt;
+       while (erel < erelend)
          {
-           Elf_External_Rela *erela, *erelaend;
-           struct elf_link_sort_rela *s;
-
-           erela = (Elf_External_Rela *) o->contents;
-           erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
-           s = rela + (o->output_offset / sizeof (Elf_External_Rela) * i2e);
-           for (; erela < erelaend; erela++, s += i2e)
-             {
-               if (bed->s->swap_reloca_out)
-                 (*bed->s->swap_reloca_out) (dynobj, s->u.rela,
-                                             (bfd_byte *) erela);
-               else
-                 elf_swap_reloca_out (dynobj, s->u.rela, erela);
-             }
+           struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+           (*swap_out) (abfd, s->rela, erel);
+           p += sort_elt;
+           erel += ext_size;
          }
       }
 
-  free (rela);
   *psec = reldyn;
   return ret;
 }
 
 /* Do the final step of an ELF link.  */
 
-boolean
+bfd_boolean
 elf_bfd_final_link (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  boolean dynamic;
-  boolean emit_relocs;
+  bfd_boolean dynamic;
+  bfd_boolean emit_relocs;
   bfd *dynobj;
   struct elf_final_link_info finfo;
   register asection *o;
@@ -4923,13 +4877,13 @@ elf_bfd_final_link (abfd, info)
   Elf_Internal_Shdr *symstrtab_hdr;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
   struct elf_outext_info eoinfo;
-  boolean merged;
+  bfd_boolean merged;
   size_t relativecount = 0;
   asection *reldyn = 0;
   bfd_size_type amt;
 
   if (! is_elf_hash_table (info))
-    return false;
+    return FALSE;
 
   if (info->shared)
     abfd->flags |= DYNAMIC;
@@ -4945,7 +4899,7 @@ elf_bfd_final_link (abfd, info)
   finfo.output_bfd = abfd;
   finfo.symstrtab = elf_stringtab_init ();
   if (finfo.symstrtab == NULL)
-    return false;
+    return FALSE;
 
   if (! dynamic)
     {
@@ -4991,7 +4945,7 @@ elf_bfd_final_link (abfd, info)
   max_internal_reloc_count = 0;
   max_sym_count = 0;
   max_sym_shndx_count = 0;
-  merged = false;
+  merged = FALSE;
   for (o = abfd->sections; o != (asection *) NULL; o = o->next)
     {
       o->reloc_count = 0;
@@ -5011,10 +4965,10 @@ elf_bfd_final_link (abfd, info)
                 link.  This will normally be every section.  We need
                 to do this so that we can identify any sections which
                 the linker has decided to not include.  */
-             sec->linker_mark = true;
+             sec->linker_mark = TRUE;
 
              if (sec->flags & SEC_MERGE)
-               merged = true;
+               merged = TRUE;
 
              if (info->relocateable || info->emitrelocations)
                o->reloc_count += sec->reloc_count;
@@ -5202,7 +5156,7 @@ elf_bfd_final_link (abfd, info)
   symtab_hdr->sh_addralign = bed->s->file_align;
 
   off = elf_tdata (abfd)->next_file_pos;
-  off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true);
+  off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE);
 
   /* Note that at this point elf_tdata (abfd)->next_file_pos is
      incorrect.  We do not yet know the size of the .symtab section.
@@ -5401,7 +5355,7 @@ elf_bfd_final_link (abfd, info)
      know how bad the memory loss will be.  */
 
   for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
-    sub->output_has_begun = false;
+    sub->output_has_begun = FALSE;
   for (o = abfd->sections; o != NULL; o = o->next)
     {
       for (p = o->link_order_head; p != NULL; p = p->next)
@@ -5415,7 +5369,7 @@ elf_bfd_final_link (abfd, info)
                {
                  if (! elf_link_input_bfd (&finfo, sub))
                    goto error_return;
-                 sub->output_has_begun = true;
+                 sub->output_has_begun = TRUE;
                }
            }
          else if (p->type == bfd_section_reloc_link_order
@@ -5438,13 +5392,13 @@ elf_bfd_final_link (abfd, info)
      prior to any global symbols.  FIXME: We should only do this if
      some global symbols were, in fact, converted to become local.
      FIXME: Will this work correctly with the Irix 5 linker?  */
-  eoinfo.failed = false;
+  eoinfo.failed = FALSE;
   eoinfo.finfo = &finfo;
-  eoinfo.localsyms = true;
+  eoinfo.localsyms = TRUE;
   elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
                          (PTR) &eoinfo);
   if (eoinfo.failed)
-    return false;
+    return FALSE;
 
   /* That wrote out all the local symbols.  Finish up the symbol table
      with the global symbols. Even if we want to strip everything we
@@ -5532,30 +5486,29 @@ elf_bfd_final_link (abfd, info)
     }
 
   /* We get the global symbols from the hash table.  */
-  eoinfo.failed = false;
-  eoinfo.localsyms = false;
+  eoinfo.failed = FALSE;
+  eoinfo.localsyms = FALSE;
   eoinfo.finfo = &finfo;
   elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
                          (PTR) &eoinfo);
   if (eoinfo.failed)
-    return false;
+    return FALSE;
 
   /* If backend needs to output some symbols not present in the hash
      table, do it now.  */
   if (bed->elf_backend_output_arch_syms)
     {
-      typedef boolean (*out_sym_func) PARAMS ((PTR, const char *,
-                                              Elf_Internal_Sym *,
-                                              asection *));
+      typedef bfd_boolean (*out_sym_func)
+       PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *));
 
       if (! ((*bed->elf_backend_output_arch_syms)
             (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym)))
-       return false;
+       return FALSE;
     }
 
   /* Flush all symbols to the file.  */
   if (! elf_link_flush_output_syms (&finfo))
-    return false;
+    return FALSE;
 
   /* Now we know the size of the symtab section.  */
   off += symtab_hdr->sh_size;
@@ -5570,11 +5523,11 @@ elf_bfd_final_link (abfd, info)
       symtab_shndx_hdr->sh_size = amt;
 
       off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
-                                                      off, true);
+                                                      off, TRUE);
 
       if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
          || (bfd_bwrite ((PTR) finfo.symshndxbuf, amt, abfd) != amt))
-       return false;
+       return FALSE;
     }
 
 
@@ -5592,14 +5545,14 @@ elf_bfd_final_link (abfd, info)
   /* sh_offset is set just below.  */
   symstrtab_hdr->sh_addralign = 1;
 
-  off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true);
+  off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, TRUE);
   elf_tdata (abfd)->next_file_pos = off;
 
   if (bfd_get_symcount (abfd) > 0)
     {
       if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
          || ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
-       return false;
+       return FALSE;
     }
 
   /* Adjust the relocs to have the correct symbol indices.  */
@@ -5676,7 +5629,7 @@ elf_bfd_final_link (abfd, info)
                struct elf_link_hash_entry *h;
 
                h = elf_link_hash_lookup (elf_hash_table (info), name,
-                                         false, false, true);
+                                         FALSE, FALSE, TRUE);
                if (h != NULL
                    && (h->root.type == bfd_link_hash_defined
                        || h->root.type == bfd_link_hash_defweak))
@@ -5838,7 +5791,7 @@ elf_bfd_final_link (abfd, info)
 
   if (info->relocateable)
     {
-      boolean failed = false;
+      bfd_boolean failed = FALSE;
 
       bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
       if (failed)
@@ -5887,9 +5840,9 @@ elf_bfd_final_link (abfd, info)
        free (elf_section_data (o)->rel_hashes);
     }
 
-  elf_tdata (abfd)->linker = true;
+  elf_tdata (abfd)->linker = TRUE;
 
-  return true;
+  return TRUE;
 
  error_return:
   if (finfo.symstrtab != NULL)
@@ -5921,12 +5874,12 @@ elf_bfd_final_link (abfd, info)
        free (elf_section_data (o)->rel_hashes);
     }
 
-  return false;
+  return FALSE;
 }
 
 /* Add a symbol to the output symbol table.  */
 
-static boolean
+static bfd_boolean
 elf_link_output_sym (finfo, name, elfsym, input_sec)
      struct elf_final_link_info *finfo;
      const char *name;
@@ -5935,12 +5888,9 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
 {
   Elf_External_Sym *dest;
   Elf_External_Sym_Shndx *destshndx;
-
-  boolean (*output_symbol_hook) PARAMS ((bfd *,
-                                        struct bfd_link_info *info,
-                                        const char *,
-                                        Elf_Internal_Sym *,
-                                        asection *));
+  bfd_boolean (*output_symbol_hook)
+    PARAMS ((bfd *, struct bfd_link_info *info, const char *,
+            Elf_Internal_Sym *, asection *));
 
   output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
     elf_backend_link_output_symbol_hook;
@@ -5948,7 +5898,7 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
     {
       if (! ((*output_symbol_hook)
             (finfo->output_bfd, finfo->info, name, elfsym, input_sec)))
-       return false;
+       return FALSE;
     }
 
   if (name == (const char *) NULL || *name == '\0')
@@ -5958,15 +5908,15 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
   else
     {
       elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
-                                                           name, true, false);
+                                                           name, TRUE, FALSE);
       if (elfsym->st_name == (unsigned long) -1)
-       return false;
+       return FALSE;
     }
 
   if (finfo->symbuf_count >= finfo->symbuf_size)
     {
       if (! elf_link_flush_output_syms (finfo))
-       return false;
+       return FALSE;
     }
 
   dest = finfo->symbuf + finfo->symbuf_count;
@@ -5980,7 +5930,7 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
          amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
          finfo->symshndxbuf = destshndx = bfd_realloc (destshndx, amt * 2);
          if (destshndx == NULL)
-           return false;
+           return FALSE;
          memset ((char *) destshndx + amt, 0, amt);
          finfo->shndxbuf_size *= 2;
        }
@@ -5991,12 +5941,12 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
   finfo->symbuf_count += 1;
   bfd_get_symcount (finfo->output_bfd) += 1;
 
-  return true;
+  return TRUE;
 }
 
 /* Flush the output symbols to the file.  */
 
-static boolean
+static bfd_boolean
 elf_link_flush_output_syms (finfo)
      struct elf_final_link_info *finfo;
 {
@@ -6011,19 +5961,19 @@ elf_link_flush_output_syms (finfo)
       amt = finfo->symbuf_count * sizeof (Elf_External_Sym);
       if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
          || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt)
-       return false;
+       return FALSE;
 
       hdr->sh_size += amt;
       finfo->symbuf_count = 0;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Adjust all external symbols pointing into SEC_MERGE sections
    to reflect the object merging within the sections.  */
 
-static boolean
+static bfd_boolean
 elf_link_sec_merge_syms (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -6036,7 +5986,7 @@ elf_link_sec_merge_syms (h, data)
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
-      && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+      && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
       bfd *output_bfd = (bfd *) data;
 
@@ -6047,14 +5997,14 @@ elf_link_sec_merge_syms (h, data)
                                    h->root.u.def.value, (bfd_vma) 0);
     }
 
-  return true;
+  return TRUE;
 }
 
 /* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
    allowing an unsatisfied unversioned symbol in the DSO to match a
    versioned symbol that would normally require an explicit version.  */
 
-static boolean
+static bfd_boolean
 elf_link_check_versioned_symbol (info, h)
      struct bfd_link_info *info;
      struct elf_link_hash_entry *h;
@@ -6065,7 +6015,7 @@ elf_link_check_versioned_symbol (info, h)
   if ((undef_bfd->flags & DYNAMIC) == 0
       || info->hash->creator->flavour != bfd_target_elf_flavour
       || elf_dt_soname (h->root.u.undef.abfd) == NULL)
-    return false;
+    return FALSE;
 
   for (loaded = elf_hash_table (info)->loaded;
        loaded != NULL;
@@ -6111,7 +6061,7 @@ elf_link_check_versioned_symbol (info, h)
       isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
                                      NULL, NULL, NULL);
       if (isymbuf == NULL)
-       return false;
+       return FALSE;
 
       /* Read in any version definitions.  */
       versymhdr = &elf_tdata (input)->dynversym_hdr;
@@ -6126,7 +6076,7 @@ elf_link_check_versioned_symbol (info, h)
          free (extversym);
        error_ret:
          free (isymbuf);
-         return false;
+         return FALSE;
        }
 
       ever = extversym + extsymoff;
@@ -6160,7 +6110,7 @@ elf_link_check_versioned_symbol (info, h)
              /* This is the oldest (default) sym.  We can use it.  */
              free (extversym);
              free (isymbuf);
-             return true;
+             return TRUE;
            }
        }
 
@@ -6168,7 +6118,7 @@ elf_link_check_versioned_symbol (info, h)
       free (isymbuf);
     }
 
-  return false;
+  return FALSE;
 }
 
 /* Add an external symbol to the symbol table.  This is called from
@@ -6178,14 +6128,14 @@ elf_link_check_versioned_symbol (info, h)
    script.  The second time we output the symbols that are still
    global symbols.  */
 
-static boolean
+static bfd_boolean
 elf_link_output_extsym (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
 {
   struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
   struct elf_final_link_info *finfo = eoinfo->finfo;
-  boolean strip;
+  bfd_boolean strip;
   Elf_Internal_Sym sym;
   asection *input_sec;
 
@@ -6193,19 +6143,19 @@ elf_link_output_extsym (h, data)
     {
       h = (struct elf_link_hash_entry *) h->root.u.i.link;
       if (h->root.type == bfd_link_hash_new)
-       return true;
+       return TRUE;
     }
 
   /* Decide whether to output this symbol in this pass.  */
   if (eoinfo->localsyms)
     {
       if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
-       return true;
+       return TRUE;
     }
   else
     {
       if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
-       return true;
+       return TRUE;
     }
 
   /* If we are not creating a shared library, and this symbol is
@@ -6216,8 +6166,7 @@ elf_link_output_extsym (h, data)
      referenced by regular files, because we will already have issued
      warnings for them.  */
   if (! finfo->info->relocateable
-      && ! finfo->info->allow_shlib_undefined
-      && ! finfo->info->shared
+      && (! finfo->info->shared || ! finfo->info->allow_shlib_undefined)
       && h->root.type == bfd_link_hash_undefined
       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
@@ -6225,10 +6174,10 @@ elf_link_output_extsym (h, data)
     {
       if (! ((*finfo->info->callbacks->undefined_symbol)
             (finfo->info, h->root.root.string, h->root.u.undef.abfd,
-             (asection *) NULL, (bfd_vma) 0, true)))
+             (asection *) NULL, (bfd_vma) 0, TRUE)))
        {
-         eoinfo->failed = true;
-         return false;
+         eoinfo->failed = TRUE;
+         return FALSE;
        }
     }
 
@@ -6237,27 +6186,32 @@ elf_link_output_extsym (h, data)
      h->indx is set to -2, the symbol is used by a reloc and we must
      output it.  */
   if (h->indx == -2)
-    strip = false;
+    strip = FALSE;
   else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
            || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
           && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
           && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
-    strip = true;
-  else if (finfo->info->strip == strip_all
-          || (finfo->info->strip == strip_some
-              && bfd_hash_lookup (finfo->info->keep_hash,
-                                  h->root.root.string,
-                                  false, false) == NULL))
-    strip = true;
+    strip = TRUE;
+  else if (finfo->info->strip == strip_all)
+    strip = TRUE;
+  else if (finfo->info->strip == strip_some
+          && bfd_hash_lookup (finfo->info->keep_hash,
+                              h->root.root.string, FALSE, FALSE) == NULL)
+    strip = TRUE;
+  else if (finfo->info->strip_discarded
+          && (h->root.type == bfd_link_hash_defined
+              || h->root.type == bfd_link_hash_defweak)
+          && elf_discarded_section (h->root.u.def.section))
+    strip = TRUE;
   else
-    strip = false;
+    strip = FALSE;
 
   /* If we're stripping it, and it's not a dynamic symbol, there's
      nothing else to do unless it is a forced local symbol.  */
   if (strip
       && h->dynindx == -1
       && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
-    return true;
+    return TRUE;
 
   sym.st_value = 0;
   sym.st_size = h->size;
@@ -6276,7 +6230,7 @@ elf_link_output_extsym (h, data)
     case bfd_link_hash_new:
     case bfd_link_hash_warning:
       abort ();
-      return false;
+      return FALSE;
 
     case bfd_link_hash_undefined:
     case bfd_link_hash_undefweak:
@@ -6300,8 +6254,8 @@ elf_link_output_extsym (h, data)
                   bfd_get_filename (finfo->output_bfd),
                   input_sec->output_section->name,
                   input_sec->name);
-               eoinfo->failed = true;
-               return false;
+               eoinfo->failed = TRUE;
+               return FALSE;
              }
 
            /* ELF symbols in relocateable files are section relative,
@@ -6343,7 +6297,7 @@ elf_link_output_extsym (h, data)
         foo is used with no version, then we add an indirect symbol
         foo which points to foo@@GNU_1.2.  We ignore these symbols,
         since the indirected symbol is already in the hash table.  */
-      return true;
+      return TRUE;
     }
 
   /* Give the processor backend a chance to tweak the symbol value,
@@ -6362,8 +6316,8 @@ elf_link_output_extsym (h, data)
       if (! ((*bed->elf_backend_finish_dynamic_symbol)
             (finfo->output_bfd, finfo->info, h, &sym)))
        {
-         eoinfo->failed = true;
-         return false;
+         eoinfo->failed = TRUE;
+         return FALSE;
        }
     }
 
@@ -6454,24 +6408,24 @@ elf_link_output_extsym (h, data)
   /* If we're stripping it, then it was just a dynamic symbol, and
      there's nothing else to do.  */
   if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
-    return true;
+    return TRUE;
 
   h->indx = bfd_get_symcount (finfo->output_bfd);
 
   if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec))
     {
-      eoinfo->failed = true;
-      return false;
+      eoinfo->failed = TRUE;
+      return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Copy the relocations indicated by the INTERNAL_RELOCS (which
    originated from the section given by INPUT_REL_HDR) to the
    OUTPUT_BFD.  */
 
-static boolean
+static bfd_boolean
 elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
                        internal_relocs)
      bfd *output_bfd;
@@ -6481,11 +6435,12 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
 {
   Elf_Internal_Rela *irela;
   Elf_Internal_Rela *irelaend;
+  bfd_byte *erel;
   Elf_Internal_Shdr *output_rel_hdr;
   asection *output_section;
   unsigned int *rel_countp = NULL;
   struct elf_backend_data *bed;
-  bfd_size_type amt;
+  void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
 
   output_section = input_section->output_section;
   output_rel_hdr = NULL;
@@ -6511,66 +6466,34 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
         bfd_archive_filename (input_section->owner),
         input_section->name);
       bfd_set_error (bfd_error_wrong_object_format);
-      return false;
+      return FALSE;
     }
 
   bed = get_elf_backend_data (output_bfd);
+  if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
+    swap_out = bed->s->swap_reloc_out;
+  else if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela))
+    swap_out = bed->s->swap_reloca_out;
+  else
+    abort ();
+
+  erel = output_rel_hdr->contents;
+  erel += *rel_countp * input_rel_hdr->sh_entsize;
   irela = internal_relocs;
   irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
                      * bed->s->int_rels_per_ext_rel);
-
-  if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
+  while (irela < irelaend)
     {
-      Elf_External_Rel *erel;
-      Elf_Internal_Rel *irel;
-
-      amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
-      irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
-      if (irel == NULL)
-       {
-         (*_bfd_error_handler) (_("Error: out of memory"));
-         abort ();
-       }
-
-      erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp);
-      for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++)
-       {
-         unsigned int i;
-
-         for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
-           {
-             irel[i].r_offset = irela[i].r_offset;
-             irel[i].r_info = irela[i].r_info;
-             BFD_ASSERT (irela[i].r_addend == 0);
-           }
-
-         if (bed->s->swap_reloc_out)
-           (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel);
-         else
-           elf_swap_reloc_out (output_bfd, irel, erel);
-       }
-
-      free (irel);
-    }
-  else
-    {
-      Elf_External_Rela *erela;
-
-      BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela));
-
-      erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp);
-      for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++)
-       if (bed->s->swap_reloca_out)
-         (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela);
-       else
-         elf_swap_reloca_out (output_bfd, irela, erela);
+      (*swap_out) (output_bfd, irela, erel);
+      irela += bed->s->int_rels_per_ext_rel;
+      erel += input_rel_hdr->sh_entsize;
     }
 
   /* Bump the counter, so that we know where to add the next set of
      relocations.  */
   *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
 
-  return true;
+  return TRUE;
 }
 
 /* Link an input file into the linker output file.  This function
@@ -6578,15 +6501,14 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
    This is so that we only have to read the local symbols once, and
    don't have to keep them in memory.  */
 
-static boolean
+static bfd_boolean
 elf_link_input_bfd (finfo, input_bfd)
      struct elf_final_link_info *finfo;
      bfd *input_bfd;
 {
-  boolean (*relocate_section) PARAMS ((bfd *, struct bfd_link_info *,
-                                      bfd *, asection *, bfd_byte *,
-                                      Elf_Internal_Rela *,
-                                      Elf_Internal_Sym *, asection **));
+  bfd_boolean (*relocate_section)
+    PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+            Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
   bfd *output_bfd;
   Elf_Internal_Shdr *symtab_hdr;
   size_t locsymcount;
@@ -6598,7 +6520,7 @@ elf_link_input_bfd (finfo, input_bfd)
   asection **ppsection;
   asection *o;
   struct elf_backend_data *bed;
-  boolean emit_relocs;
+  bfd_boolean emit_relocs;
   struct elf_link_hash_entry **sym_hashes;
 
   output_bfd = finfo->output_bfd;
@@ -6609,7 +6531,7 @@ elf_link_input_bfd (finfo, input_bfd)
      we don't want the local symbols, and we don't want the section
      contents.  */
   if ((input_bfd->flags & DYNAMIC) != 0)
-    return true;
+    return TRUE;
 
   emit_relocs = (finfo->info->relocateable
                 || finfo->info->emitrelocations
@@ -6636,7 +6558,7 @@ elf_link_input_bfd (finfo, input_bfd)
                                      finfo->external_syms,
                                      finfo->locsym_shndx);
       if (isymbuf == NULL)
-       return false;
+       return FALSE;
     }
 
   /* Find local symbol sections and adjust values of symbols in
@@ -6669,7 +6591,7 @@ elf_link_input_bfd (finfo, input_bfd)
        {
          isec = section_from_elf_index (input_bfd, isym->st_shndx);
          if (isec
-             && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
+             && isec->sec_info_type == ELF_INFO_TYPE_MERGE
              && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
            isym->st_value =
              _bfd_merged_section_offset (output_bfd, &isec,
@@ -6729,11 +6651,11 @@ elf_link_input_bfd (finfo, input_bfd)
       name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
                                              isym->st_name);
       if (name == NULL)
-       return false;
+       return FALSE;
 
       /* See if we are discarding symbols with this name.  */
       if ((finfo->info->strip == strip_some
-          && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
+          && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
               == NULL))
          || (((finfo->info->discard == discard_sec_merge
                && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable)
@@ -6749,7 +6671,7 @@ elf_link_input_bfd (finfo, input_bfd)
       osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
                                                         isec->output_section);
       if (osym.st_shndx == SHN_BAD)
-       return false;
+       return FALSE;
 
       *pindex = bfd_get_symcount (output_bfd);
 
@@ -6773,7 +6695,7 @@ elf_link_input_bfd (finfo, input_bfd)
        }
 
       if (! elf_link_output_sym (finfo, name, &osym, isec))
-       return false;
+       return FALSE;
     }
 
   /* Relocate the contents of each section.  */
@@ -6810,7 +6732,7 @@ elf_link_input_bfd (finfo, input_bfd)
          contents = finfo->contents;
          if (! bfd_get_section_contents (input_bfd, o, contents,
                                          (file_ptr) 0, o->_raw_size))
-           return false;
+           return FALSE;
        }
 
       if ((o->flags & SEC_RELOC) != 0)
@@ -6820,10 +6742,10 @@ elf_link_input_bfd (finfo, input_bfd)
          /* Get the swapped relocs.  */
          internal_relocs = (NAME(_bfd_elf,link_read_relocs)
                             (input_bfd, o, finfo->external_relocs,
-                             finfo->internal_relocs, false));
+                             finfo->internal_relocs, FALSE));
          if (internal_relocs == NULL
              && o->reloc_count > 0)
-           return false;
+           return FALSE;
 
          /* Run through the relocs looking for any against symbols
             from discarded sections and section symbols from
@@ -6868,8 +6790,8 @@ elf_link_input_bfd (finfo, input_bfd)
                              if (! ((*finfo->info->callbacks->undefined_symbol)
                                     (finfo->info, h->root.root.string,
                                      input_bfd, o, rel->r_offset,
-                                     true)))
-                               return false;
+                                     TRUE)))
+                               return FALSE;
                            }
                        }
                    }
@@ -6889,7 +6811,7 @@ elf_link_input_bfd (finfo, input_bfd)
                            }
                          else
                            {
-                             boolean ok;
+                             bfd_boolean ok;
                              const char *msg
                                = _("local symbols in discarded section %s");
                              bfd_size_type amt
@@ -6904,11 +6826,11 @@ elf_link_input_bfd (finfo, input_bfd)
                                    ->undefined_symbol) (finfo->info, buf,
                                                         input_bfd, o,
                                                         rel->r_offset,
-                                                        true);
+                                                        TRUE);
                              if (buf != sec->name)
                                free (buf);
                              if (!ok)
-                               return false;
+                               return FALSE;
                            }
                        }
                    }
@@ -6940,7 +6862,7 @@ elf_link_input_bfd (finfo, input_bfd)
                                     internal_relocs,
                                     isymbuf,
                                     finfo->sections))
-           return false;
+           return FALSE;
 
          if (emit_relocs)
            {
@@ -6950,10 +6872,10 @@ elf_link_input_bfd (finfo, input_bfd)
              struct elf_link_hash_entry **rel_hash;
              Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
              unsigned int next_erel;
-             boolean (*reloc_emitter) PARAMS ((bfd *, asection *,
-                                               Elf_Internal_Shdr *,
-                                               Elf_Internal_Rela *));
-             boolean rela_normal;
+             bfd_boolean (*reloc_emitter)
+               PARAMS ((bfd *, asection *, Elf_Internal_Shdr *,
+                        Elf_Internal_Rela *));
+             bfd_boolean rela_normal;
 
              input_rel_hdr = &elf_section_data (o)->rel_hdr;
              rela_normal = (bed->rela_normal
@@ -6991,7 +6913,7 @@ elf_link_input_bfd (finfo, input_bfd)
                         Turn it into an R_*_NONE reloc, at the same
                         offset as the last reloc.  elf_eh_frame.c and
                         elf_bfd_discard_info rely on reloc offsets
-                        being ordered.  */ 
+                        being ordered.  */
                      irela->r_offset = last_offset;
                      irela->r_info = 0;
                      irela->r_addend = 0;
@@ -7060,7 +6982,7 @@ elf_link_input_bfd (finfo, input_bfd)
                      else if (sec == NULL || sec->owner == NULL)
                        {
                          bfd_set_error (bfd_error_bad_value);
-                         return false;
+                         return FALSE;
                        }
                      else
                        {
@@ -7085,7 +7007,7 @@ elf_link_input_bfd (finfo, input_bfd)
                            {
                              /* You can't do ld -r -s.  */
                              bfd_set_error (bfd_error_invalid_operation);
-                             return false;
+                             return FALSE;
                            }
 
                          /* This symbol was skipped earlier, but
@@ -7095,14 +7017,14 @@ elf_link_input_bfd (finfo, input_bfd)
                          name = (bfd_elf_string_from_elf_section
                                  (input_bfd, shlink, sym.st_name));
                          if (name == NULL)
-                           return false;
+                           return FALSE;
 
                          osec = sec->output_section;
                          sym.st_shndx =
                            _bfd_elf_section_from_bfd_section (output_bfd,
                                                               osec);
                          if (sym.st_shndx == SHN_BAD)
-                           return false;
+                           return FALSE;
 
                          sym.st_value += sec->output_offset;
                          if (! finfo->info->relocateable)
@@ -7121,7 +7043,7 @@ elf_link_input_bfd (finfo, input_bfd)
                            = bfd_get_symcount (output_bfd);
 
                          if (! elf_link_output_sym (finfo, name, &sym, sec))
-                           return false;
+                           return FALSE;
                        }
 
                      r_symndx = finfo->indices[r_symndx];
@@ -7142,7 +7064,7 @@ elf_link_input_bfd (finfo, input_bfd)
              if (input_rel_hdr->sh_size != 0
                  && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
                                         internal_relocs))
-               return false;
+               return FALSE;
 
              input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
              if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0)
@@ -7151,7 +7073,7 @@ elf_link_input_bfd (finfo, input_bfd)
                                      * bed->s->int_rels_per_ext_rel);
                  if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2,
                                          internal_relocs))
-                   return false;
+                   return FALSE;
                }
            }
        }
@@ -7162,25 +7084,25 @@ elf_link_input_bfd (finfo, input_bfd)
        {
          /* Section written out.  */
        }
-      else switch (elf_section_data (o)->sec_info_type)
+      else switch (o->sec_info_type)
        {
        case ELF_INFO_TYPE_STABS:
          if (! (_bfd_write_section_stabs
                 (output_bfd,
                  &elf_hash_table (finfo->info)->stab_info,
                  o, &elf_section_data (o)->sec_info, contents)))
-           return false;
+           return FALSE;
          break;
        case ELF_INFO_TYPE_MERGE:
          if (! _bfd_write_merged_section (output_bfd, o,
                                           elf_section_data (o)->sec_info))
-           return false;
+           return FALSE;
          break;
        case ELF_INFO_TYPE_EH_FRAME:
          {
            if (! _bfd_elf_write_section_eh_frame (output_bfd, finfo->info,
                                                   o, contents))
-             return false;
+             return FALSE;
          }
          break;
        default:
@@ -7193,13 +7115,13 @@ elf_link_input_bfd (finfo, input_bfd)
                                               contents,
                                               (file_ptr) o->output_offset,
                                               sec_size))
-             return false;
+             return FALSE;
          }
          break;
        }
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Generate a reloc when linking an ELF file.  This is a reloc
@@ -7207,7 +7129,7 @@ elf_link_input_bfd (finfo, input_bfd)
    is used to build constructor and destructor tables when linking
    with -Ur.  */
 
-static boolean
+static bfd_boolean
 elf_reloc_link_order (output_bfd, info, output_section, link_order)
      bfd *output_bfd;
      struct bfd_link_info *info;
@@ -7221,12 +7143,15 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
   struct elf_link_hash_entry **rel_hash_ptr;
   Elf_Internal_Shdr *rel_hdr;
   struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+  Elf_Internal_Rela irel[MAX_INT_RELS_PER_EXT_REL];
+  bfd_byte *erel;
+  unsigned int i;
 
   howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
   if (howto == NULL)
     {
       bfd_set_error (bfd_error_bad_value);
-      return false;
+      return FALSE;
     }
 
   addend = link_order->u.reloc.p->addend;
@@ -7250,7 +7175,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
       h = ((struct elf_link_hash_entry *)
           bfd_wrapped_link_hash_lookup (output_bfd, info,
                                         link_order->u.reloc.p->u.name,
-                                        false, false, true));
+                                        FALSE, FALSE, TRUE));
       if (h != NULL
          && (h->root.type == bfd_link_hash_defined
              || h->root.type == bfd_link_hash_defweak))
@@ -7278,7 +7203,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
          if (! ((*info->callbacks->unattached_reloc)
                 (info, link_order->u.reloc.p->u.name, (bfd *) NULL,
                  (asection *) NULL, (bfd_vma) 0)))
-           return false;
+           return FALSE;
          indx = 0;
        }
     }
@@ -7290,13 +7215,13 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
       bfd_size_type size;
       bfd_reloc_status_type rstat;
       bfd_byte *buf;
-      boolean ok;
+      bfd_boolean ok;
       const char *sym_name;
 
       size = bfd_get_reloc_size (howto);
       buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == (bfd_byte *) NULL)
-       return false;
+       return FALSE;
       rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf);
       switch (rstat)
        {
@@ -7318,7 +7243,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
                  (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
            {
              free (buf);
-             return false;
+             return FALSE;
            }
          break;
        }
@@ -7326,7 +7251,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
                                     (file_ptr) link_order->offset, size);
       free (buf);
       if (! ok)
-       return false;
+       return FALSE;
     }
 
   /* The address of a reloc is relative to the section in a
@@ -7336,68 +7261,38 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
   if (! info->relocateable)
     offset += output_section->vma;
 
-  rel_hdr = &elf_section_data (output_section)->rel_hdr;
+  for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
+    {
+      irel[i].r_offset = offset;
+      irel[i].r_info = 0;
+      irel[i].r_addend = 0;
+    }
+  irel[0].r_info = ELF_R_INFO (indx, howto->type);
 
+  rel_hdr = &elf_section_data (output_section)->rel_hdr;
+  erel = rel_hdr->contents;
   if (rel_hdr->sh_type == SHT_REL)
     {
-      bfd_size_type size;
-      Elf_Internal_Rel *irel;
-      Elf_External_Rel *erel;
-      unsigned int i;
-
-      size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
-      irel = (Elf_Internal_Rel *) bfd_zmalloc (size);
-      if (irel == NULL)
-       return false;
-
-      for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
-       irel[i].r_offset = offset;
-      irel[0].r_info = ELF_R_INFO (indx, howto->type);
-
-      erel = ((Elf_External_Rel *) rel_hdr->contents
-             + elf_section_data (output_section)->rel_count);
-
-      if (bed->s->swap_reloc_out)
-       (*bed->s->swap_reloc_out) (output_bfd, irel, (bfd_byte *) erel);
-      else
-       elf_swap_reloc_out (output_bfd, irel, erel);
-
-      free (irel);
+      erel += (elf_section_data (output_section)->rel_count
+              * sizeof (Elf_External_Rel));
+      (*bed->s->swap_reloc_out) (output_bfd, irel, erel);
     }
   else
     {
-      bfd_size_type size;
-      Elf_Internal_Rela *irela;
-      Elf_External_Rela *erela;
-      unsigned int i;
-
-      size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
-      irela = (Elf_Internal_Rela *) bfd_zmalloc (size);
-      if (irela == NULL)
-       return false;
-
-      for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
-       irela[i].r_offset = offset;
-      irela[0].r_info = ELF_R_INFO (indx, howto->type);
-      irela[0].r_addend = addend;
-
-      erela = ((Elf_External_Rela *) rel_hdr->contents
-              + elf_section_data (output_section)->rel_count);
-
-      if (bed->s->swap_reloca_out)
-       (*bed->s->swap_reloca_out) (output_bfd, irela, (bfd_byte *) erela);
-      else
-       elf_swap_reloca_out (output_bfd, irela, erela);
+      irel[0].r_addend = addend;
+      erel += (elf_section_data (output_section)->rel_count
+              * sizeof (Elf_External_Rela));
+      (*bed->s->swap_reloca_out) (output_bfd, irel, erel);
     }
 
   ++elf_section_data (output_section)->rel_count;
 
-  return true;
+  return TRUE;
 }
 \f
 /* Allocate a pointer to live in a linker created section.  */
 
-boolean
+bfd_boolean
 elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -7419,14 +7314,14 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
       if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer,
                                                rel->r_addend,
                                                lsect->which))
-       return true;
+       return TRUE;
 
       ptr_linker_section_ptr = &h->linker_section_pointer;
       /* Make sure this symbol is output as a dynamic symbol.  */
       if (h->dynindx == -1)
        {
          if (! elf_link_record_dynamic_symbol (info, h))
-           return false;
+           return FALSE;
        }
 
       if (lsect->rel_section)
@@ -7448,7 +7343,7 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
          ptr = (elf_linker_section_pointers_t **) bfd_alloc (abfd, amt);
 
          if (!ptr)
-           return false;
+           return FALSE;
 
          elf_local_ptr_offsets (abfd) = ptr;
          for (i = 0; i < num_symbols; i++)
@@ -7459,7 +7354,7 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
       if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx],
                                                rel->r_addend,
                                                lsect->which))
-       return true;
+       return TRUE;
 
       ptr_linker_section_ptr = &ptr[r_symndx];
 
@@ -7480,12 +7375,12 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
   linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, amt);
 
   if (!linker_section_ptr)
-    return false;
+    return FALSE;
 
   linker_section_ptr->next = *ptr_linker_section_ptr;
   linker_section_ptr->addend = rel->r_addend;
   linker_section_ptr->which = lsect->which;
-  linker_section_ptr->written_address_p = false;
+  linker_section_ptr->written_address_p = FALSE;
   *ptr_linker_section_ptr = linker_section_ptr;
 
 #if 0
@@ -7520,7 +7415,7 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
           (long) lsect->section->_raw_size);
 #endif
 
-  return true;
+  return TRUE;
 }
 \f
 #if ARCH_SIZE==64
@@ -7573,7 +7468,7 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
             is done in the finish_dynamic_symbol routine.  */
          if (!linker_section_ptr->written_address_p)
            {
-             linker_section_ptr->written_address_p = true;
+             linker_section_ptr->written_address_p = TRUE;
              bfd_put_ptr (output_bfd,
                           relocation + linker_section_ptr->addend,
                           (lsect->section->contents
@@ -7597,26 +7492,17 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
       /* Write out pointer if it hasn't been rewritten out before.  */
       if (!linker_section_ptr->written_address_p)
        {
-         linker_section_ptr->written_address_p = true;
+         linker_section_ptr->written_address_p = TRUE;
          bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend,
                       lsect->section->contents + linker_section_ptr->offset);
 
          if (info->shared)
            {
              asection *srel = lsect->rel_section;
-             Elf_Internal_Rela *outrel;
-             Elf_External_Rela *erel;
+             Elf_Internal_Rela outrel[MAX_INT_RELS_PER_EXT_REL];
+             bfd_byte *erel;
              struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
              unsigned int i;
-             bfd_size_type amt;
-
-             amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
-             outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt);
-             if (outrel == NULL)
-               {
-                 (*_bfd_error_handler) (_("Error: out of memory"));
-                 return 0;
-               }
 
              /* We need to generate a relative reloc for the dynamic
                 linker.  */
@@ -7630,17 +7516,18 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
              BFD_ASSERT (srel != NULL);
 
              for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
-               outrel[i].r_offset = (lsect->section->output_section->vma
-                                     + lsect->section->output_offset
-                                     + linker_section_ptr->offset);
+               {
+                 outrel[i].r_offset = (lsect->section->output_section->vma
+                                       + lsect->section->output_offset
+                                       + linker_section_ptr->offset);
+                 outrel[i].r_info = 0;
+                 outrel[i].r_addend = 0;
+               }
              outrel[0].r_info = ELF_R_INFO (0, relative_reloc);
-             outrel[0].r_addend = 0;
-             erel = (Elf_External_Rela *) lsect->section->contents;
-             erel += elf_section_data (lsect->section)->rel_count;
+             erel = lsect->section->contents;
+             erel += (elf_section_data (lsect->section)->rel_count++
+                      * sizeof (Elf_External_Rela));
              elf_swap_reloca_out (output_bfd, outrel, erel);
-             ++elf_section_data (lsect->section)->rel_count;
-
-             free (outrel);
            }
        }
     }
@@ -7663,43 +7550,44 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
 \f
 /* Garbage collect unused sections.  */
 
-static boolean elf_gc_mark
+static bfd_boolean elf_gc_mark
   PARAMS ((struct bfd_link_info *, asection *,
           asection * (*) (asection *, struct bfd_link_info *,
                           Elf_Internal_Rela *, struct elf_link_hash_entry *,
                           Elf_Internal_Sym *)));
 
-static boolean elf_gc_sweep
+static bfd_boolean elf_gc_sweep
   PARAMS ((struct bfd_link_info *,
-          boolean (*) (bfd *, struct bfd_link_info *, asection *,
-                       const Elf_Internal_Rela *)));
+          bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *,
+                           const Elf_Internal_Rela *)));
 
-static boolean elf_gc_sweep_symbol
+static bfd_boolean elf_gc_sweep_symbol
   PARAMS ((struct elf_link_hash_entry *, PTR));
 
-static boolean elf_gc_allocate_got_offsets
+static bfd_boolean elf_gc_allocate_got_offsets
   PARAMS ((struct elf_link_hash_entry *, PTR));
 
-static boolean elf_gc_propagate_vtable_entries_used
+static bfd_boolean elf_gc_propagate_vtable_entries_used
   PARAMS ((struct elf_link_hash_entry *, PTR));
 
-static boolean elf_gc_smash_unused_vtentry_relocs
+static bfd_boolean elf_gc_smash_unused_vtentry_relocs
   PARAMS ((struct elf_link_hash_entry *, PTR));
 
 /* The mark phase of garbage collection.  For a given section, mark
    it and any sections in this section's group, and all the sections
    which define symbols to which it refers.  */
 
-static boolean
+typedef asection * (*gc_mark_hook_fn)
+  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+          struct elf_link_hash_entry *, Elf_Internal_Sym *));
+
+static bfd_boolean
 elf_gc_mark (info, sec, gc_mark_hook)
      struct bfd_link_info *info;
      asection *sec;
-     asection * (*gc_mark_hook) PARAMS ((asection *, struct bfd_link_info *,
-                                        Elf_Internal_Rela *,
-                                        struct elf_link_hash_entry *,
-                                        Elf_Internal_Sym *));
+     gc_mark_hook_fn gc_mark_hook;
 {
-  boolean ret;
+  bfd_boolean ret;
   asection *group_sec;
 
   sec->gc_mark = 1;
@@ -7708,10 +7596,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
   group_sec = elf_section_data (sec)->next_in_group;
   if (group_sec && !group_sec->gc_mark)
     if (!elf_gc_mark (info, group_sec, gc_mark_hook))
-      return false;
+      return FALSE;
 
   /* Look through the section relocs.  */
-  ret = true;
+  ret = TRUE;
   if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
     {
       Elf_Internal_Rela *relstart, *rel, *relend;
@@ -7741,7 +7629,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
          isym = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, nlocsyms, 0,
                                       NULL, NULL, NULL);
          if (isym == NULL)
-           return false;
+           return FALSE;
        }
 
       /* Read the relocations.  */
@@ -7750,7 +7638,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
                   info->keep_memory));
       if (relstart == NULL)
        {
-         ret = false;
+         ret = FALSE;
          goto out1;
        }
       relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
@@ -7782,7 +7670,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
                rsec->gc_mark = 1;
              else if (!elf_gc_mark (info, rsec, gc_mark_hook))
                {
-                 ret = false;
+                 ret = FALSE;
                  goto out2;
                }
            }
@@ -7806,11 +7694,14 @@ elf_gc_mark (info, sec, gc_mark_hook)
 
 /* The sweep phase of garbage collection.  Remove all garbage sections.  */
 
-static boolean
+typedef bfd_boolean (*gc_sweep_hook_fn)
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+          const Elf_Internal_Rela *));
+
+static bfd_boolean
 elf_gc_sweep (info, gc_sweep_hook)
      struct bfd_link_info *info;
-     boolean (*gc_sweep_hook) PARAMS ((bfd *, struct bfd_link_info *,
-                                      asection *, const Elf_Internal_Rela *));
+     gc_sweep_hook_fn gc_sweep_hook;
 {
   bfd *sub;
 
@@ -7845,12 +7736,12 @@ elf_gc_sweep (info, gc_sweep_hook)
              && (o->flags & SEC_RELOC) && o->reloc_count > 0)
            {
              Elf_Internal_Rela *internal_relocs;
-             boolean r;
+             bfd_boolean r;
 
              internal_relocs = (NAME(_bfd_elf,link_read_relocs)
                                 (o->owner, o, NULL, NULL, info->keep_memory));
              if (internal_relocs == NULL)
-               return false;
+               return FALSE;
 
              r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs);
 
@@ -7858,7 +7749,7 @@ elf_gc_sweep (info, gc_sweep_hook)
                free (internal_relocs);
 
              if (!r)
-               return false;
+               return FALSE;
            }
        }
     }
@@ -7876,12 +7767,12 @@ elf_gc_sweep (info, gc_sweep_hook)
     elf_hash_table (info)->dynsymcount = i;
   }
 
-  return true;
+  return TRUE;
 }
 
 /* Sweep symbols in swept sections.  Called via elf_link_hash_traverse.  */
 
-static boolean
+static bfd_boolean
 elf_gc_sweep_symbol (h, idxptr)
      struct elf_link_hash_entry *h;
      PTR idxptr;
@@ -7897,13 +7788,13 @@ elf_gc_sweep_symbol (h, idxptr)
          || h->root.u.def.section->gc_mark))
     h->dynindx = (*idx)++;
 
-  return true;
+  return TRUE;
 }
 
 /* Propogate collected vtable information.  This is called through
    elf_link_hash_traverse.  */
 
-static boolean
+static bfd_boolean
 elf_gc_propagate_vtable_entries_used (h, okp)
      struct elf_link_hash_entry *h;
      PTR okp;
@@ -7913,15 +7804,15 @@ elf_gc_propagate_vtable_entries_used (h, okp)
 
   /* Those that are not vtables.  */
   if (h->vtable_parent == NULL)
-    return true;
+    return TRUE;
 
   /* Those vtables that do not have parents, we cannot merge.  */
   if (h->vtable_parent == (struct elf_link_hash_entry *) -1)
-    return true;
+    return TRUE;
 
   /* If we've already been done, exit.  */
   if (h->vtable_entries_used && h->vtable_entries_used[-1])
-    return true;
+    return TRUE;
 
   /* Make sure the parent's table is up to date.  */
   elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
@@ -7936,11 +7827,11 @@ elf_gc_propagate_vtable_entries_used (h, okp)
   else
     {
       size_t n;
-      boolean *cu, *pu;
+      bfd_boolean *cu, *pu;
 
       /* Or the parent's entries into ours.  */
       cu = h->vtable_entries_used;
-      cu[-1] = true;
+      cu[-1] = TRUE;
       pu = h->vtable_parent->vtable_entries_used;
       if (pu != NULL)
        {
@@ -7952,17 +7843,17 @@ elf_gc_propagate_vtable_entries_used (h, okp)
          while (n--)
            {
              if (*pu)
-               *cu = true;
+               *cu = TRUE;
              pu++;
              cu++;
            }
        }
     }
 
-  return true;
+  return TRUE;
 }
 
-static boolean
+static bfd_boolean
 elf_gc_smash_unused_vtentry_relocs (h, okp)
      struct elf_link_hash_entry *h;
      PTR okp;
@@ -7979,7 +7870,7 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
   /* Take care of both those symbols that do not describe vtables as
      well as those that are not loaded.  */
   if (h->vtable_parent == NULL)
-    return true;
+    return TRUE;
 
   BFD_ASSERT (h->root.type == bfd_link_hash_defined
              || h->root.type == bfd_link_hash_defweak);
@@ -7989,9 +7880,9 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
   hend = hstart + h->size;
 
   relstart = (NAME(_bfd_elf,link_read_relocs)
-             (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true));
+             (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, TRUE));
   if (!relstart)
-    return *(boolean *) okp = false;
+    return *(bfd_boolean *) okp = FALSE;
   bed = get_elf_backend_data (sec->owner);
   file_align = bed->s->file_align;
 
@@ -8012,17 +7903,17 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
        rel->r_offset = rel->r_info = rel->r_addend = 0;
       }
 
-  return true;
+  return TRUE;
 }
 
 /* Do mark and sweep of unused sections.  */
 
-boolean
+bfd_boolean
 elf_gc_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  boolean ok = true;
+  bfd_boolean ok = TRUE;
   bfd *sub;
   asection * (*gc_mark_hook)
     PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
@@ -8031,21 +7922,21 @@ elf_gc_sections (abfd, info)
   if (!get_elf_backend_data (abfd)->can_gc_sections
       || info->relocateable || info->emitrelocations
       || elf_hash_table (info)->dynamic_sections_created)
-    return true;
+    return TRUE;
 
   /* Apply transitive closure to the vtable entry usage info.  */
   elf_link_hash_traverse (elf_hash_table (info),
                          elf_gc_propagate_vtable_entries_used,
                          (PTR) &ok);
   if (!ok)
-    return false;
+    return FALSE;
 
   /* Kill the vtable relocations that were not used.  */
   elf_link_hash_traverse (elf_hash_table (info),
                          elf_gc_smash_unused_vtentry_relocs,
                          (PTR) &ok);
   if (!ok)
-    return false;
+    return FALSE;
 
   /* Grovel through relocs to find out who stays ...  */
 
@@ -8061,20 +7952,20 @@ elf_gc_sections (abfd, info)
        {
          if (o->flags & SEC_KEEP)
            if (!elf_gc_mark (info, o, gc_mark_hook))
-             return false;
+             return FALSE;
        }
     }
 
   /* ... and mark SEC_EXCLUDE for those that go.  */
   if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
-    return false;
+    return FALSE;
 
-  return true;
+  return TRUE;
 }
 \f
 /* Called from check_relocs to record the existance of a VTINHERIT reloc.  */
 
-boolean
+bfd_boolean
 elf_gc_record_vtinherit (abfd, sec, h, offset)
      bfd *abfd;
      asection *sec;
@@ -8111,7 +8002,7 @@ elf_gc_record_vtinherit (abfd, sec, h, offset)
                         bfd_archive_filename (abfd), sec->name,
                         (unsigned long) offset);
   bfd_set_error (bfd_error_invalid_operation);
-  return false;
+  return FALSE;
 
  win:
   if (!h)
@@ -8126,12 +8017,12 @@ elf_gc_record_vtinherit (abfd, sec, h, offset)
   else
     child->vtable_parent = h;
 
-  return true;
+  return TRUE;
 }
 
 /* Called from check_relocs to record the existance of a VTENTRY reloc.  */
 
-boolean
+bfd_boolean
 elf_gc_record_vtentry (abfd, sec, h, addend)
      bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec ATTRIBUTE_UNUSED;
@@ -8144,7 +8035,7 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
   if (addend >= h->vtable_entries_size)
     {
       size_t size, bytes;
-      boolean *ptr = h->vtable_entries_used;
+      bfd_boolean *ptr = h->vtable_entries_used;
 
       /* While the symbol is undefined, we have to be prepared to handle
         a zero size.  */
@@ -8163,7 +8054,7 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
 
       /* Allocate one extra entry for use as a "done" flag for the
         consolidation pass.  */
-      bytes = (size / file_align + 1) * sizeof (boolean);
+      bytes = (size / file_align + 1) * sizeof (bfd_boolean);
 
       if (ptr)
        {
@@ -8174,7 +8065,7 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
              size_t oldbytes;
 
              oldbytes = ((h->vtable_entries_size / file_align + 1)
-                         * sizeof (boolean));
+                         * sizeof (bfd_boolean));
              memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
            }
        }
@@ -8182,22 +8073,22 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
        ptr = bfd_zmalloc ((bfd_size_type) bytes);
 
       if (ptr == NULL)
-       return false;
+       return FALSE;
 
       /* And arrange for that done flag to be at index -1.  */
       h->vtable_entries_used = ptr + 1;
       h->vtable_entries_size = size;
     }
 
-  h->vtable_entries_used[addend / file_align] = true;
+  h->vtable_entries_used[addend / file_align] = TRUE;
 
-  return true;
+  return TRUE;
 }
 
 /* And an accompanying bit to work out final got entry offsets once
    we're done.  Should be called from final_link.  */
 
-boolean
+bfd_boolean
 elf_gc_common_finalize_got_offsets (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -8250,13 +8141,13 @@ elf_gc_common_finalize_got_offsets (abfd, info)
   elf_link_hash_traverse (elf_hash_table (info),
                          elf_gc_allocate_got_offsets,
                          (PTR) &gotoff);
-  return true;
+  return TRUE;
 }
 
 /* We need a special top-level link routine to convert got reference counts
    to real got offsets.  */
 
-static boolean
+static bfd_boolean
 elf_gc_allocate_got_offsets (h, offarg)
      struct elf_link_hash_entry *h;
      PTR offarg;
@@ -8274,19 +8165,19 @@ elf_gc_allocate_got_offsets (h, offarg)
   else
     h->got.offset = (bfd_vma) -1;
 
-  return true;
+  return TRUE;
 }
 
 /* Many folk need no more in the way of final link than this, once
    got entry reference counting is enabled.  */
 
-boolean
+bfd_boolean
 elf_gc_common_final_link (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
   if (!elf_gc_common_finalize_got_offsets (abfd, info))
-    return false;
+    return FALSE;
 
   /* Invoke the regular ELF backend linker to do all the work.  */
   return elf_bfd_final_link (abfd, info);
@@ -8295,7 +8186,7 @@ elf_gc_common_final_link (abfd, info)
 /* This function will be called though elf_link_hash_traverse to store
    all hash value of the exported symbols in an array.  */
 
-static boolean
+static bfd_boolean
 elf_collect_hash_codes (h, data)
      struct elf_link_hash_entry *h;
      PTR data;
@@ -8311,7 +8202,7 @@ elf_collect_hash_codes (h, data)
 
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->dynindx == -1)
-    return true;
+    return TRUE;
 
   name = h->root.root.string;
   p = strchr (name, ELF_VER_CHR);
@@ -8336,10 +8227,10 @@ elf_collect_hash_codes (h, data)
   if (alc != NULL)
     free (alc);
 
-  return true;
+  return TRUE;
 }
 
-boolean
+bfd_boolean
 elf_reloc_symbol_deleted_p (offset, cookie)
      bfd_vma offset;
      PTR cookie;
@@ -8355,13 +8246,13 @@ elf_reloc_symbol_deleted_p (offset, cookie)
 
       if (! rcookie->bad_symtab)
        if (rcookie->rel->r_offset > offset)
-         return false;
+         return FALSE;
       if (rcookie->rel->r_offset != offset)
        continue;
 
       r_symndx = ELF_R_SYM (rcookie->rel->r_info);
       if (r_symndx == SHN_UNDEF)
-       return true;
+       return TRUE;
 
       if (r_symndx >= rcookie->locsymcount
          || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
@@ -8377,9 +8268,9 @@ elf_reloc_symbol_deleted_p (offset, cookie)
          if ((h->root.type == bfd_link_hash_defined
               || h->root.type == bfd_link_hash_defweak)
              && elf_discarded_section (h->root.u.def.section))
-           return true;
+           return TRUE;
          else
-           return false;
+           return FALSE;
        }
       else
        {
@@ -8395,20 +8286,20 @@ elf_reloc_symbol_deleted_p (offset, cookie)
            {
              isec = section_from_elf_index (rcookie->abfd, isym->st_shndx);
              if (isec != NULL && elf_discarded_section (isec))
-               return true;
+               return TRUE;
            }
        }
-      return false;
+      return FALSE;
     }
-  return false;
+  return FALSE;
 }
 
 /* Discard unneeded references to discarded sections.
-   Returns true if any section's size was changed.  */
+   Returns TRUE if any section's size was changed.  */
 /* This function assumes that the relocations are in sorted order,
    which is true for all known assemblers.  */
 
-boolean
+bfd_boolean
 elf_bfd_discard_info (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
@@ -8419,12 +8310,12 @@ elf_bfd_discard_info (output_bfd, info)
   struct elf_backend_data *bed;
   bfd *abfd;
   unsigned int count;
-  boolean ret = false;
+  bfd_boolean ret = FALSE;
 
   if (info->traditional_format
       || info->hash->creator->flavour != bfd_target_elf_flavour
       || ! is_elf_hash_table (info))
-    return false;
+    return FALSE;
 
   for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
     {
@@ -8446,7 +8337,7 @@ elf_bfd_discard_info (output_bfd, info)
       if (stab != NULL
          && (stab->_raw_size == 0
              || bfd_is_abs_section (stab->output_section)
-             || elf_section_data (stab)->sec_info_type != ELF_INFO_TYPE_STABS))
+             || stab->sec_info_type != ELF_INFO_TYPE_STABS))
        stab = NULL;
 
       if (stab == NULL
@@ -8476,7 +8367,7 @@ elf_bfd_discard_info (output_bfd, info)
                                                 cookie.locsymcount, 0,
                                                 NULL, NULL, NULL);
          if (cookie.locsyms == NULL)
-           return false;
+           return FALSE;
        }
 
       if (stab != NULL)
@@ -8496,7 +8387,7 @@ elf_bfd_discard_info (output_bfd, info)
                                              elf_section_data (stab)->sec_info,
                                              elf_reloc_symbol_deleted_p,
                                              &cookie))
-               ret = true;
+               ret = TRUE;
              if (elf_section_data (stab)->relocs != cookie.rels)
                free (cookie.rels);
            }
@@ -8518,7 +8409,7 @@ elf_bfd_discard_info (output_bfd, info)
          if (_bfd_elf_discard_section_eh_frame (abfd, info, eh,
                                                 elf_reloc_symbol_deleted_p,
                                                 &cookie))
-           ret = true;
+           ret = TRUE;
 
          if (cookie.rels != NULL
              && elf_section_data (eh)->relocs != cookie.rels)
@@ -8527,7 +8418,7 @@ elf_bfd_discard_info (output_bfd, info)
 
       if (bed->elf_backend_discard_info != NULL
          && (*bed->elf_backend_discard_info) (abfd, &cookie, info))
-       ret = true;
+       ret = TRUE;
 
       if (cookie.locsyms != NULL
          && symtab_hdr->contents != (unsigned char *) cookie.locsyms)
@@ -8541,22 +8432,22 @@ elf_bfd_discard_info (output_bfd, info)
 
   if (info->eh_frame_hdr
       && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
-    ret = true;
+    ret = TRUE;
 
   return ret;
 }
 
-static boolean
+static bfd_boolean
 elf_section_ignore_discarded_relocs (sec)
      asection *sec;
 {
   struct elf_backend_data *bed;
 
-  switch (elf_section_data (sec)->sec_info_type)
+  switch (sec->sec_info_type)
     {
     case ELF_INFO_TYPE_STABS:
     case ELF_INFO_TYPE_EH_FRAME:
-      return true;
+      return TRUE;
     default:
       break;
     }
@@ -8564,7 +8455,7 @@ elf_section_ignore_discarded_relocs (sec)
   bed = get_elf_backend_data (sec->owner);
   if (bed->elf_backend_ignore_discarded_relocs != NULL
       && (*bed->elf_backend_ignore_discarded_relocs) (sec))
-    return true;
+    return TRUE;
 
-  return false;
+  return FALSE;
 }