Blame SOURCES/gdb-rhbz1320945-power9pre-3of3.patch

01917d
commit f9c6b9078c54ea0f018b673e2ff128e61a0aa666
01917d
Author: Alan Modra <amodra@gmail.com>
01917d
Date:   Tue Oct 29 16:53:25 2013 +1030
01917d
01917d
    Report overflow on PowerPC64 @h and @ha relocations.
01917d
    
01917d
    This changes the behaviour of @h and @ha on PowerPC64 to report errors
01917d
    on 32-bit overflow.  The motivation for this change is that on
01917d
    PowerPC64, most uses of @h and @ha modifiers and their corresponding
01917d
    relocations are to build up 32-bit offsets.  We'd like to know when
01917d
    such offsets overflow.  Only rarely do people use @h or @ha with the
01917d
    high 32-bit modifiers to build a 64-bit constant.  Those uses will now
01917d
    need to use two new modifiers, @high and @higha, if the constant isn't
01917d
    known at assembly time.  For now, we won't report overflow at assembly
01917d
    time..
01917d
    
01917d
    This also fixes an error when applying some of the HIGHER and HIGHEST
01917d
    relocations.
01917d
    
01917d
    include/elf/
01917d
            * ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
01917d
            R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
01917d
            R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New.
01917d
            (IS_PPC64_TLS_RELOC): Match new tls relocs.
01917d
    bfd/
01917d
            * reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA,
01917d
            BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA,
01917d
            BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New.
01917d
            * elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs.
01917d
            Make all _HA and _HI relocs report signed overflow.
01917d
            (ppc64_elf_reloc_type_lookup): Handle new relocs.
