Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elf32-ppc.c
index cb6cd114af345de227eb42cf7932942a3a119656..34a6b3fd837cc82dd27fe5da3ce76a8852f6aad3 100644 (file)
@@ -1,5 +1,5 @@
 /* PowerPC-specific support for 32-bit ELF
-   Copyright (C) 1994-2019 Free Software Foundation, Inc.
+   Copyright (C) 1994-2021 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
-
-/* This file is based on a preliminary PowerPC ELF ABI.  The
-   information may not match the final PowerPC ELF ABI.  It includes
-   suggestions from the in-progress Embedded PowerPC ABI, and that
-   information may also not match.  */
+/* Don't generate unused section symbols.  */
+#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS false
 
 #include "sysdep.h"
 #include <stdarg.h>
@@ -37,6 +34,9 @@
 #include "dwarf2.h"
 #include "opcode/ppc.h"
 
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1.  */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
 typedef enum split16_format_type
 {
   split16a_type = 0,
@@ -198,101 +198,101 @@ static const bfd_vma ppc_elf_vxworks_pic_plt0_entry
            complain, special_func)                             \
   HOWTO (type, rightshift, size, bitsize, pc_relative, 0,      \
         complain_overflow_ ## complain, special_func,          \
-        #type, FALSE, 0, mask, pc_relative)
+        #type, false, 0, mask, pc_relative)
 
 static reloc_howto_type *ppc_elf_howto_table[R_PPC_max];
 
 static reloc_howto_type ppc_elf_howto_raw[] = {
   /* This reloc does nothing.  */
-  HOW (R_PPC_NONE, 3, 0, 0, 0, FALSE, dont,
+  HOW (R_PPC_NONE, 3, 0, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* A standard 32 bit relocation.  */
-  HOW (R_PPC_ADDR32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_ADDR32, 2, 32, 0xffffffff, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* An absolute 26 bit branch; the lower two bits must be zero.
      FIXME: we don't check that, we just clear them.  */
-  HOW (R_PPC_ADDR24, 2, 26, 0x3fffffc, 0, FALSE, signed,
+  HOW (R_PPC_ADDR24, 2, 26, 0x3fffffc, 0, false, signed,
        bfd_elf_generic_reloc),
 
   /* A standard 16 bit relocation.  */
-  HOW (R_PPC_ADDR16, 1, 16, 0xffff, 0, FALSE, bitfield,
+  HOW (R_PPC_ADDR16, 1, 16, 0xffff, 0, false, bitfield,
        bfd_elf_generic_reloc),
 
   /* A 16 bit relocation without overflow.  */
-  HOW (R_PPC_ADDR16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_ADDR16_LO, 1, 16, 0xffff, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* The high order 16 bits of an address.  */
-  HOW (R_PPC_ADDR16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_ADDR16_HI, 1, 16, 0xffff, 16, false, dont,
        bfd_elf_generic_reloc),
 
   /* The high order 16 bits of an address, plus 1 if the contents of
      the low 16 bits, treated as a signed number, is negative.  */
-  HOW (R_PPC_ADDR16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_ADDR16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_addr16_ha_reloc),
 
   /* An absolute 16 bit branch; the lower two bits must be zero.
      FIXME: we don't check that, we just clear them.  */
-  HOW (R_PPC_ADDR14, 2, 16, 0xfffc, 0, FALSE, signed,
+  HOW (R_PPC_ADDR14, 2, 16, 0xfffc, 0, false, signed,
        bfd_elf_generic_reloc),
 
   /* An absolute 16 bit branch, for which bit 10 should be set to
      indicate that the branch is expected to be taken. The lower two
      bits must be zero.  */
-  HOW (R_PPC_ADDR14_BRTAKEN, 2, 16, 0xfffc, 0, FALSE, signed,
+  HOW (R_PPC_ADDR14_BRTAKEN, 2, 16, 0xfffc, 0, false, signed,
        bfd_elf_generic_reloc),
 
   /* An absolute 16 bit branch, for which bit 10 should be set to
      indicate that the branch is not expected to be taken.  The lower
      two bits must be zero.  */
-  HOW (R_PPC_ADDR14_BRNTAKEN, 2, 16, 0xfffc, 0, FALSE, signed,
+  HOW (R_PPC_ADDR14_BRNTAKEN, 2, 16, 0xfffc, 0, false, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 26 bit branch; the lower two bits must be zero.  */
-  HOW (R_PPC_REL24, 2, 26, 0x3fffffc, 0, TRUE, signed,
+  HOW (R_PPC_REL24, 2, 26, 0x3fffffc, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 16 bit branch; the lower two bits must be zero.  */
-  HOW (R_PPC_REL14, 2, 16, 0xfffc, 0, TRUE, signed,
+  HOW (R_PPC_REL14, 2, 16, 0xfffc, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 16 bit branch.  Bit 10 should be set to indicate that
      the branch is expected to be taken.  The lower two bits must be
      zero.  */
-  HOW (R_PPC_REL14_BRTAKEN, 2, 16, 0xfffc, 0, TRUE, signed,
+  HOW (R_PPC_REL14_BRTAKEN, 2, 16, 0xfffc, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 16 bit branch.  Bit 10 should be set to indicate that
      the branch is not expected to be taken.  The lower two bits must
      be zero.  */
-  HOW (R_PPC_REL14_BRNTAKEN, 2, 16, 0xfffc, 0, TRUE, signed,
+  HOW (R_PPC_REL14_BRNTAKEN, 2, 16, 0xfffc, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* Like R_PPC_ADDR16, but referring to the GOT table entry for the
      symbol.  */
-  HOW (R_PPC_GOT16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_GOT16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_LO, but referring to the GOT table entry for
      the symbol.  */
-  HOW (R_PPC_GOT16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_GOT16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_HI, but referring to the GOT table entry for
      the symbol.  */
-  HOW (R_PPC_GOT16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_HA, but referring to the GOT table entry for
      the symbol.  */
-  HOW (R_PPC_GOT16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_REL24, but referring to the procedure linkage table
      entry for the symbol.  */
-  HOW (R_PPC_PLTREL24, 2, 26, 0x3fffffc, 0, TRUE, signed,
+  HOW (R_PPC_PLTREL24, 2, 26, 0x3fffffc, 0, true, signed,
        ppc_elf_unhandled_reloc),
 
   /* This is used only by the dynamic linker.  The symbol should exist
@@ -300,269 +300,269 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
      dynamic linker copies the data addressed by the symbol from the
      shared library into the object, because the object being
      run has to have the data at some particular address.  */
-  HOW (R_PPC_COPY, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_COPY, 2, 32, 0, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR32, but used when setting global offset table
      entries.  */
-  HOW (R_PPC_GLOB_DAT, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_GLOB_DAT, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Marks a procedure linkage table entry for a symbol.  */
-  HOW (R_PPC_JMP_SLOT, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_JMP_SLOT, 2, 32, 0, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Used only by the dynamic linker.  When the object is run, this
      longword is set to the load address of the object, plus the
      addend.  */
-  HOW (R_PPC_RELATIVE, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_RELATIVE, 2, 32, 0xffffffff, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* Like R_PPC_REL24, but uses the value of the symbol within the
      object rather than the final value.  Normally used for
      _GLOBAL_OFFSET_TABLE_.  */
-  HOW (R_PPC_LOCAL24PC, 2, 26, 0x3fffffc, 0, TRUE, signed,
+  HOW (R_PPC_LOCAL24PC, 2, 26, 0x3fffffc, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* Like R_PPC_ADDR32, but may be unaligned.  */
-  HOW (R_PPC_UADDR32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_UADDR32, 2, 32, 0xffffffff, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* Like R_PPC_ADDR16, but may be unaligned.  */
-  HOW (R_PPC_UADDR16, 1, 16, 0xffff, 0, FALSE, bitfield,
+  HOW (R_PPC_UADDR16, 1, 16, 0xffff, 0, false, bitfield,
        bfd_elf_generic_reloc),
 
   /* 32-bit PC relative */
-  HOW (R_PPC_REL32, 2, 32, 0xffffffff, 0, TRUE, dont,
+  HOW (R_PPC_REL32, 2, 32, 0xffffffff, 0, true, dont,
        bfd_elf_generic_reloc),
 
   /* 32-bit relocation to the symbol's procedure linkage table.
      FIXME: not supported.  */
-  HOW (R_PPC_PLT32, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_PLT32, 2, 32, 0, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* 32-bit PC relative relocation to the symbol's procedure linkage table.
      FIXME: not supported.  */
-  HOW (R_PPC_PLTREL32, 2, 32, 0, 0, TRUE, dont,
+  HOW (R_PPC_PLTREL32, 2, 32, 0, 0, true, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_LO, but referring to the PLT table entry for
      the symbol.  */
-  HOW (R_PPC_PLT16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_PLT16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_HI, but referring to the PLT table entry for
      the symbol.  */
-  HOW (R_PPC_PLT16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_PLT16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_ADDR16_HA, but referring to the PLT table entry for
      the symbol.  */
-  HOW (R_PPC_PLT16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_PLT16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* A sign-extended 16 bit value relative to _SDA_BASE_, for use with
      small data items.  */
-  HOW (R_PPC_SDAREL16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_SDAREL16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* 16-bit section relative relocation.  */
-  HOW (R_PPC_SECTOFF, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_SECTOFF, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* 16-bit lower half section relative relocation.  */
-  HOW (R_PPC_SECTOFF_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_SECTOFF_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* 16-bit upper half section relative relocation.  */
-  HOW (R_PPC_SECTOFF_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_SECTOFF_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* 16-bit upper half adjusted section relative relocation.  */
-  HOW (R_PPC_SECTOFF_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_SECTOFF_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Marker relocs for TLS.  */
-  HOW (R_PPC_TLS, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_TLS, 2, 32, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
-  HOW (R_PPC_TLSGD, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_TLSGD, 2, 32, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
-  HOW (R_PPC_TLSLD, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_TLSLD, 2, 32, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* Marker relocs on inline plt call instructions.  */
-  HOW (R_PPC_PLTSEQ, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_PLTSEQ, 2, 32, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
-  HOW (R_PPC_PLTCALL, 2, 32, 0, 0, FALSE, dont,
+  HOW (R_PPC_PLTCALL, 2, 32, 0, 0, false, dont,
        bfd_elf_generic_reloc),
 
   /* Computes the load module index of the load module that contains the
      definition of its TLS sym.  */
-  HOW (R_PPC_DTPMOD32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_DTPMOD32, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Computes a dtv-relative displacement, the difference between the value
      of sym+add and the base address of the thread-local storage block that
      contains the definition of sym, minus 0x8000.  */
-  HOW (R_PPC_DTPREL32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_DTPREL32, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* A 16 bit dtprel reloc.  */
-  HOW (R_PPC_DTPREL16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_DTPREL16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like DTPREL16, but no overflow.  */
-  HOW (R_PPC_DTPREL16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_DTPREL16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like DTPREL16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_DTPREL16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_DTPREL16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like DTPREL16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_DTPREL16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_DTPREL16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Computes a tp-relative displacement, the difference between the value of
      sym+add and the value of the thread pointer (r13).  */
-  HOW (R_PPC_TPREL32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_TPREL32, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* A 16 bit tprel reloc.  */
-  HOW (R_PPC_TPREL16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_TPREL16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like TPREL16, but no overflow.  */
-  HOW (R_PPC_TPREL16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_TPREL16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like TPREL16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_TPREL16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_TPREL16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like TPREL16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_TPREL16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_TPREL16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
      with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
      to the first entry.  */
-  HOW (R_PPC_GOT_TLSGD16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_GOT_TLSGD16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSGD16, but no overflow.  */
-  HOW (R_PPC_GOT_TLSGD16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_GOT_TLSGD16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSGD16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_GOT_TLSGD16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TLSGD16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSGD16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_GOT_TLSGD16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TLSGD16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
      with values (sym+add)@dtpmod and zero, and computes the offset to the
      first entry.  */
-  HOW (R_PPC_GOT_TLSLD16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_GOT_TLSLD16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSLD16, but no overflow.  */
-  HOW (R_PPC_GOT_TLSLD16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_GOT_TLSLD16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSLD16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_GOT_TLSLD16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TLSLD16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TLSLD16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_GOT_TLSLD16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TLSLD16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
      the offset to the entry.  */
-  HOW (R_PPC_GOT_DTPREL16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_GOT_DTPREL16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_DTPREL16, but no overflow.  */
-  HOW (R_PPC_GOT_DTPREL16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_GOT_DTPREL16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_DTPREL16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_GOT_DTPREL16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_DTPREL16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_DTPREL16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_GOT_DTPREL16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_DTPREL16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
      offset to the entry.  */
-  HOW (R_PPC_GOT_TPREL16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_GOT_TPREL16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TPREL16, but no overflow.  */
-  HOW (R_PPC_GOT_TPREL16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_GOT_TPREL16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TPREL16_LO, but next higher group of 16 bits.  */
-  HOW (R_PPC_GOT_TPREL16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TPREL16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Like GOT_TPREL16_HI, but adjust for low 16 bits.  */
-  HOW (R_PPC_GOT_TPREL16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_GOT_TPREL16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The remaining relocs are from the Embedded ELF ABI, and are not
      in the SVR4 ELF ABI.  */
 
   /* 32 bit value resulting from the addend minus the symbol.  */
-  HOW (R_PPC_EMB_NADDR32, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_EMB_NADDR32, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* 16 bit value resulting from the addend minus the symbol.  */
-  HOW (R_PPC_EMB_NADDR16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_NADDR16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* 16 bit value resulting from the addend minus the symbol.  */
-  HOW (R_PPC_EMB_NADDR16_LO, 1, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_EMB_NADDR16_LO, 1, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The high order 16 bits of the addend minus the symbol.  */
-  HOW (R_PPC_EMB_NADDR16_HI, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_EMB_NADDR16_HI, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The high order 16 bits of the result of the addend minus the address,
      plus 1 if the contents of the low 16 bits, treated as a signed number,
      is negative.  */
-  HOW (R_PPC_EMB_NADDR16_HA, 1, 16, 0xffff, 16, FALSE, dont,
+  HOW (R_PPC_EMB_NADDR16_HA, 1, 16, 0xffff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* 16 bit value resulting from allocating a 4 byte word to hold an
      address in the .sdata section, and returning the offset from
      _SDA_BASE_ for that relocation.  */
-  HOW (R_PPC_EMB_SDAI16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_SDAI16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* 16 bit value resulting from allocating a 4 byte word to hold an
      address in the .sdata2 section, and returning the offset from
      _SDA2_BASE_ for that relocation.  */
-  HOW (R_PPC_EMB_SDA2I16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_SDA2I16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
      small data items.  */
-  HOW (R_PPC_EMB_SDA2REL, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_SDA2REL, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
      signed offset from the appropriate base, and filling in the register
      field with the appropriate register (0, 2, or 13).  */
-  HOW (R_PPC_EMB_SDA21, 2, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_SDA21, 2, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Relocation not handled: R_PPC_EMB_MRKREF */
@@ -575,121 +575,121 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
   /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
      in the 16 bit signed offset from the appropriate base, and filling in the
      register field with the appropriate register (0, 2, or 13).  */
-  HOW (R_PPC_EMB_RELSDA, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_EMB_RELSDA, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* A relative 8 bit branch.  */
-  HOW (R_PPC_VLE_REL8, 1, 8, 0xff, 1, TRUE, signed,
+  HOW (R_PPC_VLE_REL8, 1, 8, 0xff, 1, true, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 15 bit branch.  */
-  HOW (R_PPC_VLE_REL15, 2, 16, 0xfffe, 0, TRUE, signed,
+  HOW (R_PPC_VLE_REL15, 2, 16, 0xfffe, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* A relative 24 bit branch.  */
-  HOW (R_PPC_VLE_REL24, 2, 25, 0x1fffffe, 0, TRUE, signed,
+  HOW (R_PPC_VLE_REL24, 2, 25, 0x1fffffe, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* The 16 LSBS in split16a format.  */
-  HOW (R_PPC_VLE_LO16A, 2, 16, 0x1f07ff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_LO16A, 2, 16, 0x1f07ff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The 16 LSBS in split16d format.  */
-  HOW (R_PPC_VLE_LO16D, 2, 16, 0x3e007ff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_LO16D, 2, 16, 0x3e007ff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 split16a format.  */
-  HOW (R_PPC_VLE_HI16A, 2, 16, 0x1f07ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_HI16A, 2, 16, 0x1f07ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 split16d format.  */
-  HOW (R_PPC_VLE_HI16D, 2, 16, 0x3e007ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_HI16D, 2, 16, 0x3e007ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 (High Adjusted) in split16a format.  */
-  HOW (R_PPC_VLE_HA16A, 2, 16, 0x1f07ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_HA16A, 2, 16, 0x1f07ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 (High Adjusted) in split16d format.  */
-  HOW (R_PPC_VLE_HA16D, 2, 16, 0x3e007ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_HA16D, 2, 16, 0x3e007ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* This reloc is like R_PPC_EMB_SDA21 but only applies to e_add16i
      instructions.  If the register base is 0 then the linker changes
      the e_add16i to an e_li instruction.  */
-  HOW (R_PPC_VLE_SDA21, 2, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_VLE_SDA21, 2, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 
   /* Like R_PPC_VLE_SDA21 but ignore overflow.  */
-  HOW (R_PPC_VLE_SDA21_LO, 2, 16, 0xffff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_SDA21_LO, 2, 16, 0xffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The 16 LSBS relative to _SDA_BASE_ in split16a format.  */
-  HOW (R_PPC_VLE_SDAREL_LO16A, 2, 16, 0x1f07ff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_LO16A, 2, 16, 0x1f07ff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* The 16 LSBS relative to _SDA_BASE_ in split16d format.  */
-  HOW (R_PPC_VLE_SDAREL_LO16D, 2, 16, 0x3e007ff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_LO16D, 2, 16, 0x3e007ff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 relative to _SDA_BASE_ in split16a format.  */
-  HOW (R_PPC_VLE_SDAREL_HI16A, 2, 16, 0x1f07ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_HI16A, 2, 16, 0x1f07ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 relative to _SDA_BASE_ in split16d format.  */
-  HOW (R_PPC_VLE_SDAREL_HI16D, 2, 16, 0x3e007ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_HI16D, 2, 16, 0x3e007ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 (HA) relative to _SDA_BASE split16a format.  */
-  HOW (R_PPC_VLE_SDAREL_HA16A, 2, 16, 0x1f07ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_HA16A, 2, 16, 0x1f07ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* Bits 16-31 (HA) relative to _SDA_BASE split16d format.  */
-  HOW (R_PPC_VLE_SDAREL_HA16D, 2, 16, 0x3e007ff, 16, FALSE, dont,
+  HOW (R_PPC_VLE_SDAREL_HA16D, 2, 16, 0x3e007ff, 16, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* e_li split20 format.  */
-  HOW (R_PPC_VLE_ADDR20, 2, 20, 0x1f7fff, 0, FALSE, dont,
+  HOW (R_PPC_VLE_ADDR20, 2, 20, 0x1f7fff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
-  HOW (R_PPC_IRELATIVE, 2, 32, 0xffffffff, 0, FALSE, dont,
+  HOW (R_PPC_IRELATIVE, 2, 32, 0xffffffff, 0, false, dont,
        ppc_elf_unhandled_reloc),
 
   /* A 16 bit relative relocation.  */
-  HOW (R_PPC_REL16, 1, 16, 0xffff, 0, TRUE, signed,
+  HOW (R_PPC_REL16, 1, 16, 0xffff, 0, true, signed,
        bfd_elf_generic_reloc),
 
   /* A 16 bit relative relocation without overflow.  */
-  HOW (R_PPC_REL16_LO, 1, 16, 0xffff, 0, TRUE, dont,
+  HOW (R_PPC_REL16_LO, 1, 16, 0xffff, 0, true, dont,
        bfd_elf_generic_reloc),
 
   /* The high order 16 bits of a relative address.  */
-  HOW (R_PPC_REL16_HI, 1, 16, 0xffff, 16, TRUE, dont,
+  HOW (R_PPC_REL16_HI, 1, 16, 0xffff, 16, true, dont,
        bfd_elf_generic_reloc),
 
   /* The high order 16 bits of a relative address, plus 1 if the contents of
      the low 16 bits, treated as a signed number, is negative.  */
-  HOW (R_PPC_REL16_HA, 1, 16, 0xffff, 16, TRUE, dont,
+  HOW (R_PPC_REL16_HA, 1, 16, 0xffff, 16, true, dont,
        ppc_elf_addr16_ha_reloc),
 
   /* Like R_PPC_REL16_HA but for split field in addpcis.  */
-  HOW (R_PPC_REL16DX_HA, 2, 16, 0x1fffc1, 16, TRUE, signed,
+  HOW (R_PPC_REL16DX_HA, 2, 16, 0x1fffc1, 16, true, signed,
        ppc_elf_addr16_ha_reloc),
 
   /* A split-field reloc for addpcis, non-relative (gas internal use only).  */
-  HOW (R_PPC_16DX_HA, 2, 16, 0x1fffc1, 16, FALSE, signed,
+  HOW (R_PPC_16DX_HA, 2, 16, 0x1fffc1, 16, false, signed,
        ppc_elf_addr16_ha_reloc),
 
   /* GNU extension to record C++ vtable hierarchy.  */
-  HOW (R_PPC_GNU_VTINHERIT, 0, 0, 0, 0, FALSE, dont,
+  HOW (R_PPC_GNU_VTINHERIT, 0, 0, 0, 0, false, dont,
        NULL),
 
   /* GNU extension to record C++ vtable member usage.  */
-  HOW (R_PPC_GNU_VTENTRY, 0, 0, 0, 0, FALSE, dont,
+  HOW (R_PPC_GNU_VTENTRY, 0, 0, 0, 0, false, dont,
        NULL),
 
   /* Phony reloc to handle AIX style TOC entries.  */
-  HOW (R_PPC_TOC16, 1, 16, 0xffff, 0, FALSE, signed,
+  HOW (R_PPC_TOC16, 1, 16, 0xffff, 0, false, signed,
        ppc_elf_unhandled_reloc),
 };
 \f
@@ -880,7 +880,7 @@ ppc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Set the howto pointer for a PowerPC ELF reloc.  */
 
-static bfd_boolean
+static bool
 ppc_elf_info_to_howto (bfd *abfd,
                       arelent *cache_ptr,
                       Elf_Internal_Rela *dst)
@@ -898,7 +898,7 @@ ppc_elf_info_to_howto (bfd *abfd,
       _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
                          abfd, r_type);
       bfd_set_error (bfd_error_bad_value);
-      return FALSE;
+      return false;
     }
 
   cache_ptr->howto = ppc_elf_howto_table[r_type];
@@ -912,10 +912,10 @@ ppc_elf_info_to_howto (bfd *abfd,
                          abfd, r_type);
       bfd_set_error (bfd_error_bad_value);
 
-      return FALSE;
+      return false;
     }
 
-  return TRUE;
+  return true;
 }
 
 /* Handle the R_PPC_ADDR16_HA and R_PPC_REL16_HA relocs.  */
@@ -956,7 +956,7 @@ ppc_elf_addr16_ha_reloc (bfd *abfd,
            + input_section->output_section->vma);
   value >>= 16;
 
-  octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+  octets = reloc_entry->address * OCTETS_PER_BYTE (abfd, input_section);
   insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
   insn &= ~0x1fffc1;
   insn |= (value & 0xffc1) | ((value & 0x3e) << 15);
@@ -982,10 +982,12 @@ ppc_elf_unhandled_reloc (bfd *abfd,
 
   if (error_message != NULL)
     {
-      static char buf[60];
-      sprintf (buf, _("generic linker can't handle %s"),
-              reloc_entry->howto->name);
-      *error_message = buf;
+      static char *message;
+      free (message);
+      if (asprintf (&message, _("generic linker can't handle %s"),
+                   reloc_entry->howto->name) < 0)
+       message = NULL;
+      *error_message = message;
     }
   return bfd_reloc_dangerous;
 }
@@ -1047,7 +1049,7 @@ struct ppc_elf_obj_tdata
 
 /* Override the generic function because we store some extras.  */
 
-static bfd_boolean
+static bool
 ppc_elf_mkobject (bfd *abfd)
 {
   return bfd_elf_allocate_object (abfd, sizeof (struct ppc_elf_obj_tdata),
@@ -1056,7 +1058,7 @@ ppc_elf_mkobject (bfd *abfd)
 
 /* When defaulting arch/mach, decode apuinfo to find a better match.  */
 
-bfd_boolean
+bool
 _bfd_elf_ppc_set_arch (bfd *abfd)
 {
   unsigned long mach = 0;
@@ -1131,17 +1133,17 @@ _bfd_elf_ppc_set_arch (bfd *abfd)
            break;
          }
     }
-  return TRUE;
+  return true;
 }
 
 /* Fix bad default arch selected for a 32 bit input bfd when the
    default is 64 bit.  Also select arch based on apuinfo.  */
 
-static bfd_boolean
+static bool
 ppc_elf_object_p (bfd *abfd)
 {
   if (!abfd->arch_info->the_default)
-    return TRUE;
+    return true;
 
   if (abfd->arch_info->bits_per_word == 64)
     {
@@ -1159,20 +1161,20 @@ ppc_elf_object_p (bfd *abfd)
 
 /* Function to set whether a module needs the -mrelocatable bit set.  */
 
-static bfd_boolean
+static bool
 ppc_elf_set_private_flags (bfd *abfd, flagword flags)
 {
   BFD_ASSERT (!elf_flags_init (abfd)
              || elf_elfheader (abfd)->e_flags == flags);
 
   elf_elfheader (abfd)->e_flags = flags;
-  elf_flags_init (abfd) = TRUE;
-  return TRUE;
+  elf_flags_init (abfd) = true;
+  return true;
 }
 
 /* Support for core dump NOTE sections.  */
 
-static bfd_boolean
+static bool
 ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
 {
   int offset;
@@ -1181,7 +1183,7 @@ ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
   switch (note->descsz)
     {
     default:
-      return FALSE;
+      return false;
 
     case 268:          /* Linux/PPC.  */
       /* pr_cursig */
@@ -1202,13 +1204,13 @@ ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
                                          size, note->descpos + offset);
 }
 
-static bfd_boolean
+static bool
 ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 {
   switch (note->descsz)
     {
     default:
-      return FALSE;
+      return false;
 
     case 128:          /* Linux/PPC elf_prpsinfo.  */
       elf_tdata (abfd)->core->pid
@@ -1231,7 +1233,7 @@ ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
       command[n - 1] = '\0';
   }
 
-  return TRUE;
+  return true;
 }
 
 static char *
@@ -1316,7 +1318,7 @@ ppc_elf_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED,
    is called when bfd_section_from_shdr finds a section with an unknown
    type.  */
 
-static bfd_boolean
+static bool
 ppc_elf_section_from_shdr (bfd *abfd,
                           Elf_Internal_Shdr *hdr,
                           const char *name,
@@ -1326,23 +1328,29 @@ ppc_elf_section_from_shdr (bfd *abfd,
   flagword flags;
 
   if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
-    return FALSE;
+    return false;
 
   newsect = hdr->bfd_section;
-  flags = bfd_section_flags (newsect);
+  flags = 0;
   if (hdr->sh_flags & SHF_EXCLUDE)
     flags |= SEC_EXCLUDE;
 
   if (hdr->sh_type == SHT_ORDERED)
     flags |= SEC_SORT_ENTRIES;
 
-  bfd_set_section_flags (newsect, flags);
-  return TRUE;
+  if (startswith (name, ".PPC.EMB"))
+    name += 8;
+  if (startswith (name, ".sbss")
+      || startswith (name, ".sdata"))
+    flags |= SEC_SMALL_DATA;
+
+  return (flags == 0
+         || bfd_set_section_flags (newsect, newsect->flags | flags));
 }
 
 /* Set up any other section flags and such that may be necessary.  */
 
-static bfd_boolean
+static bool
 ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
                       Elf_Internal_Shdr *shdr,
                       asection *asect)
@@ -1350,7 +1358,7 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
   if ((asect->flags & SEC_SORT_ENTRIES) != 0)
     shdr->sh_type = SHT_ORDERED;
 
-  return TRUE;
+  return true;
 }
 
 /* If we have .sbss2 or .PPC.EMB.sbss0 output sections, we
@@ -1376,7 +1384,7 @@ ppc_elf_additional_program_headers (bfd *abfd,
 
 /* Modify the segment map for VLE executables.  */
 
-bfd_boolean
+bool
 ppc_elf_modify_segment_map (bfd *abfd,
                            struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
@@ -1391,7 +1399,7 @@ ppc_elf_modify_segment_map (bfd *abfd,
   for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     {
       struct elf_segment_map *n;
-      bfd_size_type amt;
+      size_t amt;
       unsigned int j, k;
       unsigned int p_flags;
 
@@ -1447,7 +1455,7 @@ ppc_elf_modify_segment_map (bfd *abfd,
       amt += (m->count - j - 1) * sizeof (asection *);
       n = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
       if (n == NULL)
-       return FALSE;
+       return false;
 
       n->p_type = PT_LOAD;
       n->count = m->count - j;
@@ -1459,7 +1467,7 @@ ppc_elf_modify_segment_map (bfd *abfd,
       m->next = n;
     }
 
-  return TRUE;
+  return true;
 }
 
 /* Add extra PPC sections -- Note, for now, make .sbss2 and
@@ -1482,7 +1490,7 @@ static const struct bfd_elf_special_section ppc_elf_special_sections[] =
 };
 
 /* This is what we want for new plt/got.  */
-static struct bfd_elf_special_section ppc_alt_plt =
+static const struct bfd_elf_special_section ppc_alt_plt =
   { STRING_COMMA_LEN (".plt"),            0, SHT_PROGBITS, SHF_ALLOC };
 
 static const struct bfd_elf_special_section *
@@ -1515,13 +1523,13 @@ typedef struct apuinfo_list
 apuinfo_list;
 
 static apuinfo_list *head;
-static bfd_boolean apuinfo_set;
+static bool apuinfo_set;
 
 static void
 apuinfo_list_init (void)
 {
   head = NULL;
-  apuinfo_set = FALSE;
+  apuinfo_set = false;
 }
 
 static void
@@ -1621,11 +1629,10 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
       if (length < 20)
        goto fail;
 
-      apuinfo_set = TRUE;
+      apuinfo_set = true;
       if (largest_input_size < asec->size)
        {
-         if (buffer)
-           free (buffer);
+         free (buffer);
          largest_input_size = asec->size;
          buffer = bfd_malloc (largest_input_size);
          if (!buffer)
@@ -1683,8 +1690,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
     }
 
  fail:
-  if (buffer)
-    free (buffer);
+  free (buffer);
 
   if (error_message)
     _bfd_error_handler (error_message, APUINFO_SECTION_NAME, ibfd);
@@ -1693,7 +1699,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
 /* Prevent the output section from accumulating the input sections'
    contents.  We have already stored this in our linked list structure.  */
 
-static bfd_boolean
+static bool
 ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
                       struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
                       asection *asec,
@@ -1757,20 +1763,20 @@ ppc_final_write_processing (bfd *abfd)
   apuinfo_list_finish ();
 }
 
-static bfd_boolean
+static bool
 ppc_elf_final_write_processing (bfd *abfd)
 {
   ppc_final_write_processing (abfd);
   return _bfd_elf_final_write_processing (abfd);
 }
 \f
-static bfd_boolean
+static bool
 is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
 {
   bfd_byte buf[4 * 4];
 
   if (!bfd_get_section_contents (abfd, glink, buf, off, sizeof buf))
-    return FALSE;
+    return false;
 
   return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11
          && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
@@ -1778,7 +1784,7 @@ is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
          && bfd_get_32 (abfd, buf + 12) == BCTR);
 }
 
-static bfd_boolean
+static bool
 section_covers_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *section, void *ptr)
 {
   bfd_vma vma = *(bfd_vma *) ptr;
@@ -1792,14 +1798,14 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
                              long dynsymcount, asymbol **dynsyms,
                              asymbol **ret)
 {
-  bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
+  bool (*slurp_relocs) (bfd *, asection *, asymbol **, bool);
   asection *plt, *relplt, *dynamic, *glink;
   bfd_vma glink_vma = 0;
   bfd_vma resolv_vma = 0;
   bfd_vma stub_off;
   asymbol *s;
   arelent *p;
-  long count, i, stub_delta;
+  size_t count, i, stub_delta;
   size_t size;
   char *names;
   bfd_byte buf[4];
@@ -1921,7 +1927,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
     return 0;
 
   slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
-  if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE))
+  if (! (*slurp_relocs) (abfd, relplt, dynsyms, true))
     return -1;
 
   size = count * sizeof (asymbol);
@@ -2109,9 +2115,6 @@ struct ppc_elf_link_hash_entry
      from the beginning of the section.  */
   elf_linker_section_pointers_t *linker_section_pointer;
 
-  /* Track dynamic relocs copied for this symbol.  */
-  struct elf_dyn_relocs *dyn_relocs;
-
   /* Contexts in which symbol is used in the GOT.
      Bits are or'd into the mask as the corresponding relocs are
      encountered during check_relocs, with TLS_TLS being set when any
@@ -2191,9 +2194,6 @@ struct ppc_elf_link_hash_table
   /* The type of PLT we have chosen to use.  */
   enum ppc_elf_plt_type plt_type;
 
-  /* True if the target system is VxWorks.  */
-  unsigned int is_vxworks:1;
-
   /* Whether there exist local gnu indirect function resolvers,
      referenced by dynamic relocations.  */
   unsigned int local_ifunc_resolver:1;
@@ -2211,9 +2211,6 @@ struct ppc_elf_link_hash_table
   int plt_slot_size;
   /* The size of the first PLT entry.  */
   int plt_initial_entry_size;
-
-  /* Small local sym cache.  */
-  struct sym_cache sym_cache;
 };
 
 /* Rename some of the generic section flags to better document how they
@@ -2232,8 +2229,9 @@ struct ppc_elf_link_hash_table
 /* Get the PPC ELF linker hash table from a link_info structure.  */
 
 #define ppc_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == PPC32_ELF_DATA ? ((struct ppc_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == PPC32_ELF_DATA)       \
+   ? (struct ppc_elf_link_hash_table *) (p)->hash : NULL)
 
 /* Create an entry in a PPC ELF linker hash table.  */
 
@@ -2257,7 +2255,6 @@ ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
   if (entry != NULL)
     {
       ppc_elf_hash_entry (entry)->linker_section_pointer = NULL;
-      ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
       ppc_elf_hash_entry (entry)->tls_mask = 0;
       ppc_elf_hash_entry (entry)->has_sda_refs = 0;
     }
@@ -2323,33 +2320,33 @@ ppc_elf_link_params (struct bfd_link_info *info, struct ppc_elf_params *params)
 
 /* Create .got and the related sections.  */
 
-static bfd_boolean
+static bool
 ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab;
 
   if (!_bfd_elf_create_got_section (abfd, info))
-    return FALSE;
+    return false;
 
   htab = ppc_elf_hash_table (info);
-  if (!htab->is_vxworks)
+  if (htab->elf.target_os != is_vxworks)
     {
       /* The powerpc .got has a blrl instruction in it.  Mark it
         executable.  */
       flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS
                        | SEC_IN_MEMORY | SEC_LINKER_CREATED);
       if (!bfd_set_section_flags (htab->elf.sgot, flags))
-       return FALSE;
+       return false;
     }
 
-  return TRUE;
+  return true;
 }
 
 /* Create a special linker section, used for R_PPC_EMB_SDAI16 and
    R_PPC_EMB_SDA2I16 pointers.  These sections become part of .sdata
    and .sdata2.  Create _SDA_BASE_ and _SDA2_BASE too.  */
 
-static bfd_boolean
+static bool
 ppc_elf_create_linker_section (bfd *abfd,
                               struct bfd_link_info *info,
                               flagword flags,
@@ -2362,7 +2359,7 @@ ppc_elf_create_linker_section (bfd *abfd,
 
   s = bfd_make_section_anyway_with_flags (abfd, lsect->name, flags);
   if (s == NULL)
-    return FALSE;
+    return false;
   lsect->section = s;
 
   /* Define the sym on the first section of this name.  */
@@ -2370,12 +2367,12 @@ ppc_elf_create_linker_section (bfd *abfd,
 
   lsect->sym = _bfd_elf_define_linkage_sym (abfd, info, s, lsect->sym_name);
   if (lsect->sym == NULL)
-    return FALSE;
+    return false;
   lsect->sym->root.u.def.value = 0x8000;
-  return TRUE;
+  return true;
 }
 
-static bfd_boolean
+static bool
 ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
@@ -2392,7 +2389,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
     p2align = htab->params->plt_stub_align;
   if (s == NULL
       || !bfd_set_section_alignment (s, p2align))
-    return FALSE;
+    return false;
 
   if (!info->no_ld_generated_unwind_info)
     {
@@ -2402,7 +2399,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
       htab->glink_eh_frame = s;
       if (s == NULL
          || !bfd_set_section_alignment (s, 2))
-       return FALSE;
+       return false;
     }
 
   flags = SEC_ALLOC | SEC_LINKER_CREATED;
@@ -2410,7 +2407,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
   htab->elf.iplt = s;
   if (s == NULL
       || !bfd_set_section_alignment (s, 4))
-    return FALSE;
+    return false;
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
           | SEC_IN_MEMORY | SEC_LINKER_CREATED);
@@ -2418,7 +2415,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
   htab->elf.irelplt = s;
   if (s == NULL
       || ! bfd_set_section_alignment (s, 2))
-    return FALSE;
+    return false;
 
   /* Local plt entries.  */
   flags = (SEC_ALLOC | SEC_LOAD
@@ -2427,7 +2424,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
                                                       flags);
   if (htab->pltlocal == NULL
       || !bfd_set_section_alignment (htab->pltlocal, 2))
-    return FALSE;
+    return false;
 
   if (bfd_link_pic (info))
     {
@@ -2437,25 +2434,25 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
        = bfd_make_section_anyway_with_flags (abfd, ".rela.branch_lt", flags);
       if (htab->relpltlocal == NULL
          || !bfd_set_section_alignment (htab->relpltlocal, 2))
-       return FALSE;
+       return false;
     }
 
   if (!ppc_elf_create_linker_section (abfd, info, 0,
                                      &htab->sdata[0]))
-    return FALSE;
+    return false;
 
   if (!ppc_elf_create_linker_section (abfd, info, SEC_READONLY,
                                      &htab->sdata[1]))
-    return FALSE;
+    return false;
 
-  return TRUE;
+  return true;
 }
 
 /* We have to create .dynsbss and .rela.sbss here so that they get mapped
    to output sections (just like _bfd_elf_create_dynamic_sections has
    to create .dynbss and .rela.bss).  */
 
-static bfd_boolean
+static bool
 ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab;
@@ -2466,20 +2463,20 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 
   if (htab->elf.sgot == NULL
       && !ppc_elf_create_got (abfd, info))
-    return FALSE;
+    return false;
 
   if (!_bfd_elf_create_dynamic_sections (abfd, info))
-    return FALSE;
+    return false;
 
   if (htab->glink == NULL
       && !ppc_elf_create_glink (abfd, info))
-    return FALSE;
+    return false;
 
   s = bfd_make_section_anyway_with_flags (abfd, ".dynsbss",
                                          SEC_ALLOC | SEC_LINKER_CREATED);
   htab->dynsbss = s;
   if (s == NULL)
-    return FALSE;
+    return false;
 
   if (! bfd_link_pic (info))
     {
@@ -2489,12 +2486,12 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
       htab->relsbss = s;
       if (s == NULL
          || !bfd_set_section_alignment (s, 2))
-       return FALSE;
+       return false;
     }
 
-  if (htab->is_vxworks
+  if (htab->elf.target_os == is_vxworks
       && !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
-    return FALSE;
+    return false;
 
   s = htab->elf.splt;
   flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED;
@@ -2531,20 +2528,20 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info,
   if (eind->elf.root.type != bfd_link_hash_indirect)
     return;
 
-  if (eind->dyn_relocs != NULL)
+  if (ind->dyn_relocs != NULL)
     {
-      if (edir->dyn_relocs != NULL)
+      if (dir->dyn_relocs != NULL)
        {
          struct elf_dyn_relocs **pp;
          struct elf_dyn_relocs *p;
 
          /* Add reloc counts against the indirect sym to the direct sym
             list.  Merge any entries against the same section.  */
-         for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+         for (pp = &ind->dyn_relocs; (p = *pp) != NULL; )
            {
              struct elf_dyn_relocs *q;
 
-             for (q = edir->dyn_relocs; q != NULL; q = q->next)
+             for (q = dir->dyn_relocs; q != NULL; q = q->next)
                if (q->sec == p->sec)
                  {
                    q->pc_count += p->pc_count;
@@ -2555,11 +2552,11 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info,
              if (q == NULL)
                pp = &p->next;
            }
-         *pp = edir->dyn_relocs;
+         *pp = dir->dyn_relocs;
        }
 
-      edir->dyn_relocs = eind->dyn_relocs;
-      eind->dyn_relocs = NULL;
+      dir->dyn_relocs = ind->dyn_relocs;
+      ind->dyn_relocs = NULL;
     }
 
   /* Copy over the GOT refcount entries that we may have already seen to
@@ -2611,7 +2608,7 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info,
 /* Hook called by the linker routine which adds symbols from an object
    file.  We use it to put .comm items in .sbss, and not .bss.  */
 
-static bfd_boolean
+static bool
 ppc_elf_add_symbol_hook (bfd *abfd,
                         struct bfd_link_info *info,
                         Elf_Internal_Sym *sym,
@@ -2632,7 +2629,7 @@ ppc_elf_add_symbol_hook (bfd *abfd,
       htab = ppc_elf_hash_table (info);
       if (htab->sbss == NULL)
        {
-         flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED;
+         flagword flags = SEC_IS_COMMON | SEC_SMALL_DATA | SEC_LINKER_CREATED;
 
          if (!htab->elf.dynobj)
            htab->elf.dynobj = abfd;
@@ -2641,14 +2638,14 @@ ppc_elf_add_symbol_hook (bfd *abfd,
                                                           ".sbss",
                                                           flags);
          if (htab->sbss == NULL)
-           return FALSE;
+           return false;
        }
 
       *secp = htab->sbss;
       *valp = sym->st_size;
     }
 
-  return TRUE;
+  return true;
 }
 \f
 /* Find a linker generated pointer with a given addend and type.  */
@@ -2668,7 +2665,7 @@ elf_find_pointer_linker_section
 
 /* Allocate a pointer to live in a linker created section.  */
 
-static bfd_boolean
+static bool
 elf_allocate_pointer_linker_section (bfd *abfd,
                                     elf_linker_section_t *lsect,
                                     struct elf_link_hash_entry *h,
@@ -2691,7 +2688,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
       if (elf_find_pointer_linker_section (eh->linker_section_pointer,
                                           rel->r_addend,
                                           lsect))
-       return TRUE;
+       return true;
 
       ptr_linker_section_ptr = &eh->linker_section_pointer;
     }
@@ -2712,7 +2709,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
          ptr = bfd_zalloc (abfd, amt);
 
          if (!ptr)
-           return FALSE;
+           return false;
 
          elf_local_ptr_offsets (abfd) = ptr;
        }
@@ -2721,7 +2718,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
       if (elf_find_pointer_linker_section (ptr[r_symndx],
                                           rel->r_addend,
                                           lsect))
-       return TRUE;
+       return true;
 
       ptr_linker_section_ptr = &ptr[r_symndx];
     }
@@ -2733,7 +2730,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
   linker_section_ptr = 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;
@@ -2741,7 +2738,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
   *ptr_linker_section_ptr = linker_section_ptr;
 
   if (!bfd_set_section_alignment (lsect->section, 2))
-    return FALSE;
+    return false;
   linker_section_ptr->offset = lsect->section->size;
   lsect->section->size += 4;
 
@@ -2752,7 +2749,7 @@ elf_allocate_pointer_linker_section (bfd *abfd,
           (long) lsect->section->size);
 #endif
 
-  return TRUE;
+  return true;
 }
 
 static struct plt_entry **
@@ -2786,7 +2783,7 @@ update_local_sym_info (bfd *abfd,
   return local_plt + r_symndx;
 }
 
-static bfd_boolean
+static bool
 update_plt_info (bfd *abfd, struct plt_entry **plist,
                 asection *sec, bfd_vma addend)
 {
@@ -2799,10 +2796,10 @@ update_plt_info (bfd *abfd, struct plt_entry **plist,
       break;
   if (ent == NULL)
     {
-      bfd_size_type amt = sizeof (*ent);
+      size_t amt = sizeof (*ent);
       ent = bfd_alloc (abfd, amt);
       if (ent == NULL)
-       return FALSE;
+       return false;
       ent->next = *plist;
       ent->sec = sec;
       ent->addend = addend;
@@ -2810,7 +2807,7 @@ update_plt_info (bfd *abfd, struct plt_entry **plist,
       *plist = ent;
     }
   ent->plt.refcount += 1;
-  return TRUE;
+  return true;
 }
 
 static struct plt_entry *
@@ -2826,7 +2823,7 @@ find_plt_ent (struct plt_entry **plist, asection *sec, bfd_vma addend)
   return ent;
 }
 
-static bfd_boolean
+static bool
 is_branch_reloc (enum elf_ppc_reloc_type r_type)
 {
   return (r_type == R_PPC_PLTREL24
@@ -2844,7 +2841,7 @@ is_branch_reloc (enum elf_ppc_reloc_type r_type)
 
 /* Relocs on inline plt call sequence insns prior to the call.  */
 
-static bfd_boolean
+static bool
 is_plt_seq_reloc (enum elf_ppc_reloc_type r_type)
 {
   return (r_type == R_PPC_PLT16_HA
@@ -2868,7 +2865,7 @@ bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type)
    allocate space in the global offset table or procedure linkage
    table.  */
 
-static bfd_boolean
+static bool
 ppc_elf_check_relocs (bfd *abfd,
                      struct bfd_link_info *info,
                      asection *sec,
@@ -2883,16 +2880,7 @@ ppc_elf_check_relocs (bfd *abfd,
   struct elf_link_hash_entry *tga;
 
   if (bfd_link_relocatable (info))
-    return TRUE;
-
-  /* Don't do anything special with non-loaded, non-alloced sections.
-     In particular, any relocs in such sections should not affect GOT
-     and PLT reference counting (ie. we don't allow them to create GOT
-     or PLT entries), there's no possibility or desire to optimize TLS
-     relocs, and there's not much point in propagating relocs to shared
-     libs that the dynamic linker won't relocate.  */
-  if ((sec->flags & SEC_ALLOC) == 0)
-    return TRUE;
+    return true;
 
 #ifdef DEBUG
   _bfd_error_handler ("ppc_elf_check_relocs called for section %pA in %pB",
@@ -2911,10 +2899,10 @@ ppc_elf_check_relocs (bfd *abfd,
       if (htab->elf.dynobj == NULL)
        htab->elf.dynobj = abfd;
       if (!ppc_elf_create_glink (htab->elf.dynobj, info))
-       return FALSE;
+       return false;
     }
   tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
-                             FALSE, FALSE, TRUE);
+                             false, false, true);
   symtab_hdr = &elf_symtab_hdr (abfd);
   sym_hashes = elf_sym_hashes (abfd);
   got2 = bfd_get_section_by_name (abfd, ".got2");
@@ -2952,19 +2940,19 @@ ppc_elf_check_relocs (bfd *abfd,
          if (htab->elf.dynobj == NULL)
            htab->elf.dynobj = abfd;
          if (!ppc_elf_create_got (htab->elf.dynobj, info))
-           return FALSE;
+           return false;
          BFD_ASSERT (h == htab->elf.hgot);
        }
 
       tls_type = 0;
       r_type = ELF32_R_TYPE (rel->r_info);
       ifunc = NULL;
-      if (h == NULL && !htab->is_vxworks)
+      if (h == NULL && htab->elf.target_os != is_vxworks)
        {
-         Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+         Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
                                                          abfd, r_symndx);
          if (isym == NULL)
-           return FALSE;
+           return false;
 
          if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
            {
@@ -2972,7 +2960,7 @@ ppc_elf_check_relocs (bfd *abfd,
              ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
                                             NON_GOT | PLT_IFUNC);
              if (ifunc == NULL)
-               return FALSE;
+               return false;
 
              /* STT_GNU_IFUNC symbols must have a PLT entry;
                 In a non-pie executable even when there are
@@ -2993,12 +2981,12 @@ ppc_elf_check_relocs (bfd *abfd,
                          || r_type == R_PPC_PLT16_HA))
                    addend = rel->r_addend;
                  if (!update_plt_info (abfd, ifunc, got2, addend))
-                   return FALSE;
+                   return false;
                }
            }
        }
 
-      if (!htab->is_vxworks
+      if (htab->elf.target_os != is_vxworks
          && is_branch_reloc (r_type)
          && h != NULL
          && h == tga)
@@ -3025,7 +3013,7 @@ ppc_elf_check_relocs (bfd *abfd,
          else
            if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
                                        NON_GOT | TLS_TLS | TLS_MARK))
-             return FALSE;
+             return false;
          break;
 
        case R_PPC_PLTSEQ:
@@ -3074,7 +3062,7 @@ ppc_elf_check_relocs (bfd *abfd,
              if (htab->elf.dynobj == NULL)
                htab->elf.dynobj = abfd;
              if (!ppc_elf_create_got (htab->elf.dynobj, info))
-               return FALSE;
+               return false;
            }
          if (h != NULL)
            {
@@ -3084,14 +3072,14 @@ ppc_elf_check_relocs (bfd *abfd,
          else
            /* This is a global offset table entry for a local symbol.  */
            if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type))
-             return FALSE;
+             return false;
 
          /* We may also need a plt entry if the symbol turns out to be
             an ifunc.  */
          if (h != NULL && !bfd_link_pic (info))
            {
              if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
-               return FALSE;
+               return false;
            }
          break;
 
@@ -3100,11 +3088,11 @@ ppc_elf_check_relocs (bfd *abfd,
          htab->sdata[0].sym->ref_regular = 1;
          if (!elf_allocate_pointer_linker_section (abfd, &htab->sdata[0],
                                                    h, rel))
-           return FALSE;
+           return false;
          if (h != NULL)
            {
-             ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
-             h->non_got_ref = TRUE;
+             ppc_elf_hash_entry (h)->has_sda_refs = true;
+             h->non_got_ref = true;
            }
          break;
 
@@ -3113,16 +3101,16 @@ ppc_elf_check_relocs (bfd *abfd,
          if (!bfd_link_executable (info))
            {
              bad_shared_reloc (abfd, r_type);
-             return FALSE;
+             return false;
            }
          htab->sdata[1].sym->ref_regular = 1;
          if (!elf_allocate_pointer_linker_section (abfd, &htab->sdata[1],
                                                    h, rel))
-           return FALSE;
+           return false;
          if (h != NULL)
            {
-             ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
-             h->non_got_ref = TRUE;
+             ppc_elf_hash_entry (h)->has_sda_refs = true;
+             h->non_got_ref = true;
            }
          break;
 
@@ -3138,8 +3126,8 @@ ppc_elf_check_relocs (bfd *abfd,
        case R_PPC_VLE_SDAREL_HA16D:
          if (h != NULL)
            {
-             ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
-             h->non_got_ref = TRUE;
+             ppc_elf_hash_entry (h)->has_sda_refs = true;
+             h->non_got_ref = true;
            }
          break;
 
@@ -3159,13 +3147,13 @@ ppc_elf_check_relocs (bfd *abfd,
          if (!bfd_link_executable (info))
            {
              bad_shared_reloc (abfd, r_type);
-             return FALSE;
+             return false;
            }
          htab->sdata[1].sym->ref_regular = 1;
          if (h != NULL)
            {
-             ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
-             h->non_got_ref = TRUE;
+             ppc_elf_hash_entry (h)->has_sda_refs = true;
+             h->non_got_ref = true;
            }
          break;
 
@@ -3175,8 +3163,8 @@ ppc_elf_check_relocs (bfd *abfd,
        case R_PPC_EMB_RELSDA:
          if (h != NULL)
            {
-             ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
-             h->non_got_ref = TRUE;
+             ppc_elf_hash_entry (h)->has_sda_refs = true;
+             h->non_got_ref = true;
            }
          break;
 
@@ -3186,7 +3174,7 @@ ppc_elf_check_relocs (bfd *abfd,
        case R_PPC_EMB_NADDR16_HI:
        case R_PPC_EMB_NADDR16_HA:
          if (h != NULL)
-           h->non_got_ref = TRUE;
+           h->non_got_ref = true;
          break;
 
        case R_PPC_PLTREL24:
@@ -3214,7 +3202,7 @@ ppc_elf_check_relocs (bfd *abfd,
              pltent = update_local_sym_info (abfd, symtab_hdr, r_symndx,
                                              NON_GOT | PLT_KEEP);
              if (pltent == NULL)
-               return FALSE;
+               return false;
            }
          else
            {
@@ -3231,7 +3219,7 @@ ppc_elf_check_relocs (bfd *abfd,
                  || r_type == R_PPC_PLT16_HA))
            addend = rel->r_addend;
          if (!update_plt_info (abfd, pltent, got2, addend))
-           return FALSE;
+           return false;
          break;
 
          /* The following relocations don't need to propagate the
@@ -3295,7 +3283,7 @@ ppc_elf_check_relocs (bfd *abfd,
            {
              h->needs_plt = 1;
              if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
-               return FALSE;
+               return false;
            }
          break;
 
@@ -3303,22 +3291,24 @@ ppc_elf_check_relocs (bfd *abfd,
             Reconstruct it for later use during GC.  */
        case R_PPC_GNU_VTINHERIT:
          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-           return FALSE;
+           return false;
          break;
 
          /* This relocation describes which C++ vtable entries are actually
             used.  Record for later use during GC.  */
        case R_PPC_GNU_VTENTRY:
          if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
-           return FALSE;
+           return false;
          break;
 
+       case R_PPC_TPREL16_HI:
+       case R_PPC_TPREL16_HA:
+         sec->has_tls_reloc = 1;
+         /* Fall through.  */
          /* We shouldn't really be seeing TPREL32.  */
        case R_PPC_TPREL32:
        case R_PPC_TPREL16:
        case R_PPC_TPREL16_LO:
-       case R_PPC_TPREL16_HI:
-       case R_PPC_TPREL16_HA:
          if (bfd_link_dll (info))
            info->flags |= DF_STATIC_TLS;
          goto dodyn;
@@ -3344,10 +3334,10 @@ ppc_elf_check_relocs (bfd *abfd,
              asection *s;
              Elf_Internal_Sym *isym;
 
-             isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+             isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
                                            abfd, r_symndx);
              if (isym == NULL)
-               return FALSE;
+               return false;
 
              s = bfd_section_from_elf_index (abfd, isym->st_shndx);
              if (s == got2)
@@ -3372,7 +3362,7 @@ ppc_elf_check_relocs (bfd *abfd,
              /* We may need a plt entry if the symbol turns out to be
                 a function defined in a dynamic object.  */
              if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
-               return FALSE;
+               return false;
 
              /* We may need a copy reloc too.  */
              h->non_got_ref = 1;
@@ -3411,7 +3401,7 @@ ppc_elf_check_relocs (bfd *abfd,
                 a function defined in a dynamic object.  */
              h->needs_plt = 1;
              if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
-               return FALSE;
+               return false;
              break;
            }
 
@@ -3462,10 +3452,10 @@ ppc_elf_check_relocs (bfd *abfd,
                    htab->elf.dynobj = abfd;
 
                  sreloc = _bfd_elf_make_dynamic_reloc_section
-                   (sec, htab->elf.dynobj, 2, abfd, /*rela?*/ TRUE);
+                   (sec, htab->elf.dynobj, 2, abfd, /*rela?*/ true);
 
                  if (sreloc == NULL)
-                   return FALSE;
+                   return false;
                }
 
              /* If this is a global symbol, we count the number of
@@ -3475,13 +3465,13 @@ ppc_elf_check_relocs (bfd *abfd,
                  struct elf_dyn_relocs *p;
                  struct elf_dyn_relocs **rel_head;
 
-                 rel_head = &ppc_elf_hash_entry (h)->dyn_relocs;
+                 rel_head = &h->dyn_relocs;
                  p = *rel_head;
                  if (p == NULL || p->sec != sec)
                    {
                      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
                      if (p == NULL)
-                       return FALSE;
+                       return false;
                      p->next = *rel_head;
                      *rel_head = p;
                      p->sec = sec;
@@ -3499,15 +3489,15 @@ ppc_elf_check_relocs (bfd *abfd,
                     easily.  Oh well.  */
                  struct ppc_dyn_relocs *p;
                  struct ppc_dyn_relocs **rel_head;
-                 bfd_boolean is_ifunc;
+                 bool is_ifunc;
                  asection *s;
                  void *vpp;
                  Elf_Internal_Sym *isym;
 
-                 isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+                 isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
                                                abfd, r_symndx);
                  if (isym == NULL)
-                   return FALSE;
+                   return false;
 
                  s = bfd_section_from_elf_index (abfd, isym->st_shndx);
                  if (s == NULL)
@@ -3523,7 +3513,7 @@ ppc_elf_check_relocs (bfd *abfd,
                    {
                      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
                      if (p == NULL)
-                       return FALSE;
+                       return false;
                      p->next = *rel_head;
                      *rel_head = p;
                      p->sec = sec;
@@ -3538,18 +3528,29 @@ ppc_elf_check_relocs (bfd *abfd,
        }
     }
 
-  return TRUE;
+  return true;
 }
 \f
 /* Warn for conflicting Tag_GNU_Power_ABI_FP attributes between IBFD
    and OBFD, and merge non-conflicting ones.  */
-bfd_boolean
+bool
 _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
 {
   bfd *obfd = info->output_bfd;
   obj_attribute *in_attr, *in_attrs;
   obj_attribute *out_attr, *out_attrs;
-  bfd_boolean ret = TRUE;
+  bool ret = true;
+  bool warn_only;
+
+  /* We only warn about shared library mismatches, because common
+     libraries advertise support for a particular long double variant
+     but actually support more than one variant.  For example, glibc
+     typically supports 128-bit IBM long double in the shared library
+     but has a compatibility static archive for 64-bit long double.
+     The linker doesn't have the smarts to see that an app using
+     object files marked as 64-bit long double call the compatibility
+     layer objects and only from there call into the shared library.  */
+  warn_only = (ibfd->flags & DYNAMIC) != 0;
 
   in_attrs = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
   out_attrs = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
@@ -3567,9 +3568,12 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
        ;
       else if (out_fp == 0)
        {
-         out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
-         out_attr->i ^= in_fp;
-         last_fp = ibfd;
+         if (!warn_only)
+           {
+             out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
+             out_attr->i ^= in_fp;
+             last_fp = ibfd;
+           }
        }
       else if (out_fp != 2 && in_fp == 2)
        {
@@ -3577,7 +3581,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses hard float, %pB uses soft float"),
             last_fp, ibfd);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (out_fp == 2 && in_fp != 2)
        {
@@ -3585,7 +3589,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses hard float, %pB uses soft float"),
             ibfd, last_fp);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (out_fp == 1 && in_fp == 3)
        {
@@ -3593,7 +3597,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses double-precision hard float, "
               "%pB uses single-precision hard float"), last_fp, ibfd);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (out_fp == 3 && in_fp == 1)
        {
@@ -3601,7 +3605,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses double-precision hard float, "
               "%pB uses single-precision hard float"), ibfd, last_fp);
-         ret = FALSE;
+         ret = warn_only;
        }
 
       in_fp = in_attr->i & 0xc;
@@ -3610,9 +3614,12 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
        ;
       else if (out_fp == 0)
        {
-         out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
-         out_attr->i ^= in_fp;
-         last_ld = ibfd;
+         if (!warn_only)
+           {
+             out_attr->type = ATTR_TYPE_FLAG_INT_VAL;
+             out_attr->i ^= in_fp;
+             last_ld = ibfd;
+           }
        }
       else if (out_fp != 2 * 4 && in_fp == 2 * 4)
        {
@@ -3620,7 +3627,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses 64-bit long double, "
               "%pB uses 128-bit long double"), ibfd, last_ld);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (in_fp != 2 * 4 && out_fp == 2 * 4)
        {
@@ -3628,7 +3635,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses 64-bit long double, "
               "%pB uses 128-bit long double"), last_ld, ibfd);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (out_fp == 1 * 4 && in_fp == 3 * 4)
        {
@@ -3636,7 +3643,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses IBM long double, "
               "%pB uses IEEE long double"), last_ld, ibfd);
-         ret = FALSE;
+         ret = warn_only;
        }
       else if (out_fp == 3 * 4 && in_fp == 1 * 4)
        {
@@ -3644,7 +3651,7 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
            /* xgettext:c-format */
            (_("%pB uses IBM long double, "
               "%pB uses IEEE long double"), ibfd, last_ld);
-         ret = FALSE;
+         ret = warn_only;
        }
     }
 
@@ -3658,16 +3665,16 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info)
 
 /* Merge object attributes from IBFD into OBFD.  Warn if
    there are conflicting attributes.  */
-static bfd_boolean
+static bool
 ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
 {
   bfd *obfd;
   obj_attribute *in_attr, *in_attrs;
   obj_attribute *out_attr, *out_attrs;
-  bfd_boolean ret;
+  bool ret;
 
   if (!_bfd_elf_ppc_merge_fp_attributes (ibfd, info))
-    return FALSE;
+    return false;
 
   obfd = info->output_bfd;
   in_attrs = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
@@ -3677,7 +3684,7 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
      merge non-conflicting ones.  */
   in_attr = &in_attrs[Tag_GNU_Power_ABI_Vector];
   out_attr = &out_attrs[Tag_GNU_Power_ABI_Vector];
-  ret = TRUE;
+  ret = true;
   if (in_attr->i != out_attr->i)
     {
       int in_vec = in_attr->i & 3;
@@ -3712,7 +3719,7 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
            (_("%pB uses AltiVec vector ABI, %pB uses SPE vector ABI"),
             last_vec, ibfd);
          out_attr->type = ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_ERROR;
-         ret = FALSE;
+         ret = false;
        }
       else if (out_vec > in_vec)
        {
@@ -3721,7 +3728,7 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
            (_("%pB uses AltiVec vector ABI, %pB uses SPE vector ABI"),
             ibfd, last_vec);
          out_attr->type = ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_ERROR;
-         ret = FALSE;
+         ret = false;
        }
     }
 
@@ -3750,7 +3757,7 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
            (_("%pB uses r3/r4 for small structure returns, "
               "%pB uses memory"), last_struct, ibfd);
          out_attr->type = ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_ERROR;
-         ret = FALSE;
+         ret = false;
        }
       else if (out_struct > in_struct)
        {
@@ -3759,13 +3766,13 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
            (_("%pB uses r3/r4 for small structure returns, "
               "%pB uses memory"), ibfd, last_struct);
          out_attr->type = ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_ERROR;
-         ret = FALSE;
+         ret = false;
        }
     }
   if (!ret)
     {
       bfd_set_error (bfd_error_bad_value);
-      return FALSE;
+      return false;
     }
 
   /* Merge Tag_compatibility attributes and any common GNU ones.  */
@@ -3775,30 +3782,33 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 
-static bfd_boolean
+static bool
 ppc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 {
   bfd *obfd = info->output_bfd;
   flagword old_flags;
   flagword new_flags;
-  bfd_boolean error;
+  bool error;
 
   if (!is_ppc_elf (ibfd) || !is_ppc_elf (obfd))
-    return TRUE;
+    return true;
 
   /* Check if we have the same endianness.  */
   if (! _bfd_generic_verify_endian_match (ibfd, info))
-    return FALSE;
+    return false;
 
   if (!ppc_elf_merge_obj_attributes (ibfd, info))
-    return FALSE;
+    return false;
+
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return true;
 
   new_flags = elf_elfheader (ibfd)->e_flags;
   old_flags = elf_elfheader (obfd)->e_flags;
   if (!elf_flags_init (obfd))
     {
       /* First call, no flags set.  */
-      elf_flags_init (obfd) = TRUE;
+      elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = new_flags;
     }
 
@@ -3811,11 +3821,11 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
     {
       /* Warn about -mrelocatable mismatch.  Allow -mrelocatable-lib
         to be linked with either.  */
-      error = FALSE;
+      error = false;
       if ((new_flags & EF_PPC_RELOCATABLE) != 0
          && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
        {
-         error = TRUE;
+         error = true;
          _bfd_error_handler
            (_("%pB: compiled with -mrelocatable and linked with "
               "modules compiled normally"), ibfd);
@@ -3823,7 +3833,7 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
               && (old_flags & EF_PPC_RELOCATABLE) != 0)
        {
-         error = TRUE;
+         error = true;
          _bfd_error_handler
            (_("%pB: compiled normally and linked with "
               "modules compiled with -mrelocatable"), ibfd);
@@ -3850,7 +3860,7 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       /* Warn about any other mismatches.  */
       if (new_flags != old_flags)
        {
-         error = TRUE;
+         error = true;
          _bfd_error_handler
            /* xgettext:c-format */
            (_("%pB: uses different e_flags (%#x) fields "
@@ -3861,11 +3871,11 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       if (error)
        {
          bfd_set_error (bfd_error_bad_value);
-         return FALSE;
+         return false;
        }
     }
 
-  return TRUE;
+  return true;
 }
 
 static void
@@ -3875,7 +3885,7 @@ ppc_elf_vle_split16 (bfd *input_bfd,
                     bfd_byte *loc,
                     bfd_vma value,
                     split16_format_type split16_format,
-                    bfd_boolean fixup)
+                    bool fixup)
 {
   unsigned int insn, opcode;
 
@@ -3974,7 +3984,7 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
       else if (bfd_link_pic (info)
               && htab->elf.dynamic_sections_created
               && (h = elf_link_hash_lookup (&htab->elf, "_mcount",
-                                            FALSE, FALSE, TRUE)) != NULL
+                                            false, false, true)) != NULL
               && (h->type == STT_FUNC
                   || h->needs_plt)
               && h->ref_regular
@@ -4069,7 +4079,7 @@ ppc_elf_gc_mark_hook (asection *sec,
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
-static bfd_boolean
+static bool
 get_sym_h (struct elf_link_hash_entry **hp,
           Elf_Internal_Sym **symp,
           asection **symsecp,
@@ -4121,7 +4131,7 @@ get_sym_h (struct elf_link_hash_entry **hp,
                                            symtab_hdr->sh_info,
                                            0, NULL, NULL, NULL);
          if (locsyms == NULL)
-           return FALSE;
+           return false;
          *locsymsp = locsyms;
        }
       sym = locsyms + r_symndx;
@@ -4153,13 +4163,13 @@ get_sym_h (struct elf_link_hash_entry **hp,
          *tls_maskp = tls_mask;
        }
     }
-  return TRUE;
+  return true;
 }
 \f
 /* Analyze inline PLT call relocations to see whether calls to locally
    defined functions can be converted to direct calls.  */
 
-bfd_boolean
+bool
 ppc_elf_inline_plt (struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab;
@@ -4169,7 +4179,7 @@ ppc_elf_inline_plt (struct bfd_link_info *info)
 
   htab = ppc_elf_hash_table (info);
   if (htab == NULL)
-    return FALSE;
+    return false;
 
   /* A bl insn can reach -0x2000000 to 0x1fffffc.  The limit is
      reduced somewhat to cater for possible stubs that might be added
@@ -4192,7 +4202,7 @@ ppc_elf_inline_plt (struct bfd_link_info *info)
   if (high_vma - low_vma < limit)
     {
       htab->can_convert_all_inline_plt = 1;
-      return TRUE;
+      return true;
     }
 
   /* Otherwise, go looking through relocs for cases where a direct
@@ -4229,10 +4239,10 @@ ppc_elf_inline_plt (struct bfd_link_info *info)
            relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
                                                  info->keep_memory);
            if (relstart == NULL)
-             return FALSE;
+             return false;
 
            relend = relstart + sec->reloc_count;
-           for (rel = relstart; rel < relend; )
+           for (rel = relstart; rel < relend; rel++)
              {
                enum elf_ppc_reloc_type r_type;
                unsigned long r_symndx;
@@ -4251,10 +4261,9 @@ ppc_elf_inline_plt (struct bfd_link_info *info)
                  {
                    if (elf_section_data (sec)->relocs != relstart)
                      free (relstart);
-                   if (local_syms != NULL
-                       && symtab_hdr->contents != (unsigned char *) local_syms)
+                   if (symtab_hdr->contents != (unsigned char *) local_syms)
                      free (local_syms);
-                   return FALSE;
+                   return false;
                  }
 
                if (sym_sec != NULL && sym_sec->output_section != NULL)
@@ -4288,7 +4297,7 @@ ppc_elf_inline_plt (struct bfd_link_info *info)
        }
     }
 
-  return TRUE;
+  return true;
 }
 
 /* Set plt output section type, htab->tls_get_addr, and call the
@@ -4301,15 +4310,15 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
 
   htab = ppc_elf_hash_table (info);
   htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
-                                            FALSE, FALSE, TRUE);
+                                            false, false, true);
   if (htab->plt_type != PLT_NEW)
-    htab->params->no_tls_get_addr_opt = TRUE;
+    htab->params->no_tls_get_addr_opt = true;
 
   if (!htab->params->no_tls_get_addr_opt)
     {
       struct elf_link_hash_entry *opt, *tga;
       opt = elf_link_hash_lookup (&htab->elf, "__tls_get_addr_opt",
-                                 FALSE, FALSE, TRUE);
+                                 false, false, true);
       if (opt != NULL
          && (opt->root.type == bfd_link_hash_defined
              || opt->root.type == bfd_link_hash_defweak))
@@ -4343,14 +4352,14 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
                      _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
                                              opt->dynstr_index);
                      if (!bfd_elf_link_record_dynamic_symbol (info, opt))
-                       return FALSE;
+                       return false;
                    }
                  htab->tls_get_addr = opt;
                }
            }
        }
       else
-       htab->params->no_tls_get_addr_opt = TRUE;
+       htab->params->no_tls_get_addr_opt = true;
     }
   if (htab->plt_type == PLT_NEW
       && htab->elf.splt != NULL
@@ -4366,7 +4375,7 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
 /* Return TRUE iff REL is a branch reloc with a global symbol matching
    HASH.  */
 
-static bfd_boolean
+static bool
 branch_reloc_hash_match (const bfd *ibfd,
                         const Elf_Internal_Rela *rel,
                         const struct elf_link_hash_entry *hash)
@@ -4385,15 +4394,15 @@ branch_reloc_hash_match (const bfd *ibfd,
             || h->root.type == bfd_link_hash_warning)
        h = (struct elf_link_hash_entry *) h->root.u.i.link;
       if (h == hash)
-       return TRUE;
+       return true;
     }
-  return FALSE;
+  return false;
 }
 
 /* Run through all the TLS relocs looking for optimization
    opportunities.  */
 
-bfd_boolean
+bool
 ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                      struct bfd_link_info *info)
 {
@@ -4403,11 +4412,13 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
   int pass;
 
   if (!bfd_link_executable (info))
-    return TRUE;
+    return true;
 
   htab = ppc_elf_hash_table (info);
   if (htab == NULL)
-    return FALSE;
+    return false;
+
+  htab->do_tls_opt = 1;
 
   /* Make two passes through the relocs.  First time check that tls
      relocs involved in setting up a tls_get_addr call are indeed
@@ -4431,7 +4442,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
              relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
                                                    info->keep_memory);
              if (relstart == NULL)
-               return FALSE;
+               return false;
 
              relend = relstart + sec->reloc_count;
              for (rel = relstart; rel < relend; rel++)
@@ -4441,7 +4452,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                  struct elf_link_hash_entry *h = NULL;
                  unsigned char *tls_mask;
                  unsigned char tls_set, tls_clear;
-                 bfd_boolean is_local;
+                 bool is_local;
                  bfd_signed_vma *got_count;
 
                  r_symndx = ELF32_R_SYM (rel->r_info);
@@ -4476,7 +4487,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                                              ibfd, sec, rel->r_offset);
                      if (elf_section_data (sec)->relocs != relstart)
                        free (relstart);
-                     return TRUE;
+                     return true;
                    }
 
                  expecting_tls_get_addr = 0;
@@ -4574,6 +4585,37 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                      tls_clear = 0;
                      break;
 
+                   case R_PPC_TPREL16_HA:
+                     if (pass == 0)
+                       {
+                         unsigned char buf[4];
+                         unsigned int insn;
+                         bfd_vma off = rel->r_offset & ~3;
+                         if (!bfd_get_section_contents (ibfd, sec, buf,
+                                                        off, 4))
+                           {
+                             if (elf_section_data (sec)->relocs != relstart)
+                               free (relstart);
+                             return false;
+                           }
+                         insn = bfd_get_32 (ibfd, buf);
+                         /* addis rt,2,imm */
+                         if ((insn & ((0x3fu << 26) | 0x1f << 16))
+                             != ((15u << 26) | (2 << 16)))
+                           {
+                             /* xgettext:c-format */
+                             info->callbacks->minfo
+                               (_("%H: warning: %s unexpected insn %#x.\n"),
+                                ibfd, sec, off, "R_PPC_TPREL16_HA", insn);
+                             htab->do_tls_opt = 0;
+                           }
+                       }
+                     continue;
+
+                   case R_PPC_TPREL16_HI:
+                     htab->do_tls_opt = 0;
+                     continue;
+
                    default:
                      continue;
                    }
@@ -4598,7 +4640,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                                              ibfd, sec, rel->r_offset);
                      if (elf_section_data (sec)->relocs != relstart)
                        free (relstart);
-                     return TRUE;
+                     return true;
                    }
 
                  if (h != NULL)
@@ -4668,56 +4710,38 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
                free (relstart);
            }
       }
-  htab->do_tls_opt = 1;
-  return TRUE;
+  return true;
 }
 \f
-/* Find dynamic relocs for H that apply to read-only sections.  */
-
-static asection *
-readonly_dynrelocs (struct elf_link_hash_entry *h)
-{
-  struct elf_dyn_relocs *p;
-
-  for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
-    {
-      asection *s = p->sec->output_section;
-
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
-       return p->sec;
-    }
-  return NULL;
-}
-
 /* Return true if we have dynamic relocs against H or any of its weak
    aliases, that apply to read-only sections.  Cannot be used after
    size_dynamic_sections.  */
 
-static bfd_boolean
+static bool
 alias_readonly_dynrelocs (struct elf_link_hash_entry *h)
 {
   struct ppc_elf_link_hash_entry *eh = ppc_elf_hash_entry (h);
   do
     {
-      if (readonly_dynrelocs (&eh->elf))
-       return TRUE;
+      if (_bfd_elf_readonly_dynrelocs (&eh->elf))
+       return true;
       eh = ppc_elf_hash_entry (eh->elf.u.alias);
     } while (eh != NULL && &eh->elf != h);
 
-  return FALSE;
+  return false;
 }
 
 /* Return whether H has pc-relative dynamic relocs.  */
 
-static bfd_boolean
+static bool
 pc_dynrelocs (struct elf_link_hash_entry *h)
 {
   struct elf_dyn_relocs *p;
 
-  for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+  for (p = h->dyn_relocs; p != NULL; p = p->next)
     if (p->pc_count != 0)
-      return TRUE;
-  return FALSE;
+      return true;
+  return false;
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
@@ -4726,7 +4750,7 @@ pc_dynrelocs (struct elf_link_hash_entry *h)
    change the definition to something the rest of the link can
    understand.  */
 
-static bfd_boolean
+static bool
 ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
                               struct elf_link_hash_entry *h)
 {
@@ -4753,12 +4777,12 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       || h->type == STT_GNU_IFUNC
       || h->needs_plt)
     {
-      bfd_boolean local = (SYMBOL_CALLS_LOCAL (info, h)
+      bool local = (SYMBOL_CALLS_LOCAL (info, h)
                           || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
       /* Discard dyn_relocs when non-pic if we've decided that a
         function symbol is local.  */
       if (!bfd_link_pic (info) && local)
-       ppc_elf_hash_entry (h)->dyn_relocs = NULL;
+       h->dyn_relocs = NULL;
 
       /* Clear procedure linkage table information for any symbol that
         won't need a .plt entry.  */
@@ -4802,9 +4826,9 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
               || (h->non_got_ref
                   && !h->ref_regular_nonweak
                   && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)))
-             && !htab->is_vxworks
+             && htab->elf.target_os != is_vxworks
              && !ppc_elf_hash_entry (h)->has_sda_refs
-             && !readonly_dynrelocs (h))
+             && !_bfd_elf_readonly_dynrelocs (h))
            {
              h->pointer_equality_needed = 0;
              /* If we haven't seen a branch reloc and the symbol
@@ -4815,11 +4839,11 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
          else if (!bfd_link_pic (info))
            /* We are going to be defining the function symbol on the
               plt stub, so no dyn_relocs needed when non-pic.  */
-           ppc_elf_hash_entry (h)->dyn_relocs = NULL;
+           h->dyn_relocs = NULL;
        }
       h->protected_def = 0;
       /* Function symbols can't have copy relocs.  */
-      return TRUE;
+      return true;
     }
   else
     h->plt.plist = NULL;
@@ -4836,8 +4860,8 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       if (def->root.u.def.section == htab->elf.sdynbss
          || def->root.u.def.section == htab->elf.sdynrelro
          || def->root.u.def.section == htab->dynsbss)
-       ppc_elf_hash_entry (h)->dyn_relocs = NULL;
-      return TRUE;
+       h->dyn_relocs = NULL;
+      return true;
     }
 
   /* This is a reference to a symbol defined by a dynamic object which
@@ -4850,7 +4874,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   if (bfd_link_pic (info))
     {
       h->protected_def = 0;
-      return TRUE;
+      return true;
     }
 
   /* If there are no references to this symbol that do not use the
@@ -4858,7 +4882,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   if (!h->non_got_ref)
     {
       h->protected_def = 0;
-      return TRUE;
+      return true;
     }
 
   /* Protected variables do not work with .dynbss.  The copy in
@@ -4873,12 +4897,12 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
          && htab->params->pic_fixup == 0
          && info->disable_target_specific_optimizations <= 1)
        htab->params->pic_fixup = 1;
-      return TRUE;
+      return true;
     }
 
   /* If -z nocopyreloc was given, we won't generate them either.  */
   if (info->nocopyreloc)
-    return TRUE;
+    return true;
 
    /* If we don't find any dynamic relocs in read-only sections, then
       we'll be keeping the dynamic relocs and avoiding the copy reloc.
@@ -4888,10 +4912,10 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       executable.  */
   if (ELIMINATE_COPY_RELOCS
       && !ppc_elf_hash_entry (h)->has_sda_refs
-      && !htab->is_vxworks
+      && htab->elf.target_os != is_vxworks
       && !h->def_regular
       && !alias_readonly_dynrelocs (h))
-    return TRUE;
+    return true;
 
   /* We must allocate the symbol in our .dynbss section, which will
      become part of the .bss section of the executable.  There will be
@@ -4932,7 +4956,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
     }
 
   /* We no longer want dyn_relocs.  */
-  ppc_elf_hash_entry (h)->dyn_relocs = NULL;
+  h->dyn_relocs = NULL;
   return _bfd_elf_adjust_dynamic_copy (info, h, s);
 }
 \f
@@ -4942,7 +4966,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
    is xxxxxxxx.plt_pic32.<callee>, and for -fPIC
    xxxxxxxx.got2.plt_pic32.<callee>.  */
 
-static bfd_boolean
+static bool
 add_stub_sym (struct plt_entry *ent,
              struct elf_link_hash_entry *h,
              struct bfd_link_info *info)
@@ -4965,15 +4989,15 @@ add_stub_sym (struct plt_entry *ent,
     len3 = strlen (ent->sec->name);
   name = bfd_malloc (len1 + len2 + len3 + 9);
   if (name == NULL)
-    return FALSE;
+    return false;
   sprintf (name, "%08x", (unsigned) ent->addend & 0xffffffff);
   if (ent->sec)
     memcpy (name + 8, ent->sec->name, len3);
   memcpy (name + 8 + len3, stub, len2);
   memcpy (name + 8 + len3 + len2, h->root.root.string, len1 + 1);
-  sh = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
+  sh = elf_link_hash_lookup (&htab->elf, name, true, false, false);
   if (sh == NULL)
-    return FALSE;
+    return false;
   if (sh->root.type == bfd_link_hash_new)
     {
       sh->root.type = bfd_link_hash_defined;
@@ -4986,7 +5010,7 @@ add_stub_sym (struct plt_entry *ent,
       sh->non_elf = 0;
       sh->root.linker_def = 1;
     }
-  return TRUE;
+  return true;
 }
 
 /* Allocate NEED contiguous space in .got, and return the offset.
@@ -5050,7 +5074,7 @@ got_entries_needed (int tls_mask)
 
 /* If H is undefined, make it dynamic if that makes sense.  */
 
-static bfd_boolean
+static bool
 ensure_undef_dynamic (struct bfd_link_info *info,
                      struct elf_link_hash_entry *h)
 {
@@ -5064,22 +5088,33 @@ ensure_undef_dynamic (struct bfd_link_info *info,
       && !h->forced_local
       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
     return bfd_elf_link_record_dynamic_symbol (info, h);
-  return TRUE;
+  return true;
+}
+
+/* Choose whether to use htab->iplt or htab->pltlocal rather than the
+   usual htab->elf.splt section for a PLT entry.  */
+
+static inline
+bool use_local_plt (struct bfd_link_info *info,
+                          struct elf_link_hash_entry *h)
+{
+  return (h == NULL
+         || h->dynindx == -1
+         || !elf_hash_table (info)->dynamic_sections_created);
 }
 
 /* Allocate space in associated reloc sections for dynamic relocs.  */
 
-static bfd_boolean
+static bool
 allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info = inf;
   struct ppc_elf_link_hash_entry *eh;
   struct ppc_elf_link_hash_table *htab;
   struct elf_dyn_relocs *p;
-  bfd_boolean dyn;
 
   if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
+    return true;
 
   htab = ppc_elf_hash_table (info);
   eh = (struct ppc_elf_link_hash_entry *) h;
@@ -5095,7 +5130,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 
       /* Make sure this symbol is output as a dynamic symbol.  */
       if (!ensure_undef_dynamic (info, &eh->elf))
-       return FALSE;
+       return false;
 
       need = 0;
       if ((eh->tls_mask & (TLS_TLS | TLS_LD)) == (TLS_TLS | TLS_LD))
@@ -5142,19 +5177,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
      IFUNCs which are handled even in static executables.  */
   if (!htab->elf.dynamic_sections_created
       && h->type != STT_GNU_IFUNC)
-    eh->dyn_relocs = NULL;
+    h->dyn_relocs = NULL;
 
   /* Discard relocs on undefined symbols that must be local.  */
   else if (h->root.type == bfd_link_hash_undefined
           && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
-    eh->dyn_relocs = NULL;
+    h->dyn_relocs = NULL;
 
   /* Also discard relocs on undefined weak syms with non-default
      visibility, or when dynamic_undefined_weak says so.  */
   else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
-    eh->dyn_relocs = NULL;
+    h->dyn_relocs = NULL;
 
-  if (eh->dyn_relocs == NULL)
+  if (h->dyn_relocs == NULL)
     ;
 
   /* In the shared -Bsymbolic case, discard space allocated for
@@ -5174,7 +5209,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
        {
          struct elf_dyn_relocs **pp;
 
-         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+         for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
            {
              p->count -= p->pc_count;
              p->pc_count = 0;
@@ -5185,11 +5220,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
            }
        }
 
-      if (htab->is_vxworks)
+      if (htab->elf.target_os == is_vxworks)
        {
          struct elf_dyn_relocs **pp;
 
-         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+         for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
            {
              if (strcmp (p->sec->output_section->name, ".tls_vars") == 0)
                *pp = p->next;
@@ -5198,11 +5233,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
            }
        }
 
-      if (eh->dyn_relocs != NULL)
+      if (h->dyn_relocs != NULL)
        {
          /* Make sure this symbol is output as a dynamic symbol.  */
          if (!ensure_undef_dynamic (info, h))
-           return FALSE;
+           return false;
        }
     }
   else if (ELIMINATE_COPY_RELOCS)
@@ -5210,7 +5245,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
       /* For the non-pic case, discard space for relocs against
         symbols which turn out to need copy relocs or are not
         dynamic.  */
-      if (h->dynamic_adjusted
+      if ((h->dynamic_adjusted
+          || (h->ref_regular
+              && h->root.type == bfd_link_hash_undefweak
+              && (info->dynamic_undefined_weak > 0
+                  || !_bfd_elf_readonly_dynrelocs (h))))
          && !h->def_regular
          && !ELF_COMMON_DEF_P (h)
          && !(h->protected_def
@@ -5220,17 +5259,17 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
        {
          /* Make sure this symbol is output as a dynamic symbol.  */
          if (!ensure_undef_dynamic (info, h))
-           return FALSE;
+           return false;
 
          if (h->dynindx == -1)
-           eh->dyn_relocs = NULL;
+           h->dyn_relocs = NULL;
        }
       else
-       eh->dyn_relocs = NULL;
+       h->dyn_relocs = NULL;
     }
 
   /* Allocate space.  */
-  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+  for (p = h->dyn_relocs; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->sec)->sreloc;
       if (eh->elf.type == STT_GNU_IFUNC)
@@ -5244,8 +5283,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
      b) is an ifunc, or
      c) has plt16 relocs and has been processed by adjust_dynamic_symbol, or
      d) has plt16 relocs and we are linking statically.  */
-  dyn = htab->elf.dynamic_sections_created && h->dynindx != -1;
-  if (dyn
+  if ((htab->elf.dynamic_sections_created && h->dynindx != -1)
       || h->type == STT_GNU_IFUNC
       || (h->needs_plt && h->dynamic_adjusted)
       || (h->needs_plt
@@ -5256,14 +5294,20 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
              & (TLS_TLS | PLT_KEEP)) == PLT_KEEP))
     {
       struct plt_entry *ent;
-      bfd_boolean doneone = FALSE;
+      bool doneone = false;
       bfd_vma plt_offset = 0, glink_offset = (bfd_vma) -1;
 
       for (ent = h->plt.plist; ent != NULL; ent = ent->next)
        if (ent->plt.refcount > 0)
          {
-           asection *s = htab->elf.splt;
+           asection *s;
+           bool dyn;
+
+           if (!ensure_undef_dynamic (info, h))
+             return false;
 
+           dyn = !use_local_plt (info, h);
+           s = htab->elf.splt;
            if (!dyn)
              {
                if (h->type == STT_GNU_IFUNC)
@@ -5303,7 +5347,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 
                    if (htab->params->emit_stub_syms
                        && !add_stub_sym (ent, h, info))
-                     return FALSE;
+                     return false;
                  }
              }
            else
@@ -5397,7 +5441,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
                        htab->elf.sgotplt->size += 4;
                      }
                  }
-               doneone = TRUE;
+               doneone = true;
              }
          }
        else
@@ -5415,34 +5459,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
       h->needs_plt = 0;
     }
 
-  return TRUE;
-}
-
-/* Set DF_TEXTREL if we find any dynamic relocs that apply to
-   read-only sections.  */
-
-static bfd_boolean
-maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
-{
-  asection *sec;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  sec = readonly_dynrelocs (h);
-  if (sec != NULL)
-    {
-      struct bfd_link_info *info = (struct bfd_link_info *) info_p;
-
-      info->flags |= DF_TEXTREL;
-      info->callbacks->minfo
-       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
-        sec->owner, h->root.root.string, sec);
-
-      /* Not an error, just cut short the traversal.  */
-      return FALSE;
-    }
-  return TRUE;
+  return true;
 }
 
 static const unsigned char glink_eh_frame_cie[] =
@@ -5461,13 +5478,13 @@ static const unsigned char glink_eh_frame_cie[] =
 
 /* Set the sizes of the dynamic sections.  */
 
-static bfd_boolean
+static bool
 ppc_elf_size_dynamic_sections (bfd *output_bfd,
                               struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab;
   asection *s;
-  bfd_boolean relocs;
+  bool relocs;
   bfd *ibfd;
 
 #ifdef DEBUG
@@ -5526,7 +5543,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
                     linker script /DISCARD/, so we'll be discarding
                     the relocs too.  */
                }
-             else if (htab->is_vxworks
+             else if (htab->elf.target_os == is_vxworks
                       && strcmp (p->sec->output_section->name,
                                  ".tls_vars") == 0)
                {
@@ -5591,7 +5608,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
        else
          *local_got = (bfd_vma) -1;
 
-      if (htab->is_vxworks)
+      if (htab->elf.target_os == is_vxworks)
        continue;
 
       /* Allocate space for calls to local STT_GNU_IFUNC syms in .iplt.  */
@@ -5599,7 +5616,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
       for (; local_plt < end_local_plt; ++local_plt, ++lgot_masks)
        {
          struct plt_entry *ent;
-         bfd_boolean doneone = FALSE;
+         bool doneone = false;
          bfd_vma plt_offset = 0, glink_offset = (bfd_vma) -1;
 
          for (ent = *local_plt; ent != NULL; ent = ent->next)
@@ -5643,7 +5660,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
                        s = htab->relpltlocal;
                        s->size += sizeof (Elf32_External_Rela);
                      }
-                   doneone = TRUE;
+                   doneone = true;
                  }
              }
            else
@@ -5716,9 +5733,9 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
        {
          struct elf_link_hash_entry *sh;
          sh = elf_link_hash_lookup (&htab->elf, "__glink",
-                                    TRUE, FALSE, FALSE);
+                                    true, false, false);
          if (sh == NULL)
-           return FALSE;
+           return false;
          if (sh->root.type == bfd_link_hash_new)
            {
              sh->root.type = bfd_link_hash_defined;
@@ -5732,9 +5749,9 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
              sh->root.linker_def = 1;
            }
          sh = elf_link_hash_lookup (&htab->elf, "__glink_PLTresolve",
-                                    TRUE, FALSE, FALSE);
+                                    true, false, false);
          if (sh == NULL)
-           return FALSE;
+           return false;
          if (sh->root.type == bfd_link_hash_new)
            {
              sh->root.type = bfd_link_hash_defined;
@@ -5768,10 +5785,10 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
 
   /* We've now determined the sizes of the various dynamic sections.
      Allocate memory for them.  */
-  relocs = FALSE;
+  relocs = false;
   for (s = htab->elf.dynobj->sections; s != NULL; s = s->next)
     {
-      bfd_boolean strip_section = TRUE;
+      bool strip_section = true;
 
       if ((s->flags & SEC_LINKER_CREATED) == 0)
        continue;
@@ -5783,7 +5800,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
             we've exported dynamic symbols from them we must leave them.
             It's too late to tell BFD to get rid of the symbols.  */
          if (htab->elf.hplt != NULL)
-           strip_section = FALSE;
+           strip_section = false;
          /* Strip this section if we don't need it; see the
             comment below.  */
        }
@@ -5804,12 +5821,12 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
        {
          strip_section = (s->flags & SEC_KEEP) == 0;
        }
-      else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
+      else if (startswith (bfd_section_name (s), ".rela"))
        {
          if (s->size != 0)
            {
              /* Remember whether there are any relocation sections.  */
-             relocs = TRUE;
+             relocs = true;
 
              /* We use the reloc_count field as a counter if we need
                 to copy relocs into the output file.  */
@@ -5843,7 +5860,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
       /* Allocate memory for the section contents.  */
       s->contents = bfd_zalloc (htab->elf.dynobj, s->size);
       if (s->contents == NULL)
-       return FALSE;
+       return false;
     }
 
   if (htab->elf.dynamic_sections_created)
@@ -5856,56 +5873,22 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
 #define add_dynamic_entry(TAG, VAL) \
   _bfd_elf_add_dynamic_entry (info, TAG, VAL)
 
-      if (bfd_link_executable (info))
-       {
-         if (!add_dynamic_entry (DT_DEBUG, 0))
-           return FALSE;
-       }
-
-      if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
-       {
-         if (!add_dynamic_entry (DT_PLTGOT, 0)
-             || !add_dynamic_entry (DT_PLTRELSZ, 0)
-             || !add_dynamic_entry (DT_PLTREL, DT_RELA)
-             || !add_dynamic_entry (DT_JMPREL, 0))
-           return FALSE;
-       }
+      if (!_bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info,
+                                                   relocs))
+       return false;
 
       if (htab->plt_type == PLT_NEW
          && htab->glink != NULL
          && htab->glink->size != 0)
        {
          if (!add_dynamic_entry (DT_PPC_GOT, 0))
-           return FALSE;
+           return false;
          if (!htab->params->no_tls_get_addr_opt
              && htab->tls_get_addr != NULL
              && htab->tls_get_addr->plt.plist != NULL
              && !add_dynamic_entry (DT_PPC_OPT, PPC_OPT_TLS))
-           return FALSE;
-       }
-
-      if (relocs)
-       {
-         if (!add_dynamic_entry (DT_RELA, 0)
-             || !add_dynamic_entry (DT_RELASZ, 0)
-             || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
-           return FALSE;
-       }
-
-      /* If any dynamic relocs apply to a read-only section, then we
-        need a DT_TEXTREL entry.  */
-      if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (elf_hash_table (info), maybe_set_textrel,
-                               info);
-
-      if ((info->flags & DF_TEXTREL) != 0)
-       {
-         if (!add_dynamic_entry (DT_TEXTREL, 0))
-           return FALSE;
+           return false;
        }
-      if (htab->is_vxworks
-         && !elf_vxworks_add_dynamic_entries (output_bfd, info))
-       return FALSE;
    }
 #undef add_dynamic_entry
 
@@ -5969,7 +5952,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
                  == htab->glink_eh_frame->size);
     }
 
-  return TRUE;
+  return true;
 }
 
 /* Arrange to have _SDA_BASE_ or _SDA2_BASE_ stripped from the output
@@ -6014,14 +5997,14 @@ ppc_elf_maybe_strip_sdata_syms (struct bfd_link_info *info)
 
 /* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
 
-static bfd_boolean
+static bool
 ppc_elf_hash_symbol (struct elf_link_hash_entry *h)
 {
   if (h->plt.plist != NULL
       && !h->def_regular
       && (!h->pointer_equality_needed
          || !h->ref_regular_nonweak))
-    return FALSE;
+    return false;
 
   return _bfd_elf_hash_symbol (h);
 }
@@ -6061,11 +6044,11 @@ struct ppc_elf_relax_info
    space for the workaround has its size extended so that we can
    add trampolines at the end of the section.  */
 
-static bfd_boolean
+static bool
 ppc_elf_relax_section (bfd *abfd,
                       asection *isec,
                       struct bfd_link_info *link_info,
-                      bfd_boolean *again)
+                      bool *again)
 {
   struct one_branch_fixup
   {
@@ -6085,30 +6068,30 @@ ppc_elf_relax_section (bfd *abfd,
   struct one_branch_fixup *branch_fixups = NULL;
   struct ppc_elf_relax_info *relax_info = NULL;
   unsigned changes = 0;
-  bfd_boolean workaround_change;
+  bool workaround_change;
   struct ppc_elf_link_hash_table *htab;
   bfd_size_type trampbase, trampoff, newsize, picfixup_size;
   asection *got2;
-  bfd_boolean maybe_pasted;
+  bool maybe_pasted;
 
-  *again = FALSE;
+  *again = false;
 
   /* No need to do anything with non-alloc or non-code sections.  */
   if ((isec->flags & SEC_ALLOC) == 0
       || (isec->flags & SEC_CODE) == 0
       || (isec->flags & SEC_LINKER_CREATED) != 0
       || isec->size < 4)
-    return TRUE;
+    return true;
 
   /* We cannot represent the required PIC relocs in the output, so don't
      do anything.  The linker doesn't support mixing -shared and -r
      anyway.  */
   if (bfd_link_relocatable (link_info) && bfd_link_pic (link_info))
-    return TRUE;
+    return true;
 
   htab = ppc_elf_hash_table (link_info);
   if (htab == NULL)
-    return TRUE;
+    return true;
 
   isec->size = (isec->size + 3) & -4;
   if (isec->rawsize == 0)
@@ -6127,7 +6110,7 @@ ppc_elf_relax_section (bfd *abfd,
          elf_section_data (isec)->sec_info
            = bfd_zalloc (abfd, sizeof (struct ppc_elf_relax_info));
          if (elf_section_data (isec)->sec_info == NULL)
-           return FALSE;
+           return false;
        }
       relax_info = elf_section_data (isec)->sec_info;
       trampbase -= relax_info->workaround_size;
@@ -6545,7 +6528,7 @@ ppc_elf_relax_section (bfd *abfd,
        }
     }
 
-  workaround_change = FALSE;
+  workaround_change = false;
   newsize = trampoff;
   if (htab->params->ppc476_workaround
       && (!bfd_link_relocatable (link_info)
@@ -6569,7 +6552,7 @@ ppc_elf_relax_section (bfd *abfd,
          if (relax_info->workaround_size < newsize)
            {
              relax_info->workaround_size = newsize;
-             workaround_change = TRUE;
+             workaround_change = true;
            }
          /* Ensure relocate_section is called.  */
          isec->flags |= SEC_RELOC;
@@ -6639,12 +6622,11 @@ ppc_elf_relax_section (bfd *abfd,
       rel_hdr = _bfd_elf_single_rel_hdr (isec);
       rel_hdr->sh_size += changes * rel_hdr->sh_entsize;
     }
-  else if (internal_relocs != NULL
-          && elf_section_data (isec)->relocs != internal_relocs)
+  else if (elf_section_data (isec)->relocs != internal_relocs)
     free (internal_relocs);
 
   *again = changes != 0 || workaround_change;
-  return TRUE;
+  return true;
 
  error_return:
   while (branch_fixups != NULL)
@@ -6653,15 +6635,13 @@ ppc_elf_relax_section (bfd *abfd,
       branch_fixups = branch_fixups->next;
       free (f);
     }
-  if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
+  if ((unsigned char *) isymbuf != symtab_hdr->contents)
     free (isymbuf);
-  if (contents != NULL
-      && elf_section_data (isec)->this_hdr.contents != contents)
+  if (elf_section_data (isec)->this_hdr.contents != contents)
     free (contents);
-  if (internal_relocs != NULL
-      && elf_section_data (isec)->relocs != internal_relocs)
+  if (elf_section_data (isec)->relocs != internal_relocs)
     free (internal_relocs);
-  return FALSE;
+  return false;
 }
 \f
 /* What to do when ld finds relocations against symbols defined in
@@ -6822,7 +6802,7 @@ write_glink_stub (struct elf_link_hash_entry *h, struct plt_entry *ent,
 
 /* Return true if symbol is defined statically.  */
 
-static bfd_boolean
+static bool
 is_static_defined (struct elf_link_hash_entry *h)
 {
   return ((h->root.type == bfd_link_hash_defined
@@ -6840,7 +6820,7 @@ _bfd_elf_ppc_at_tls_transform (unsigned int insn, unsigned int reg)
 {
   unsigned int rtra;
 
-  if ((insn & (0x3f << 26)) != 31 << 26)
+  if ((insn & (0x3fu << 26)) != 31 << 26)
     return 0;
 
   if (reg == 0 || ((insn >> 11) & 0x1f) == reg)
@@ -6858,13 +6838,13 @@ _bfd_elf_ppc_at_tls_transform (unsigned int insn, unsigned int reg)
               || ((insn & (0x1f << 6)) >= 16 << 6
                   && (insn & (0x1f << 6)) < 24 << 6)))
     /* load and store indexed -> dform.  */
-    insn = (32 | ((insn >> 6) & 0x1f)) << 26;
+    insn = (32u | ((insn >> 6) & 0x1f)) << 26;
   else if ((insn & (((0x1a << 5) | 0x1f) << 1)) == 21 << 1)
     /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu.  */
-    insn = ((58 | ((insn >> 6) & 4)) << 26) | ((insn >> 6) & 1);
+    insn = ((58u | ((insn >> 6) & 4)) << 26) | ((insn >> 6) & 1);
   else if ((insn & (((0x1f << 5) | 0x1f) << 1)) == 341 << 1)
     /* lwax -> lwa.  */
-    insn = (58 << 26) | 2;
+    insn = (58u << 26) | 2;
   else
     return 0;
   insn |= rtra;
@@ -6879,36 +6859,36 @@ unsigned int
 _bfd_elf_ppc_at_tprel_transform (unsigned int insn, unsigned int reg)
 {
   if ((insn & (0x1f << 16)) == reg << 16
-      && ((insn & (0x3f << 26)) == 14u << 26 /* addi */
-         || (insn & (0x3f << 26)) == 15u << 26 /* addis */
-         || (insn & (0x3f << 26)) == 32u << 26 /* lwz */
-         || (insn & (0x3f << 26)) == 34u << 26 /* lbz */
-         || (insn & (0x3f << 26)) == 36u << 26 /* stw */
-         || (insn & (0x3f << 26)) == 38u << 26 /* stb */
-         || (insn & (0x3f << 26)) == 40u << 26 /* lhz */
-         || (insn & (0x3f << 26)) == 42u << 26 /* lha */
-         || (insn & (0x3f << 26)) == 44u << 26 /* sth */
-         || (insn & (0x3f << 26)) == 46u << 26 /* lmw */
-         || (insn & (0x3f << 26)) == 47u << 26 /* stmw */
-         || (insn & (0x3f << 26)) == 48u << 26 /* lfs */
-         || (insn & (0x3f << 26)) == 50u << 26 /* lfd */
-         || (insn & (0x3f << 26)) == 52u << 26 /* stfs */
-         || (insn & (0x3f << 26)) == 54u << 26 /* stfd */
-         || ((insn & (0x3f << 26)) == 58u << 26 /* lwa,ld,lmd */
+      && ((insn & (0x3fu << 26)) == 14u << 26 /* addi */
+         || (insn & (0x3fu << 26)) == 15u << 26 /* addis */
+         || (insn & (0x3fu << 26)) == 32u << 26 /* lwz */
+         || (insn & (0x3fu << 26)) == 34u << 26 /* lbz */
+         || (insn & (0x3fu << 26)) == 36u << 26 /* stw */
+         || (insn & (0x3fu << 26)) == 38u << 26 /* stb */
+         || (insn & (0x3fu << 26)) == 40u << 26 /* lhz */
+         || (insn & (0x3fu << 26)) == 42u << 26 /* lha */
+         || (insn & (0x3fu << 26)) == 44u << 26 /* sth */
+         || (insn & (0x3fu << 26)) == 46u << 26 /* lmw */
+         || (insn & (0x3fu << 26)) == 47u << 26 /* stmw */
+         || (insn & (0x3fu << 26)) == 48u << 26 /* lfs */
+         || (insn & (0x3fu << 26)) == 50u << 26 /* lfd */
+         || (insn & (0x3fu << 26)) == 52u << 26 /* stfs */
+         || (insn & (0x3fu << 26)) == 54u << 26 /* stfd */
+         || ((insn & (0x3fu << 26)) == 58u << 26 /* lwa,ld,lmd */
              && (insn & 3) != 1)
-         || ((insn & (0x3f << 26)) == 62u << 26 /* std, stmd */
+         || ((insn & (0x3fu << 26)) == 62u << 26 /* std, stmd */
              && ((insn & 3) == 0 || (insn & 3) == 3))))
     {
       insn &= ~(0x1f << 16);
     }
   else if ((insn & (0x1f << 21)) == reg << 21
-          && ((insn & (0x3e << 26)) == 24u << 26 /* ori, oris */
-              || (insn & (0x3e << 26)) == 26u << 26 /* xori,xoris */
-              || (insn & (0x3e << 26)) == 28u << 26 /* andi,andis */))
+          && ((insn & (0x3eu << 26)) == 24u << 26 /* ori, oris */
+              || (insn & (0x3eu << 26)) == 26u << 26 /* xori,xoris */
+              || (insn & (0x3eu << 26)) == 28u << 26 /* andi,andis */))
     {
       insn &= ~(0x1f << 21);
       insn |= (insn & (0x1f << 16)) << 5;
-      if ((insn & (0x3e << 26)) == 26 << 26 /* xori,xoris */)
+      if ((insn & (0x3eu << 26)) == 26u << 26 /* xori,xoris */)
        insn -= 2 >> 26;  /* convert to ori,oris */
     }
   else
@@ -6916,20 +6896,20 @@ _bfd_elf_ppc_at_tprel_transform (unsigned int insn, unsigned int reg)
   return insn;
 }
 
-static bfd_boolean
+static bool
 is_insn_ds_form (unsigned int insn)
 {
-  return ((insn & (0x3f << 26)) == 58u << 26 /* ld,ldu,lwa */
-         || (insn & (0x3f << 26)) == 62u << 26 /* std,stdu,stq */
-         || (insn & (0x3f << 26)) == 57u << 26 /* lfdp */
-         || (insn & (0x3f << 26)) == 61u << 26 /* stfdp */);
+  return ((insn & (0x3fu << 26)) == 58u << 26 /* ld,ldu,lwa */
+         || (insn & (0x3fu << 26)) == 62u << 26 /* std,stdu,stq */
+         || (insn & (0x3fu << 26)) == 57u << 26 /* lfdp */
+         || (insn & (0x3fu << 26)) == 61u << 26 /* stfdp */);
 }
 
-static bfd_boolean
+static bool
 is_insn_dq_form (unsigned int insn)
 {
-  return ((insn & (0x3f << 26)) == 56u << 26 /* lq */
-         || ((insn & (0x3f << 26)) == (61u << 26) /* lxv, stxv */
+  return ((insn & (0x3fu << 26)) == 56u << 26 /* lq */
+         || ((insn & (0x3fu << 26)) == (61u << 26) /* lxv, stxv */
              && (insn & 3) == 1));
 }
 
@@ -6962,7 +6942,7 @@ is_insn_dq_form (unsigned int insn)
    section, which means that the addend must be adjusted
    accordingly.  */
 
-static bfd_boolean
+static int
 ppc_elf_relocate_section (bfd *output_bfd,
                          struct bfd_link_info *info,
                          bfd *input_bfd,
@@ -6981,9 +6961,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
   Elf_Internal_Rela outrel;
   asection *got2;
   bfd_vma *local_got_offsets;
-  bfd_boolean ret = TRUE;
+  bool ret = true;
   bfd_vma d_offset = (bfd_big_endian (input_bfd) ? 2 : 0);
-  bfd_boolean is_vxworks_tls;
+  bool is_vxworks_tls;
   unsigned int picfixup_size = 0;
   struct ppc_elf_relax_info *relax_info = NULL;
 
@@ -6998,7 +6978,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
   if (!is_ppc_elf (input_bfd))
     {
       bfd_set_error (bfd_error_wrong_format);
-      return FALSE;
+      return false;
     }
 
   got2 = bfd_get_section_by_name (input_bfd, ".got2");
@@ -7013,7 +6993,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
   sym_hashes = elf_sym_hashes (input_bfd);
   /* We have to handle relocations in vxworks .tls_vars sections
      specially, because the dynamic loader is 'weird'.  */
-  is_vxworks_tls = (htab->is_vxworks && bfd_link_pic (info)
+  is_vxworks_tls = (htab->elf.target_os == is_vxworks && bfd_link_pic (info)
                    && !strcmp (input_section->output_section->name,
                                ".tls_vars"));
   if (input_section->sec_info_type == SEC_INFO_TYPE_TARGET)
@@ -7033,8 +7013,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
       unsigned long r_symndx;
       bfd_vma relocation;
       bfd_vma branch_bit, from;
-      bfd_boolean unresolved_reloc, save_unresolved_reloc;
-      bfd_boolean warned;
+      bool unresolved_reloc, save_unresolved_reloc;
+      bool warned;
       unsigned int tls_type, tls_mask, tls_gd;
       struct plt_entry **ifunc, **plt_list;
       struct reloc_howto_struct alt_howto;
@@ -7044,8 +7024,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
       sym = NULL;
       sec = NULL;
       h = NULL;
-      unresolved_reloc = FALSE;
-      warned = FALSE;
+      unresolved_reloc = false;
+      warned = false;
       r_symndx = ELF32_R_SYM (rel->r_info);
 
       if (r_symndx < symtab_hdr->sh_info)
@@ -7058,7 +7038,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
        }
       else
        {
-         bfd_boolean ignored;
+         bool ignored;
 
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                   r_symndx, symtab_hdr, sym_hashes,
@@ -7242,7 +7222,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                {
                  /* IE */
                  insn1 &= (0x1f << 21) | (0x1f << 16);
-                 insn1 |= 32 << 26;    /* lwz */
+                 insn1 |= 32u << 26;   /* lwz */
                  if (offset != (bfd_vma) -1)
                    {
                      rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE);
@@ -7411,7 +7391,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
            insn = bfd_get_32 (input_bfd,
                               contents + rel->r_offset - d_offset);
-           if ((insn & (0x3f << 26)) == 15u << 26
+           if ((insn & (0x3fu << 26)) == 15u << 26
                && (insn & (0x1f << 16)) != 0)
              {
                if (!bfd_link_pic (info))
@@ -7447,7 +7427,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
            {
              insn = bfd_get_32 (input_bfd,
                                 contents + rel->r_offset - d_offset);
-             if ((insn & (0x3f << 26)) == (15u << 26)
+             if ((insn & (0x3fu << 26)) == (15u << 26)
                  && (insn & (0x1f << 16)) == 0 /* lis */)
                {
                  bfd_byte *p;
@@ -7510,28 +7490,28 @@ ppc_elf_relocate_section (bfd *output_bfd,
            {
              insn = bfd_get_32 (input_bfd,
                                 contents + rel->r_offset - d_offset);
-             if ((insn & (0x3f << 26)) == 14u << 26    /* addi */
-                 || (insn & (0x3f << 26)) == 32u << 26 /* lwz */
-                 || (insn & (0x3f << 26)) == 34u << 26 /* lbz */
-                 || (insn & (0x3f << 26)) == 36u << 26 /* stw */
-                 || (insn & (0x3f << 26)) == 38u << 26 /* stb */
-                 || (insn & (0x3f << 26)) == 40u << 26 /* lhz */
-                 || (insn & (0x3f << 26)) == 42u << 26 /* lha */
-                 || (insn & (0x3f << 26)) == 44u << 26 /* sth */
-                 || (insn & (0x3f << 26)) == 46u << 26 /* lmw */
-                 || (insn & (0x3f << 26)) == 47u << 26 /* stmw */
-                 || (insn & (0x3f << 26)) == 48u << 26 /* lfs */
-                 || (insn & (0x3f << 26)) == 50u << 26 /* lfd */
-                 || (insn & (0x3f << 26)) == 52u << 26 /* stfs */
-                 || (insn & (0x3f << 26)) == 54u << 26 /* stfd */
-                 || ((insn & (0x3f << 26)) == 58u << 26 /* lwa,ld,lmd */
+             if ((insn & (0x3fu << 26)) == 14u << 26    /* addi */
+                 || (insn & (0x3fu << 26)) == 32u << 26 /* lwz */
+                 || (insn & (0x3fu << 26)) == 34u << 26 /* lbz */
+                 || (insn & (0x3fu << 26)) == 36u << 26 /* stw */
+                 || (insn & (0x3fu << 26)) == 38u << 26 /* stb */
+                 || (insn & (0x3fu << 26)) == 40u << 26 /* lhz */
+                 || (insn & (0x3fu << 26)) == 42u << 26 /* lha */
+                 || (insn & (0x3fu << 26)) == 44u << 26 /* sth */
+                 || (insn & (0x3fu << 26)) == 46u << 26 /* lmw */
+                 || (insn & (0x3fu << 26)) == 47u << 26 /* stmw */
+                 || (insn & (0x3fu << 26)) == 48u << 26 /* lfs */
+                 || (insn & (0x3fu << 26)) == 50u << 26 /* lfd */
+                 || (insn & (0x3fu << 26)) == 52u << 26 /* stfs */
+                 || (insn & (0x3fu << 26)) == 54u << 26 /* stfd */
+                 || ((insn & (0x3fu << 26)) == 58u << 26 /* lwa,ld,lmd */
                      && (insn & 3) != 1)
-                 || ((insn & (0x3f << 26)) == 62u << 26 /* std, stmd */
+                 || ((insn & (0x3fu << 26)) == 62u << 26 /* std, stmd */
                      && ((insn & 3) == 0 || (insn & 3) == 3)))
                {
                  /* Arrange to apply the reloc addend, if any.  */
                  relocation = 0;
-                 unresolved_reloc = FALSE;
+                 unresolved_reloc = false;
                  rel->r_info = ELF32_R_INFO (0, r_type);
                }
              else
@@ -7545,7 +7525,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
        }
 
       ifunc = NULL;
-      if (!htab->is_vxworks)
+      if (htab->elf.target_os != is_vxworks)
        {
          struct plt_entry *ent;
 
@@ -7605,7 +7585,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                       input_bfd, input_section, rel->r_offset, sym_name);
                }
 
-             unresolved_reloc = FALSE;
+             unresolved_reloc = false;
              if (htab->plt_type == PLT_NEW
                  || !htab->elf.dynamic_sections_created
                  || h == NULL
@@ -7626,39 +7606,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
       if (r_type < R_PPC_max)
        howto = ppc_elf_howto_table[r_type];
 
-      switch (r_type)
-       {
-       default:
-         break;
-
-       case R_PPC_TPREL16_HA:
-         if (htab->do_tls_opt && relocation + addend + 0x8000 < 0x10000)
-           {
-             bfd_byte *p = contents + (rel->r_offset & ~3);
-             unsigned int insn = bfd_get_32 (input_bfd, p);
-             if ((insn & ((0x3f << 26) | 0x1f << 16))
-                 != ((15u << 26) | (2 << 16)) /* addis rt,2,imm */)
-               /* xgettext:c-format */
-               info->callbacks->minfo
-                 (_("%H: warning: %s unexpected insn %#x.\n"),
-                  input_bfd, input_section, rel->r_offset, howto->name, insn);
-             else
-               bfd_put_32 (input_bfd, NOP, p);
-           }
-         break;
-
-       case R_PPC_TPREL16_LO:
-         if (htab->do_tls_opt && relocation + addend + 0x8000 < 0x10000)
-           {
-             bfd_byte *p = contents + (rel->r_offset & ~3);
-             unsigned int insn = bfd_get_32 (input_bfd, p);
-             insn &= ~(0x1f << 16);
-             insn |= 2 << 16;
-             bfd_put_32 (input_bfd, insn, p);
-           }
-         break;
-       }
-
       tls_type = 0;
       switch (r_type)
        {
@@ -7668,7 +7615,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                              input_bfd, howto->name);
 
          bfd_set_error (bfd_error_bad_value);
-         ret = FALSE;
+         ret = false;
          goto copy_reloc;
 
        case R_PPC_NONE:
@@ -7746,7 +7693,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                else
                  {
                    indx = h->dynindx;
-                   unresolved_reloc = FALSE;
+                   unresolved_reloc = false;
                  }
                offp = &h->got.offset;
              }
@@ -7967,7 +7914,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                                                    input_bfd,
                                                    input_section,
                                                    rel->r_offset,
-                                                   TRUE);
+                                                   true);
              goto copy_reloc;
            }
          if (h != NULL && h->type == STT_GNU_IFUNC && bfd_link_pic (info))
@@ -8088,11 +8035,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
          if (bfd_link_pic (info)
              ? ((h == NULL
-                 || ppc_elf_hash_entry (h)->dyn_relocs != NULL)
+                 || h->dyn_relocs != NULL)
                 && ((h != NULL && pc_dynrelocs (h))
                     || must_be_dyn_reloc (info, r_type)))
              : (h != NULL
-                && ppc_elf_hash_entry (h)->dyn_relocs != NULL))
+                && h->dyn_relocs != NULL))
            {
              int skip;
              bfd_byte *loc;
@@ -8133,7 +8080,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                {
                  indx = h->dynindx;
                  BFD_ASSERT (indx != -1);
-                 unresolved_reloc = FALSE;
+                 unresolved_reloc = false;
                  outrel.r_info = ELF32_R_INFO (indx, r_type);
                  outrel.r_addend = rel->r_addend;
                }
@@ -8164,14 +8111,14 @@ ppc_elf_relocate_section (bfd *output_bfd,
                             input_bfd, input_section, rel->r_offset,
                             howto->name,
                             sym_name);
-                         ret = FALSE;
+                         ret = false;
                        }
                      else if (r_symndx == STN_UNDEF || bfd_is_abs_section (sec))
                        ;
                      else if (sec == NULL || sec->owner == NULL)
                        {
                          bfd_set_error (bfd_error_bad_value);
-                         ret = FALSE;
+                         ret = false;
                        }
                      else
                        {
@@ -8225,7 +8172,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                    htab->maybe_local_ifunc_resolver = 1;
                }
              if (sreloc == NULL)
-               return FALSE;
+               return false;
 
              loc = sreloc->contents;
              loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
@@ -8338,7 +8285,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
          BFD_ASSERT (htab->sdata[0].section != NULL);
          if (!is_static_defined (htab->sdata[0].sym))
            {
-             unresolved_reloc = TRUE;
+             unresolved_reloc = true;
              break;
            }
          relocation
@@ -8352,7 +8299,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
          BFD_ASSERT (htab->sdata[1].section != NULL);
          if (!is_static_defined (htab->sdata[1].sym))
            {
-             unresolved_reloc = TRUE;
+             unresolved_reloc = true;
              break;
            }
          relocation
@@ -8368,7 +8315,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
        case R_PPC_TOC16:                       /* phony GOT16 relocations */
          if (sec == NULL || sec->output_section == NULL)
            {
-             unresolved_reloc = TRUE;
+             unresolved_reloc = true;
              break;
            }
          BFD_ASSERT (strcmp (bfd_section_name (sec), ".got") == 0
@@ -8395,7 +8342,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                {
                  /* Relocation is to the entry for this symbol in the
                     procedure linkage table.  */
-                 unresolved_reloc = FALSE;
+                 unresolved_reloc = false;
                  if (htab->plt_type == PLT_NEW)
                    relocation = (htab->glink->output_section->vma
                                  + htab->glink->output_offset
@@ -8430,7 +8377,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                                                 + symtab_hdr->sh_info);
              plt_list = local_plt + r_symndx;
            }
-         unresolved_reloc = TRUE;
+         unresolved_reloc = true;
          if (plt_list != NULL)
            {
              struct plt_entry *ent;
@@ -8441,11 +8388,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
                {
                  asection *plt;
 
-                 unresolved_reloc = FALSE;
+                 unresolved_reloc = false;
                  plt = htab->elf.splt;
-                 if (!htab->elf.dynamic_sections_created
-                     || h == NULL
-                     || h->dynindx == -1)
+                 if (use_local_plt (info, h))
                    {
                      if (ifunc != NULL)
                        plt = htab->elf.iplt;
@@ -8482,7 +8427,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                || sec->output_section == NULL
                || !is_static_defined (sda))
              {
-               unresolved_reloc = TRUE;
+               unresolved_reloc = true;
                break;
              }
            addend -= SYM_VAL (sda);
@@ -8513,7 +8458,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                || sec->output_section == NULL
                || !is_static_defined (sda))
              {
-               unresolved_reloc = TRUE;
+               unresolved_reloc = true;
                break;
              }
            addend -= SYM_VAL (sda);
@@ -8589,7 +8534,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
            if (sec == NULL || sec->output_section == NULL)
              {
-               unresolved_reloc = TRUE;
+               unresolved_reloc = true;
                break;
              }
 
@@ -8623,7 +8568,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                   name);
 
                bfd_set_error (bfd_error_bad_value);
-               ret = FALSE;
+               ret = false;
                goto copy_reloc;
              }
 
@@ -8631,7 +8576,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
              {
                if (!is_static_defined (sda))
                  {
-                   unresolved_reloc = TRUE;
+                   unresolved_reloc = true;
                    break;
                  }
                addend -= SYM_VAL (sda);
@@ -8696,7 +8641,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
            if (sec == NULL || sec->output_section == NULL)
              {
-               unresolved_reloc = TRUE;
+               unresolved_reloc = true;
                break;
              }
 
@@ -8719,13 +8664,13 @@ ppc_elf_relocate_section (bfd *output_bfd,
                   name);
 
                bfd_set_error (bfd_error_bad_value);
-               ret = FALSE;
+               ret = false;
                goto copy_reloc;
              }
 
            if (sda == NULL || !is_static_defined (sda))
              {
-               unresolved_reloc = TRUE;
+               unresolved_reloc = true;
                break;
              }
            value = relocation + addend - SYM_VAL (sda);
@@ -8777,7 +8722,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
        case R_PPC_VLE_ADDR20:
          ppc_elf_vle_split20 (output_bfd, contents + rel->r_offset, relocation);
-         continue;
+         goto copy_reloc;
 
          /* Relocate against the beginning of the section.  */
        case R_PPC_SECTOFF:
@@ -8786,7 +8731,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
        case R_PPC_SECTOFF_HA:
          if (sec == NULL || sec->output_section == NULL)
            {
-             unresolved_reloc = TRUE;
+             unresolved_reloc = true;
              break;
            }
          addend -= sec->output_section->vma;
@@ -8819,10 +8764,35 @@ ppc_elf_relocate_section (bfd *output_bfd,
                              input_bfd, howto->name);
 
          bfd_set_error (bfd_error_invalid_operation);
-         ret = FALSE;
+         ret = false;
          goto copy_reloc;
        }
 
+      switch (r_type)
+       {
+       default:
+         break;
+
+       case R_PPC_TPREL16_HA:
+         if (htab->do_tls_opt && relocation + addend + 0x8000 < 0x10000)
+           {
+             bfd_byte *p = contents + (rel->r_offset & ~3);
+             bfd_put_32 (input_bfd, NOP, p);
+           }
+         break;
+
+       case R_PPC_TPREL16_LO:
+         if (htab->do_tls_opt && relocation + addend + 0x8000 < 0x10000)
+           {
+             bfd_byte *p = contents + (rel->r_offset & ~3);
+             unsigned int insn = bfd_get_32 (input_bfd, p);
+             insn &= ~(0x1f << 16);
+             insn |= 2 << 16;
+             bfd_put_32 (input_bfd, insn, p);
+           }
+         break;
+       }
+
       switch (r_type)
        {
        default:
@@ -8853,7 +8823,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
            {
              bfd_byte *p = contents + (rel->r_offset & ~3);
              bfd_put_32 (input_bfd, NOP, p);
-             unresolved_reloc = FALSE;
+             unresolved_reloc = false;
              r_type = R_PPC_NONE;
              howto = ppc_elf_howto_table[r_type];
            }
@@ -8944,7 +8914,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                   input_bfd, input_section, rel->r_offset,
                   howto->name, sym_name, mask + 1);
                bfd_set_error (bfd_error_bad_value);
-               ret = FALSE;
+               ret = false;
              }
          }
          break;
@@ -8973,7 +8943,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
             input_bfd, input_section, rel->r_offset,
             howto->name,
             sym_name);
-         ret = FALSE;
+         ret = false;
        }
 
       /* 16-bit fields in insns mostly have signed values, but a
@@ -8990,11 +8960,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
              unsigned int insn;
 
              insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
-             if ((insn & (0x3f << 26)) == 10u << 26 /* cmpli */)
+             if ((insn & (0x3fu << 26)) == 10u << 26 /* cmpli */)
                complain = complain_overflow_bitfield;
-             else if ((insn & (0x3f << 26)) == 28u << 26 /* andi */
-                      || (insn & (0x3f << 26)) == 24u << 26 /* ori */
-                      || (insn & (0x3f << 26)) == 26u << 26 /* xori */)
+             else if ((insn & (0x3fu << 26)) == 28u << 26 /* andi */
+                      || (insn & (0x3fu << 26)) == 24u << 26 /* ori */
+                      || (insn & (0x3fu << 26)) == 26u << 26 /* xori */)
                complain = complain_overflow_unsigned;
            }
          if (howto->complain_on_overflow != complain)
@@ -9053,7 +9023,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                (_("%H: %s reloc against `%s': error %d\n"),
                 input_bfd, input_section, rel->r_offset,
                 howto->name, sym_name, (int) r);
-             ret = FALSE;
+             ret = false;
            }
        }
     copy_reloc:
@@ -9138,13 +9108,13 @@ ppc_elf_relocate_section (bfd *output_bfd,
        {
          bfd_vma offset = addr - start_addr;
          Elf_Internal_Rela *lo, *hi;
-         bfd_boolean is_data;
+         bool is_data;
          bfd_vma patch_off, patch_addr;
          unsigned int insn;
 
          /* Do we have a data reloc at this offset?  If so, leave
             the word alone.  */
-         is_data = FALSE;
+         is_data = false;
          lo = relocs;
          hi = relend;
          rel = NULL;
@@ -9163,7 +9133,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
                    case R_PPC_UADDR32:
                    case R_PPC_REL32:
                    case R_PPC_ADDR30:
-                     is_data = TRUE;
+                     is_data = true;
                      break;
                    default:
                      break;
@@ -9218,10 +9188,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
             . new_page:                new_page:
             .  */
          insn = bfd_get_32 (input_bfd, contents + offset);
-         if ((insn & (0x3f << 26)) == (18u << 26)          /* b,bl,ba,bla */
-             || ((insn & (0x3f << 26)) == (16u << 26)      /* bc,bcl,bca,bcla*/
+         if ((insn & (0x3fu << 26)) == (18u << 26)         /* b,bl,ba,bla */
+             || ((insn & (0x3fu << 26)) == (16u << 26)     /* bc,bcl,bca,bcla*/
                  && (insn & (0x14 << 21)) == (0x14 << 21)) /*   with BO=0x14 */
-             || ((insn & (0x3f << 26)) == (19u << 26)
+             || ((insn & (0x3fu << 26)) == (19u << 26)
                  && (insn & (0x3ff << 1)) == (16u << 1)    /* bclr,bclrl */
                  && (insn & (0x14 << 21)) == (0x14 << 21)))/*   with BO=0x14 */
            continue;
@@ -9305,7 +9275,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
          else
            rel = NULL;
 
-         if ((insn & (0x3f << 26)) == (16u << 26) /* bc */
+         if ((insn & (0x3fu << 26)) == (16u << 26) /* bc */
              && (insn & 2) == 0 /* relative */)
            {
              bfd_vma delta = ((insn & 0xfffc) ^ 0x8000) - 0x8000;
@@ -9384,18 +9354,20 @@ ppc_elf_relocate_section (bfd *output_bfd,
 \f
 /* Write out the PLT relocs and entries for H.  */
 
-static bfd_boolean
+static bool
 write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
   struct plt_entry *ent;
-  bfd_boolean doneone;
+  bool doneone;
 
-  doneone = FALSE;
+  doneone = false;
   for (ent = h->plt.plist; ent != NULL; ent = ent->next)
     if (ent->plt.offset != (bfd_vma) -1)
       {
+       bool dyn = !use_local_plt (info, h);
+
        if (!doneone)
          {
            Elf_Internal_Rela rela;
@@ -9404,9 +9376,7 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
            asection *plt = htab->elf.splt;
            asection *relplt = htab->elf.srelplt;
 
-           if (htab->plt_type == PLT_NEW
-               || !htab->elf.dynamic_sections_created
-               || h->dynindx == -1)
+           if (htab->plt_type == PLT_NEW || !dyn)
              reloc_index = ent->plt.offset / 4;
            else
              {
@@ -9419,9 +9389,7 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
 
            /* This symbol has an entry in the procedure linkage table.
               Set it up.  */
-           if (htab->plt_type == PLT_VXWORKS
-               && htab->elf.dynamic_sections_created
-               && h->dynindx != -1)
+           if (htab->plt_type == PLT_VXWORKS && dyn)
              {
                bfd_vma got_offset;
                const bfd_vma *plt_entry;
@@ -9544,8 +9512,7 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
            else
              {
                rela.r_addend = 0;
-               if (!htab->elf.dynamic_sections_created
-                   || h->dynindx == -1)
+               if (!dyn)
                  {
                    if (h->type == STT_GNU_IFUNC)
                      {
@@ -9574,9 +9541,7 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
                                     + plt->output_offset
                                     + ent->plt.offset);
 
-                   if (htab->plt_type == PLT_OLD
-                       || !htab->elf.dynamic_sections_created
-                       || h->dynindx == -1)
+                   if (htab->plt_type == PLT_OLD || !dyn)
                      {
                        /* We don't need to fill in the .plt.  The ppc dynamic
                           linker will fill it in.  */
@@ -9595,8 +9560,7 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
            if (relplt != NULL)
              {
                /* Fill in the entry in the .rela.plt section.  */
-               if (!htab->elf.dynamic_sections_created
-                   || h->dynindx == -1)
+               if (!dyn)
                  {
                    if (h->type == STT_GNU_IFUNC)
                      rela.r_info = ELF32_R_INFO (0, R_PPC_IRELATIVE);
@@ -9616,18 +9580,15 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
                  }
                bfd_elf32_swap_reloca_out (info->output_bfd, &rela, loc);
              }
-           doneone = TRUE;
+           doneone = true;
          }
 
-       if (htab->plt_type == PLT_NEW
-           || !htab->elf.dynamic_sections_created
-           || h->dynindx == -1)
+       if (htab->plt_type == PLT_NEW || !dyn)
          {
            unsigned char *p;
            asection *plt = htab->elf.splt;
 
-           if (!htab->elf.dynamic_sections_created
-               || h->dynindx == -1)
+           if (!dyn)
              {
                if (h->type == STT_GNU_IFUNC)
                  plt = htab->elf.iplt;
@@ -9645,19 +9606,19 @@ write_global_sym_plt (struct elf_link_hash_entry *h, void *inf)
        else
          break;
       }
-  return TRUE;
+  return true;
 }
 
 /* Finish up PLT handling.  */
 
-bfd_boolean
+bool
 ppc_finish_symbols (struct bfd_link_info *info)
 {
   struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
   bfd *ibfd;
 
   if (!htab)
-    return TRUE;
+    return true;
 
   elf_link_hash_traverse (&htab->elf, write_global_sym_plt, info);
 
@@ -9698,10 +9659,9 @@ ppc_finish_symbols (struct bfd_link_info *info)
                if (!get_sym_h (NULL, &sym, &sym_sec, NULL, &local_syms,
                                lplt - local_plt, ibfd))
                  {
-                   if (local_syms != NULL
-                       && symtab_hdr->contents != (unsigned char *) local_syms)
+                   if (symtab_hdr->contents != (unsigned char *) local_syms)
                      free (local_syms);
-                   return FALSE;
+                   return false;
                  }
 
                val = sym->st_value;
@@ -9753,13 +9713,13 @@ ppc_finish_symbols (struct bfd_link_info *info)
            symtab_hdr->contents = (unsigned char *) local_syms;
        }
     }
-  return TRUE;
+  return true;
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
    dynamic sections here.  */
 
-static bfd_boolean
+static bool
 ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
                               struct bfd_link_info *info,
                               struct elf_link_hash_entry *h,
@@ -9850,7 +9810,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
   fprintf (stderr, "\n");
 #endif
 
-  return TRUE;
+  return true;
 }
 \f
 static enum elf_reloc_type_class
@@ -9878,7 +9838,7 @@ ppc_elf_reloc_type_class (const struct bfd_link_info *info,
 \f
 /* Finish up the dynamic sections.  */
 
-static bfd_boolean
+static bool
 ppc_elf_finish_dynamic_sections (bfd *output_bfd,
                                 struct bfd_link_info *info)
 {
@@ -9886,7 +9846,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
   struct ppc_elf_link_hash_table *htab;
   bfd_vma got;
   bfd *dynobj;
-  bfd_boolean ret = TRUE;
+  bool ret = true;
 
 #ifdef DEBUG
   fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
@@ -9918,7 +9878,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
          switch (dyn.d_tag)
            {
            case DT_PLTGOT:
-             if (htab->is_vxworks)
+             if (htab->elf.target_os == is_vxworks)
                s = htab->elf.sgotplt;
              else
                s = htab->elf.splt;
@@ -9950,7 +9910,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
              continue;
 
            default:
-             if (htab->is_vxworks
+             if (htab->elf.target_os == is_vxworks
                  && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
                break;
              continue;
@@ -9995,14 +9955,14 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
                              (htab->elf.sgotplt != NULL
                               ? htab->elf.sgotplt : htab->elf.sgot));
          bfd_set_error (bfd_error_bad_value);
-         ret = FALSE;
+         ret = false;
        }
 
       elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
     }
 
   /* Fill in the first entry in the VxWorks procedure linkage table.  */
-  if (htab->is_vxworks
+  if (htab->elf.target_os == is_vxworks
       && htab->elf.splt != NULL
       && htab->elf.splt->size != 0
       && htab->elf.splt->output_section != bfd_abs_section_ptr)
@@ -10307,7 +10267,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
          && !_bfd_elf_write_section_eh_frame (output_bfd, info,
                                               htab->glink_eh_frame,
                                               htab->glink_eh_frame->contents))
-       return FALSE;
+       return false;
     }
 
   return ret;
@@ -10411,6 +10371,9 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
 
 #undef  ELF_OSABI
 
+#undef ELF_TARGET_OS
+#define ELF_TARGET_OS          is_vxworks
+
 /* VxWorks uses the elf default section flags for .plt.  */
 static const struct bfd_elf_special_section *
 ppc_elf_vxworks_get_sec_type_attr (bfd *abfd, asection *sec)
@@ -10436,7 +10399,6 @@ ppc_elf_vxworks_link_hash_table_create (bfd *abfd)
     {
       struct ppc_elf_link_hash_table *htab
        = (struct ppc_elf_link_hash_table *)ret;
-      htab->is_vxworks = 1;
       htab->plt_type = PLT_VXWORKS;
       htab->plt_entry_size = VXWORKS_PLT_ENTRY_SIZE;
       htab->plt_slot_size = VXWORKS_PLT_ENTRY_SIZE;
@@ -10446,7 +10408,7 @@ ppc_elf_vxworks_link_hash_table_create (bfd *abfd)
 }
 
 /* Tweak magic VxWorks symbols as they are loaded.  */
-static bfd_boolean
+static bool
 ppc_elf_vxworks_add_symbol_hook (bfd *abfd,
                                 struct bfd_link_info *info,
                                 Elf_Internal_Sym *sym,
@@ -10457,12 +10419,12 @@ ppc_elf_vxworks_add_symbol_hook (bfd *abfd,
 {
   if (!elf_vxworks_add_symbol_hook (abfd, info, sym, namep, flagsp, secp,
                                    valp))
-    return FALSE;
+    return false;
 
   return ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp);
 }
 
-static bfd_boolean
+static bool
 ppc_elf_vxworks_final_write_processing (bfd *abfd)
 {
   ppc_final_write_processing (abfd);
@@ -10509,6 +10471,5 @@ ppc_elf_vxworks_final_write_processing (bfd *abfd)
 
 #undef elf32_bed
 #define elf32_bed                              ppc_elf_vxworks_bed
-#undef elf_backend_post_process_headers
 
 #include "elf32-target.h"
This page took 0.126129 seconds and 4 git commands to generate.