Blame SOURCES/gdb-rhbz1125820-ppc64le-enablement-12of37.patch

01917d
commit e8910a83af41c3dbfd00191b2720d4094f8d9532
01917d
Author: Alan Modra <amodra@gmail.com>
01917d
Date:   Tue Oct 29 16:34:35 2013 +1030
01917d
01917d
    Replace DT_PPC_TLSOPT with DT_PPC_OPT.
01917d
    
01917d
    This removes the DT_PPC_TLSOPT/DT_PPC64_TLSOPT dynamic tag and replaces
01917d
    it with DT_PPC_OPT/DT_PPC64_OPT tag to provide the same functionality
01917d
    and more.  This isn't backwards compatible, but the TLSOPT tag hasn't
01917d
    been used since the tls optimisation support was never submitted to
01917d
    glibc.
01917d
    
01917d
    /include/elf/
01917d
    	* ppc.h (DT_PPC_TLSOPT): Delete.
01917d
    	(DT_PPC_OPT, PPC_OPT_TLS): Define.
01917d
    	* ppc64.h (DT_PPC64_TLSOPT): Delete.
01917d
    	(DT_PPC64_OPT, PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC): Define.
01917d
    bfd/
01917d
    	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Use new DT_PPC_OPT
01917d
    	tag to specify tls optimisation.
01917d
    	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
01917d
    	(ppc64_elf_finish_dynamic_sections): Specify whether multiple
01917d
    	toc pointers are used via DT_PPC64_OPT.
01917d
    binutils/
01917d
    	* readelf.c (get_ppc_dynamic_type): Replace PPC_TLSOPT with PPC_OPT.
01917d
    	(get_ppc64_dynamic_type): Replace PPC64_TLSOPT with PPC64_OPT.
01917d
01917d
Index: gdb-7.6.1/bfd/elf32-ppc.c
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/bfd/elf32-ppc.c
01917d
+++ gdb-7.6.1/bfd/elf32-ppc.c
01917d
@@ -6443,7 +6443,7 @@ ppc_elf_size_dynamic_sections (bfd *outp
01917d
 	  if (!htab->no_tls_get_addr_opt
01917d
 	      && htab->tls_get_addr != NULL
01917d
 	      && htab->tls_get_addr->plt.plist != NULL
01917d
-	      && !add_dynamic_entry (DT_PPC_TLSOPT, 0))
01917d
+	      && !add_dynamic_entry (DT_PPC_OPT, PPC_OPT_TLS))
01917d
 	    return FALSE;
01917d
 	}
01917d
 
01917d
Index: gdb-7.6.1/bfd/elf64-ppc.c
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/bfd/elf64-ppc.c
01917d
+++ gdb-7.6.1/bfd/elf64-ppc.c
01917d
@@ -9580,6 +9580,8 @@ ppc64_elf_size_dynamic_sections (bfd *ou
01917d
 
01917d
   if (htab->elf.dynamic_sections_created)
01917d
     {
01917d
+      bfd_boolean tls_opt;
01917d
+
01917d
       /* Add some entries to the .dynamic section.  We fill in the
01917d
 	 values later, in ppc64_elf_finish_dynamic_sections, but we
01917d
 	 must add the entries now so that we get the correct size for
01917d
@@ -9611,11 +9613,14 @@ ppc64_elf_size_dynamic_sections (bfd *ou
01917d
 	    return FALSE;
01917d
 	}
01917d
 
01917d
-      if (!htab->no_tls_get_addr_opt
01917d
-	  && htab->tls_get_addr_fd != NULL
01917d
-	  && htab->tls_get_addr_fd->elf.plt.plist != NULL
01917d
-	  && !add_dynamic_entry (DT_PPC64_TLSOPT, 0))
01917d
-	return FALSE;
01917d
+      tls_opt = (!htab->no_tls_get_addr_opt
01917d
+		 && htab->tls_get_addr_fd != NULL
01917d
+		 && htab->tls_get_addr_fd->elf.plt.plist != NULL);
01917d
+      if (tls_opt || !htab->opd_abi)
01917d
+	{
01917d
+	  if (!add_dynamic_entry (DT_PPC64_OPT, tls_opt ? PPC64_OPT_TLS : 0))
01917d
+	    return FALSE;
01917d
+	}
01917d
 
01917d
       if (relocs)
01917d
 	{
01917d
@@ -14394,6 +14399,11 @@ ppc64_elf_finish_dynamic_sections (bfd *
01917d
 	      dyn.d_un.d_ptr = s->vma;
01917d
 	      break;
01917d
 
01917d
+	    case DT_PPC64_OPT:
01917d
+	      if (htab->do_multi_toc && htab->multi_toc_needed)
01917d
+		dyn.d_un.d_val |= PPC64_OPT_MULTI_TOC;
01917d
+	      break;
01917d
+
01917d
 	    case DT_PPC64_OPDSZ:
01917d
 	      s = bfd_get_section_by_name (output_bfd, ".opd");
01917d
 	      if (s == NULL)
01917d
Index: gdb-7.6.1/include/elf/ppc.h
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/include/elf/ppc.h
01917d
+++ gdb-7.6.1/include/elf/ppc.h
01917d
@@ -176,7 +176,8 @@ END_RELOC_NUMBERS (R_PPC_max)
01917d
 #define DT_PPC_GOT		(DT_LOPROC)
01917d
 
01917d
 /* Specify that tls descriptors should be optimized.  */
01917d
-#define DT_PPC_TLSOPT		(DT_LOPROC + 1)
01917d
+#define DT_PPC_OPT		(DT_LOPROC + 1)
01917d
+#define PPC_OPT_TLS		1
01917d
 
01917d
 /* Processor specific flags for the ELF header e_flags field.  */
01917d
 
01917d
Index: gdb-7.6.1/include/elf/ppc64.h
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/include/elf/ppc64.h
01917d
+++ gdb-7.6.1/include/elf/ppc64.h
01917d
@@ -225,7 +225,9 @@ ppc64_encode_local_entry(unsigned int va
01917d
 #define DT_PPC64_OPD		(DT_LOPROC + 1)
01917d
 #define DT_PPC64_OPDSZ		(DT_LOPROC + 2)
01917d
 
01917d
-/* Specify that tls descriptors should be optimized.  */
01917d
-#define DT_PPC64_TLSOPT		(DT_LOPROC + 3)
01917d
+/* Specify whether various optimisations are possible.  */
01917d
+#define DT_PPC64_OPT		(DT_LOPROC + 3)
01917d
+#define PPC64_OPT_TLS		1
01917d
+#define PPC64_OPT_MULTI_TOC	2
01917d
 
01917d
 #endif /* _ELF_PPC64_H */