01917d
            (must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise.
01917d
            (dec_dynrel_count, ppc64_elf_relocate_section): Likewise.
01917d
            (ppc64_elf_relocate_section): Don't apply 0x8000 adjust to
01917d
            R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST,
01917d
            R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST.
01917d
            * libbfd.h: Regenerate.
01917d
            * bfd-in2.h: Regenerate.
01917d
    gas/
01917d
            * config/tc-ppc.c (SEX16): Don't mask.
01917d
            (REPORT_OVERFLOW_HI): Define as zero.
01917d
            (ppc_elf_suffix): Support @high, @higha, @dtprel@high, @dtprel@higha,
01917d
            @tprel@high, and @tprel@higha modifiers.
01917d
            (md_assemble): Ignore X_unsigned when applying 16-bit insn fields.
01917d
            Add (disabled) code to check @h and @ha reloc overflow for powerpc64.
01917d
            Handle new relocs.
01917d
            (md_apply_fix): Similarly.
01917d
    elfcpp/
01917d
            * powerpc.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
01917d
            R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
01917d
            R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Define.
01917d
    gold/
01917d
            * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
01917d
            (Target_powerpc::Scan::global, local): Likewise.
01917d
            (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
01917d
            on all ppc64 @h and @ha relocs.
01917d
01917d
### a/bfd/ChangeLog
01917d
### b/bfd/ChangeLog
01917d
## -1,3 +1,19 @@
01917d
+2013-10-30  Alan Modra  <amodra@gmail.com>
01917d
+
01917d
+	* reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA,
01917d
+	BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA,
01917d
+	BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New.
01917d
+	* elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs.
01917d
+	Make all _HA and _HI relocs report signed overflow.
01917d
+	(ppc64_elf_reloc_type_lookup): Handle new relocs.
01917d
+	(must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise.
01917d
+	(dec_dynrel_count, ppc64_elf_relocate_section): Likewise.
01917d
+	(ppc64_elf_relocate_section): Don't apply 0x8000 adjust to
01917d
+	R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST,
01917d
+	R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST.
01917d
+	* libbfd.h: Regenerate.
01917d
+	* bfd-in2.h: Regenerate.
01917d
+
01917d
 2013-10-29  Roland McGrath  <mcgrathr@google.com>
01917d
 
01917d
 	* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop
01917d
--- a/bfd/bfd-in2.h
01917d
+++ b/bfd/bfd-in2.h
01917d
@@ -3223,6 +3223,8 @@ instruction.  */
01917d
   BFD_RELOC_PPC64_TOC16_LO_DS,
01917d
   BFD_RELOC_PPC64_PLTGOT16_DS,
01917d
   BFD_RELOC_PPC64_PLTGOT16_LO_DS,
01917d
+  BFD_RELOC_PPC64_ADDR16_HIGH,
01917d
+  BFD_RELOC_PPC64_ADDR16_HIGHA,
01917d
 
01917d
 /* PowerPC and PowerPC64 thread-local storage relocations.  */
01917d
   BFD_RELOC_PPC_TLS,
01917d
@@ -3267,6 +3269,10 @@ instruction.  */
01917d
   BFD_RELOC_PPC64_DTPREL16_HIGHERA,
01917d
   BFD_RELOC_PPC64_DTPREL16_HIGHEST,
01917d
   BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
01917d
+  BFD_RELOC_PPC64_TPREL16_HIGH,
01917d
+  BFD_RELOC_PPC64_TPREL16_HIGHA,
01917d
+  BFD_RELOC_PPC64_DTPREL16_HIGH,
01917d
+  BFD_RELOC_PPC64_DTPREL16_HIGHA,
01917d
 
01917d
 /* IBM 370/390 relocations  */
01917d
   BFD_RELOC_I370_D12,
01917d
--- a/bfd/elf64-ppc.c
01917d
+++ b/bfd/elf64-ppc.c
01917d
@@ -309,7 +309,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC64_ADDR16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -325,7 +325,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_ha_reloc,	/* special_function */
01917d
 	 "R_PPC64_ADDR16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -487,7 +487,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont,/* complain_on_overflow */
01917d
+	 complain_overflow_signed,/* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -503,7 +503,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont,/* complain_on_overflow */
01917d
+	 complain_overflow_signed,/* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -680,7 +680,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_PLT16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -696,7 +696,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_PLT16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -741,7 +741,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_sectoff_reloc, /* special_function */
01917d
 	 "R_PPC64_SECTOFF_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -756,7 +756,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_sectoff_ha_reloc, /* special_function */
01917d
 	 "R_PPC64_SECTOFF_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -963,7 +963,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_toc_reloc,	/* special_function */
01917d
 	 "R_PPC64_TOC16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -982,7 +982,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_toc_ha_reloc, /* special_function */
01917d
 	 "R_PPC64_TOC16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1054,7 +1054,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_PLTGOT16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1072,7 +1072,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont,/* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_PLTGOT16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1374,7 +1374,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_DTPREL16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1389,7 +1389,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_DTPREL16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1540,7 +1540,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_TPREL16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1555,7 +1555,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_TPREL16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1692,7 +1692,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TLSGD16_HI", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1707,7 +1707,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TLSGD16_HA", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1754,7 +1754,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TLSLD16_HI", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1769,7 +1769,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TLSLD16_HA", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1815,7 +1815,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_DTPREL16_HI", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1830,7 +1830,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_DTPREL16_HA", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1876,7 +1876,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TPREL16_HI", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1891,7 +1891,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
 	 "R_PPC64_GOT_TPREL16_HA", /* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1964,7 +1964,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 TRUE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC64_REL16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1980,7 +1980,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 TRUE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 ppc64_elf_ha_reloc,	/* special_function */
01917d
 	 "R_PPC64_REL16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1988,6 +1988,96 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
 	 0xffff,		/* dst_mask */
01917d
 	 TRUE),			/* pcrel_offset */
01917d
 
01917d
+  /* Like R_PPC64_ADDR16_HI, but no overflow.  */
01917d
+  HOWTO (R_PPC64_ADDR16_HIGH,	/* type */
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 bfd_elf_generic_reloc,	/* special_function */
01917d
+	 "R_PPC64_ADDR16_HIGH",	/* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
+  /* Like R_PPC64_ADDR16_HA, but no overflow.  */
01917d
+  HOWTO (R_PPC64_ADDR16_HIGHA,	/* type */
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 ppc64_elf_ha_reloc,	/* special_function */
01917d
+	 "R_PPC64_ADDR16_HIGHA",	/* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
+  /* Like R_PPC64_DTPREL16_HI, but no overflow.  */
01917d
+  HOWTO (R_PPC64_DTPREL16_HIGH,
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
+	 "R_PPC64_DTPREL16_HIGH", /* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
+  /* Like R_PPC64_DTPREL16_HA, but no overflow.  */
01917d
+  HOWTO (R_PPC64_DTPREL16_HIGHA,
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
+	 "R_PPC64_DTPREL16_HIGHA", /* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
+  /* Like R_PPC64_TPREL16_HI, but no overflow.  */
01917d
+  HOWTO (R_PPC64_TPREL16_HIGH,
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
+	 "R_PPC64_TPREL16_HIGH",	/* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
+  /* Like R_PPC64_TPREL16_HA, but no overflow.  */
01917d
+  HOWTO (R_PPC64_TPREL16_HIGHA,
01917d
+	 16,			/* rightshift */
01917d
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 16,			/* bitsize */
01917d
+	 FALSE,			/* pc_relative */
01917d
+	 0,			/* bitpos */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
+	 ppc64_elf_unhandled_reloc, /* special_function */
01917d
+	 "R_PPC64_TPREL16_HIGHA",	/* name */
01917d
+	 FALSE,			/* partial_inplace */
01917d
+	 0,			/* src_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
+	 FALSE),		/* pcrel_offset */
01917d
+
01917d
   /* GNU extension to record C++ vtable hierarchy.  */
01917d
   HOWTO (R_PPC64_GNU_VTINHERIT,	/* type */
01917d
 	 0,			/* rightshift */
01917d
@@ -2066,8 +2156,12 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
01917d
       break;
01917d
     case BFD_RELOC_HI16:			r = R_PPC64_ADDR16_HI;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_ADDR16_HIGH:		r = R_PPC64_ADDR16_HIGH;
01917d
+      break;
01917d
     case BFD_RELOC_HI16_S:			r = R_PPC64_ADDR16_HA;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_ADDR16_HIGHA:		r = R_PPC64_ADDR16_HIGHA;
01917d
+      break;
01917d
     case BFD_RELOC_PPC_BA16:			r = R_PPC64_ADDR14;
01917d
       break;
01917d
     case BFD_RELOC_PPC_BA16_BRTAKEN:		r = R_PPC64_ADDR14_BRTAKEN;
01917d
@@ -2186,8 +2280,12 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
01917d
       break;
01917d
     case BFD_RELOC_PPC_TPREL16_HI:		r = R_PPC64_TPREL16_HI;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_TPREL16_HIGH:		r = R_PPC64_TPREL16_HIGH;
01917d
+      break;
01917d
     case BFD_RELOC_PPC_TPREL16_HA:		r = R_PPC64_TPREL16_HA;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_TPREL16_HIGHA:		r = R_PPC64_TPREL16_HIGHA;
01917d
+      break;
01917d
     case BFD_RELOC_PPC_TPREL:			r = R_PPC64_TPREL64;
01917d
       break;
01917d
     case BFD_RELOC_PPC_DTPREL16:		r = R_PPC64_DTPREL16;
01917d
@@ -2196,8 +2294,12 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
01917d
       break;
01917d
     case BFD_RELOC_PPC_DTPREL16_HI:		r = R_PPC64_DTPREL16_HI;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_DTPREL16_HIGH:		r = R_PPC64_DTPREL16_HIGH;
01917d
+      break;
01917d
     case BFD_RELOC_PPC_DTPREL16_HA:		r = R_PPC64_DTPREL16_HA;
01917d
       break;
01917d
+    case BFD_RELOC_PPC64_DTPREL16_HIGHA:	r = R_PPC64_DTPREL16_HIGHA;
01917d
+      break;
01917d
     case BFD_RELOC_PPC_DTPREL:			r = R_PPC64_DTPREL64;
01917d
       break;
01917d
     case BFD_RELOC_PPC_GOT_TLSGD16:		r = R_PPC64_GOT_TLSGD16;
01917d
@@ -3514,6 +3616,8 @@ must_be_dyn_reloc (struct bfd_link_info *info,
01917d
     case R_PPC64_TPREL16_HA:
01917d
     case R_PPC64_TPREL16_DS:
01917d
     case R_PPC64_TPREL16_LO_DS:
01917d
+    case R_PPC64_TPREL16_HIGH:
01917d
+    case R_PPC64_TPREL16_HIGHA:
01917d
     case R_PPC64_TPREL16_HIGHER:
01917d
     case R_PPC64_TPREL16_HIGHERA:
01917d
     case R_PPC64_TPREL16_HIGHEST:
01917d
@@ -5208,6 +5312,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
01917d
 	case R_PPC64_DTPREL16_HA:
01917d
 	case R_PPC64_DTPREL16_DS:
01917d
 	case R_PPC64_DTPREL16_LO_DS:
01917d
+	case R_PPC64_DTPREL16_HIGH:
01917d
+	case R_PPC64_DTPREL16_HIGHA:
01917d
 	case R_PPC64_DTPREL16_HIGHER:
01917d
 	case R_PPC64_DTPREL16_HIGHERA:
01917d
 	case R_PPC64_DTPREL16_HIGHEST:
01917d
@@ -5368,6 +5474,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
01917d
 	case R_PPC64_TPREL16_HA:
01917d
 	case R_PPC64_TPREL16_DS:
01917d
 	case R_PPC64_TPREL16_LO_DS:
01917d
+	case R_PPC64_TPREL16_HIGH:
01917d
+	case R_PPC64_TPREL16_HIGHA:
01917d
 	case R_PPC64_TPREL16_HIGHER:
01917d
 	case R_PPC64_TPREL16_HIGHERA:
01917d
 	case R_PPC64_TPREL16_HIGHEST:
01917d
@@ -5421,6 +5529,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
01917d
 	case R_PPC64_ADDR16_DS:
01917d
 	case R_PPC64_ADDR16_HA:
01917d
 	case R_PPC64_ADDR16_HI:
01917d
+	case R_PPC64_ADDR16_HIGH:
01917d
+	case R_PPC64_ADDR16_HIGHA:
01917d
 	case R_PPC64_ADDR16_HIGHER:
01917d
 	case R_PPC64_ADDR16_HIGHERA:
01917d
 	case R_PPC64_ADDR16_HIGHEST:
01917d
@@ -7052,6 +7162,8 @@ dec_dynrel_count (bfd_vma r_info,
01917d
     case R_PPC64_TPREL16_HA:
01917d
     case R_PPC64_TPREL16_DS:
01917d
     case R_PPC64_TPREL16_LO_DS:
01917d
+    case R_PPC64_TPREL16_HIGH:
01917d
+    case R_PPC64_TPREL16_HIGHA:
01917d
     case R_PPC64_TPREL16_HIGHER:
01917d
     case R_PPC64_TPREL16_HIGHERA:
01917d
     case R_PPC64_TPREL16_HIGHEST:
01917d
@@ -7073,6 +7185,8 @@ dec_dynrel_count (bfd_vma r_info,
01917d
     case R_PPC64_ADDR16_DS:
01917d
     case R_PPC64_ADDR16_HA:
01917d
     case R_PPC64_ADDR16_HI:
01917d
+    case R_PPC64_ADDR16_HIGH:
01917d
+    case R_PPC64_ADDR16_HIGHA:
01917d
     case R_PPC64_ADDR16_HIGHER:
01917d
     case R_PPC64_ADDR16_HIGHERA:
01917d
     case R_PPC64_ADDR16_HIGHEST:
01917d
@@ -13531,6 +13645,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
01917d
 	case R_PPC64_TPREL16_HA:
01917d
 	case R_PPC64_TPREL16_DS:
01917d
 	case R_PPC64_TPREL16_LO_DS:
01917d
+	case R_PPC64_TPREL16_HIGH:
01917d
+	case R_PPC64_TPREL16_HIGHA:
01917d
 	case R_PPC64_TPREL16_HIGHER:
01917d
 	case R_PPC64_TPREL16_HIGHERA:
01917d
 	case R_PPC64_TPREL16_HIGHEST:
01917d
@@ -13565,6 +13681,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
01917d
 	case R_PPC64_DTPREL16_HA:
01917d
 	case R_PPC64_DTPREL16_DS:
01917d
 	case R_PPC64_DTPREL16_LO_DS:
01917d
+	case R_PPC64_DTPREL16_HIGH:
01917d
+	case R_PPC64_DTPREL16_HIGHA:
01917d
 	case R_PPC64_DTPREL16_HIGHER:
01917d
 	case R_PPC64_DTPREL16_HIGHERA:
01917d
 	case R_PPC64_DTPREL16_HIGHEST:
01917d
@@ -13597,6 +13715,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
01917d
 	case R_PPC64_ADDR16_DS:
01917d
 	case R_PPC64_ADDR16_HA:
01917d
 	case R_PPC64_ADDR16_HI:
01917d
+	case R_PPC64_ADDR16_HIGH:
01917d
+	case R_PPC64_ADDR16_HIGHA:
01917d
 	case R_PPC64_ADDR16_HIGHER:
01917d
 	case R_PPC64_ADDR16_HIGHERA:
01917d
 	case R_PPC64_ADDR16_HIGHEST:
01917d
@@ -13911,21 +14031,20 @@ ppc64_elf_relocate_section (bfd *output_bfd,
01917d
 	default:
01917d
 	  break;
01917d
 
01917d
-	case R_PPC64_ADDR16_HA:
01917d
 	case R_PPC64_REL16_HA:
01917d
+	case R_PPC64_ADDR16_HA:
01917d
+	case R_PPC64_ADDR16_HIGHA:
01917d
 	case R_PPC64_ADDR16_HIGHERA:
01917d
 	case R_PPC64_ADDR16_HIGHESTA:
01917d
 	case R_PPC64_TOC16_HA:
01917d
 	case R_PPC64_SECTOFF_HA:
01917d
 	case R_PPC64_TPREL16_HA:
01917d
-	case R_PPC64_DTPREL16_HA:
01917d
-	case R_PPC64_TPREL16_HIGHER:
01917d
+	case R_PPC64_TPREL16_HIGHA:
01917d
 	case R_PPC64_TPREL16_HIGHERA:
01917d
-	case R_PPC64_TPREL16_HIGHEST:
01917d
 	case R_PPC64_TPREL16_HIGHESTA:
01917d
-	case R_PPC64_DTPREL16_HIGHER:
01917d
+	case R_PPC64_DTPREL16_HA:
01917d
+	case R_PPC64_DTPREL16_HIGHA:
01917d
 	case R_PPC64_DTPREL16_HIGHERA:
01917d
-	case R_PPC64_DTPREL16_HIGHEST:
01917d
 	case R_PPC64_DTPREL16_HIGHESTA:
01917d
 	  /* It's just possible that this symbol is a weak symbol
01917d
 	     that's not actually defined anywhere. In that case,
01917d
--- a/bfd/libbfd.h
01917d
+++ b/bfd/libbfd.h
01917d
@@ -1397,6 +1397,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
01917d
   "BFD_RELOC_PPC64_TOC16_LO_DS",
01917d
   "BFD_RELOC_PPC64_PLTGOT16_DS",
01917d
   "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
01917d
+  "BFD_RELOC_PPC64_ADDR16_HIGH",
01917d
+  "BFD_RELOC_PPC64_ADDR16_HIGHA",
01917d
   "BFD_RELOC_PPC_TLS",
01917d
   "BFD_RELOC_PPC_TLSGD",
01917d
   "BFD_RELOC_PPC_TLSLD",
01917d
@@ -1439,6 +1441,10 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
01917d
   "BFD_RELOC_PPC64_DTPREL16_HIGHERA",
01917d
   "BFD_RELOC_PPC64_DTPREL16_HIGHEST",
01917d
   "BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
01917d
+  "BFD_RELOC_PPC64_TPREL16_HIGH",
01917d
+  "BFD_RELOC_PPC64_TPREL16_HIGHA",
01917d
+  "BFD_RELOC_PPC64_DTPREL16_HIGH",
01917d
+  "BFD_RELOC_PPC64_DTPREL16_HIGHA",
01917d
   "BFD_RELOC_I370_D12",
01917d
   "BFD_RELOC_CTOR",
01917d
   "BFD_RELOC_ARM_PCREL_BRANCH",
01917d
--- a/bfd/reloc.c
01917d
+++ b/bfd/reloc.c
01917d
@@ -2891,6 +2891,10 @@ ENUMX
01917d
   BFD_RELOC_PPC64_PLTGOT16_DS
01917d
 ENUMX
01917d
   BFD_RELOC_PPC64_PLTGOT16_LO_DS
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_ADDR16_HIGH
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_ADDR16_HIGHA
01917d
 ENUMDOC
01917d
   Power(rs6000) and PowerPC relocations.
01917d
 
01917d
@@ -2978,6 +2982,14 @@ ENUMX
01917d
   BFD_RELOC_PPC64_DTPREL16_HIGHEST
01917d
 ENUMX
01917d
   BFD_RELOC_PPC64_DTPREL16_HIGHESTA
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_TPREL16_HIGH
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_TPREL16_HIGHA
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_DTPREL16_HIGH
01917d
+ENUMX
01917d
+  BFD_RELOC_PPC64_DTPREL16_HIGHA
01917d
 ENUMDOC
01917d
   PowerPC and PowerPC64 thread-local storage relocations.
01917d
 
01917d
### a/include/elf/ChangeLog
01917d
### b/include/elf/ChangeLog
01917d
## -1,3 +1,10 @@
01917d
+2013-10-30  Alan Modra  <amodra@gmail.com>
01917d
+
01917d
+	* ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
01917d
+	R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
01917d
+	R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New.
01917d
+	(IS_PPC64_TLS_RELOC): Match new tls relocs.
01917d
+
01917d
 2013-10-14  Chao-ying Fu  <Chao-ying.Fu@imgtec.com>
01917d
 
01917d
 	* mips.h (enum): Add Tag_GNU_MIPS_ABI_MSA.
01917d
--- a/include/elf/ppc64.h
01917d
+++ b/include/elf/ppc64.h
01917d
@@ -141,6 +141,14 @@ START_RELOC_NUMBERS (elf_ppc64_reloc_type)
01917d
   RELOC_NUMBER (R_PPC64_TLSLD,		   108)
01917d
   RELOC_NUMBER (R_PPC64_TOCSAVE,	   109)
01917d
 
01917d
+/* Added when HA and HI relocs were changed to report overflows.  */
01917d
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGH,	   110)
01917d
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGHA,	   111)
01917d
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGH,	   112)
01917d
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGHA,	   113)
01917d
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGH,	   114)
01917d
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGHA,	   115)
01917d
+
01917d
 #ifndef RELOC_MACROS_GEN_FUNC
01917d
 /* Fake relocation only used internally by ld.  */
01917d
   RELOC_NUMBER (R_PPC64_LO_DS_OPT,	   128)
01917d
@@ -161,8 +169,9 @@ START_RELOC_NUMBERS (elf_ppc64_reloc_type)
01917d
 
01917d
 END_RELOC_NUMBERS (R_PPC64_max)
01917d
 
01917d
-#define IS_PPC64_TLS_RELOC(R) \
01917d
-  ((R) >= R_PPC64_TLS && (R) <= R_PPC64_DTPREL16_HIGHESTA)
01917d
+#define IS_PPC64_TLS_RELOC(R)						\
01917d
+  (((R) >= R_PPC64_TLS && (R) <= R_PPC64_DTPREL16_HIGHESTA)		\
01917d
+   || ((R) >= R_PPC64_TPREL16_HIGH && (R) <= R_PPC64_DTPREL16_HIGHA))
01917d
 
01917d
 /* Specify the start of the .glink section.  */
01917d
 #define DT_PPC64_GLINK		DT_LOPROC