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

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