Blame SOURCES/gdb-rhbz1320945-power9-02of38.patch

a094f6
commit 45965137bee4946dca3cd99285f2a7afe6b99aeb
a094f6
Author: Alan Modra <amodra@gmail.com>
a094f6
Date:   Wed Mar 5 19:57:39 2014 +1030
a094f6
a094f6
    Support R_PPC64_ADDR64_LOCAL
a094f6
    
a094f6
    This adds support for "func@localentry", an expression that returns the
a094f6
    ELFv2 local entry point address of function "func".  I've excluded
a094f6
    dynamic relocation support because that obviously would require glibc
a094f6
    changes.
a094f6
    
a094f6
    include/elf/
a094f6
            * ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
a094f6
    bfd/
a094f6
            * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
a094f6
            (ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
a094f6
            (ppc64_elf_check_relocs): Likewise.
a094f6
            (ppc64_elf_relocate_section): Likewise.
a094f6
            * Add BFD_RELOC_PPC64_ADDR64_LOCAL.
a094f6
            * bfd-in2.h: Regenerate.
a094f6
            * libbfd.h: Regenerate.
a094f6
    gas/
a094f6
            * config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
a094f6
            (md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
a094f6
    ld/testsuite/
a094f6
            * ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
a094f6
            * ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
a094f6
            * ld-powerpc/powerpc.exp: Run new test.
a094f6
    elfcpp/
a094f6
            * powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
a094f6
    gold/
a094f6
            * powerpc.cc (Target_powerpc::Scan::local, global): Support
a094f6
            R_PPC64_ADDR64_LOCAL.
a094f6
            (Target_powerpc::Relocate::relocate): Likewise.
a094f6
a094f6
### a/bfd/ChangeLog
a094f6
### b/bfd/ChangeLog
a094f6
## -1,3 +1,13 @@
a094f6
+2014-03-05  Alan Modra  <amodra@gmail.com>
a094f6
+
a094f6
+	* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
a094f6
+	(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
a094f6
+	(ppc64_elf_check_relocs): Likewise.
a094f6
+	(ppc64_elf_relocate_section): Likewise.
a094f6
+	* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
a094f6
+	* bfd-in2.h: Regenerate.
a094f6
+	* libbfd.h: Regenerate.
a094f6
+
a094f6
 2014-03-04  Heiher  <r@hev.cc>
a094f6
 
a094f6
 	* elfxx-mips.c (mips_set_isa_flags): Use E_MIPS_ARCH_64R2 for
a094f6
--- a/bfd/bfd-in2.h
a094f6
+++ b/bfd/bfd-in2.h
a094f6
@@ -3259,6 +3259,7 @@ instruction.  */
a094f6
   BFD_RELOC_PPC64_PLTGOT16_LO_DS,
a094f6
   BFD_RELOC_PPC64_ADDR16_HIGH,
a094f6
   BFD_RELOC_PPC64_ADDR16_HIGHA,
a094f6
+  BFD_RELOC_PPC64_ADDR64_LOCAL,
a094f6
 
a094f6
 /* PowerPC and PowerPC64 thread-local storage relocations.  */
a094f6
   BFD_RELOC_PPC_TLS,
a094f6
--- a/bfd/elf64-ppc.c
a094f6
+++ b/bfd/elf64-ppc.c
a094f6
@@ -2095,6 +2095,21 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
a094f6
 	 0xffff,		/* dst_mask */
a094f6
 	 FALSE),		/* pcrel_offset */
a094f6
 
a094f6
+  /* Like ADDR64, but use local entry point of function.  */
a094f6
+  HOWTO (R_PPC64_ADDR64_LOCAL,	/* type */
a094f6
+	 0,			/* rightshift */
a094f6
+	 4,			/* size (0=byte, 1=short, 2=long, 4=64 bits) */
a094f6
+	 64,			/* bitsize */
a094f6
+	 FALSE,			/* pc_relative */
a094f6
+	 0,			/* bitpos */
a094f6
+	 complain_overflow_dont, /* complain_on_overflow */
a094f6
+	 bfd_elf_generic_reloc,	/* special_function */
a094f6
+	 "R_PPC64_ADDR64_LOCAL", /* name */
a094f6
+	 FALSE,			/* partial_inplace */
a094f6
+	 0,			/* src_mask */
a094f6
+	 ONES (64),		/* dst_mask */
a094f6
+	 FALSE),		/* pcrel_offset */
a094f6
+
a094f6
   /* GNU extension to record C++ vtable hierarchy.  */
a094f6
   HOWTO (R_PPC64_GNU_VTINHERIT,	/* type */
a094f6
 	 0,			/* rightshift */
a094f6
@@ -2383,6 +2398,8 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
a094f6
       break;
a094f6
     case BFD_RELOC_HI16_S_PCREL:		r = R_PPC64_REL16_HA;
a094f6
       break;
a094f6
+    case BFD_RELOC_PPC64_ADDR64_LOCAL:		r = R_PPC64_ADDR64_LOCAL;
a094f6
+      break;
a094f6
     case BFD_RELOC_VTABLE_INHERIT:		r = R_PPC64_GNU_VTINHERIT;
a094f6
       break;
a094f6
     case BFD_RELOC_VTABLE_ENTRY:		r = R_PPC64_GNU_VTENTRY;
a094f6
@@ -5400,6 +5417,21 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
a094f6
 	case R_PPC64_REL16_HA:
a094f6
 	  break;
a094f6
 
a094f6
+	  /* Not supported as a dynamic relocation.  */
a094f6
+	case R_PPC64_ADDR64_LOCAL:
a094f6
+	  if (info->shared)
a094f6
+	    {
a094f6
+	      if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
a094f6
+		ppc_howto_init ();
a094f6
+	      info->callbacks->einfo (_("%P: %H: %s reloc unsupported "
a094f6
+					"in shared libraries and PIEs.\n"),
a094f6
+				      abfd, sec, rel->r_offset,
a094f6
+				      ppc64_elf_howto_table[r_type]->name);
a094f6
+	      bfd_set_error (bfd_error_bad_value);
a094f6
+	      return FALSE;
a094f6
+	    }
a094f6
+	  break;
a094f6
+
a094f6
 	case R_PPC64_TOC16:
a094f6
 	case R_PPC64_TOC16_DS:
a094f6
 	  htab->do_multi_toc = 1;
a094f6
@@ -14134,6 +14166,12 @@ ppc64_elf_relocate_section (bfd *output_bfd,
a094f6
 	  addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
a094f6
 	  break;
a094f6
 
a094f6
+	case R_PPC64_ADDR64_LOCAL:
a094f6
+	  addend += PPC64_LOCAL_ENTRY_OFFSET (h != NULL
a094f6
+					      ? h->elf.other
a094f6
+					      : sym->st_other);
a094f6
+	  break;
a094f6
+
a094f6
 	case R_PPC64_DTPMOD64:
a094f6
 	  relocation = 1;
a094f6
 	  addend = 0;
a094f6
--- a/bfd/libbfd.h
a094f6
+++ b/bfd/libbfd.h
a094f6
@@ -1401,6 +1401,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
a094f6
   "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
a094f6
   "BFD_RELOC_PPC64_ADDR16_HIGH",
a094f6
   "BFD_RELOC_PPC64_ADDR16_HIGHA",
a094f6
+  "BFD_RELOC_PPC64_ADDR64_LOCAL",
a094f6
   "BFD_RELOC_PPC_TLS",
a094f6
   "BFD_RELOC_PPC_TLSGD",
a094f6
   "BFD_RELOC_PPC_TLSLD",
a094f6
--- a/bfd/reloc.c
a094f6
+++ b/bfd/reloc.c
a094f6
@@ -2899,6 +2899,8 @@ ENUMX
a094f6
   BFD_RELOC_PPC64_ADDR16_HIGH
a094f6
 ENUMX
a094f6
   BFD_RELOC_PPC64_ADDR16_HIGHA
a094f6
+ENUMX
a094f6
+  BFD_RELOC_PPC64_ADDR64_LOCAL
a094f6
 ENUMDOC
a094f6
   Power(rs6000) and PowerPC relocations.
a094f6
 
a094f6
### a/include/elf/ChangeLog
a094f6
### b/include/elf/ChangeLog
a094f6
## -1,3 +1,7 @@
a094f6
+2014-03-05  Alan Modra  <amodra@gmail.com>
a094f6
+
a094f6
+	* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
a094f6
+
a094f6
 2014-02-06  Andrew Pinski  <apinski@cavium.com>
a094f6
 
a094f6
 	* mips.h (E_MIPS_MACH_OCTEON3): New machine flag.
a094f6
--- a/include/elf/ppc64.h
a094f6
+++ b/include/elf/ppc64.h
a094f6
@@ -149,6 +149,10 @@ START_RELOC_NUMBERS (elf_ppc64_reloc_type)
a094f6
   RELOC_NUMBER (R_PPC64_DTPREL16_HIGH,	   114)
a094f6
   RELOC_NUMBER (R_PPC64_DTPREL16_HIGHA,	   115)
a094f6
 
a094f6
+/* Added for ELFv2.  */
a094f6
+  RELOC_NUMBER (R_PPC64_REL24_NOTOC,	   116)
a094f6
+  RELOC_NUMBER (R_PPC64_ADDR64_LOCAL,	   117)
a094f6
+
a094f6
 #ifndef RELOC_MACROS_GEN_FUNC
a094f6
 /* Fake relocation only used internally by ld.  */
a094f6
   RELOC_NUMBER (R_PPC64_LO_DS_OPT,	   128)