public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch] bfd elfxx-ia64: share code between elf32 and elf64
@ 2011-05-17 12:56 Tristan Gingold
  2011-05-17 13:04 ` H.J. Lu
  2011-05-17 13:08 ` [Patch] " Andreas Schwab
  0 siblings, 2 replies; 18+ messages in thread
From: Tristan Gingold @ 2011-05-17 12:56 UTC (permalink / raw)
  To: binutils Development

Hi,

some functions of elfxx-ia64.c are in fact the same when compiled for elf32 and for elf64.  This patch adds a new file,
elfxx-ia64.h which declares these functions and compiles them only for elf64.

No regression for linux/gnu ia64 and hpux ia64.

This work is in fact preliminary work to support gnu ld on vms/ia64.  Although VMS uses elf64, it doesn't use the same shared library
model.  Its DSO model is derived from the previous vms one (vector based). This made code reuse difficult.

Ok for trunk ?

Tristan.

bfd/
2011-05-17  Tristan Gingold  <gingold@adacore.com>

	* elfxx-ia64.h: New file.
	* elfxx-ia64.c: Includes elfxx-ia64.h.  Compile elfxx_* subprograms
	only in 64bit arch_size.
	(elfNN_ia64_reloc): Renames to elfxx_ia64_reloc.  Adjust error message.
	(IA64_HOWTO): Adjust.
	(lookup_howto): Renames to elfxx_ia64_lookup_howto.  Make it public.
	(elfNN_ia64_reloc_type_lookup): Renames to
	elfxx_ia64_reloc_type_lookup. Make it public. Adjust calls.
	(elfNN_ia64_reloc_name_lookup): Renames to
	elfxx_ia64_reloc_name_lookup. Make it public.
	(elfNN_ia64_info_to_howto): Make it public.  Adjust calls.
	(elfNN_ia64_relax_br): Renames to elfxx_ia64_relax_br.  Make it public.
	(elfNN_ia64_relax_brl): Renames to elfxx_ia64_relax_brl. Make it
	public.
	(elfNN_ia64_relax_ldxmov): Renames to elfxx_ia64_relax_ldxmov.
	Move it and make it public.  Move prototype to elfxx-ia64.h
	(elfNN_ia64_relax_section): Adjust calls.
	(count_dyn_reloc): Fix typo.
	(elfNN_ia64_install_value): Renames to elfxx_ia64_install_value.
	Move prototype to elfxx-ia64.h
	(elfNN_ia64_relocate_section): Adjust calls.
	(elfNN_ia64_finish_dynamic_symbol): Likewise.
	(bfd_elfNN_bfd_reloc_type_lookup)
	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.

diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index ca0a3bc..39b9957 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -29,6 +29,7 @@
 #include "objalloc.h"
 #include "hashtab.h"
 #include "bfd_stdint.h"
+#include "elfxx-ia64.h"
 
 #define ARCH_SIZE	NN
 
@@ -212,12 +213,8 @@ static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
    bfd *abfd, const Elf_Internal_Rela *rel, bfd_boolean create);
 static bfd_boolean elfNN_ia64_dynamic_symbol_p
   (struct elf_link_hash_entry *h, struct bfd_link_info *info, int);
-static bfd_reloc_status_type elfNN_ia64_install_value
-  (bfd_byte *hit_addr, bfd_vma val, unsigned int r_type);
 static bfd_boolean elfNN_ia64_choose_gp
   (bfd *abfd, struct bfd_link_info *info, bfd_boolean final);
-static void elfNN_ia64_relax_ldxmov
-  (bfd_byte *contents, bfd_vma off);
 static void elfNN_ia64_dyn_sym_traverse
   (struct elfNN_ia64_link_hash_table *ia64_info,
    bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
@@ -238,10 +235,12 @@ static asection *get_pltoff
 

 /* ia64-specific relocation.  */
 
+#if ARCH_SIZE == 64
+
 /* Perform a relocation.  Not much to do here as all the hard work is
    done in elfNN_ia64_final_link_relocate.  */
 static bfd_reloc_status_type
-elfNN_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
+elfxx_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
 		  asymbol *sym ATTRIBUTE_UNUSED,
 		  PTR data ATTRIBUTE_UNUSED, asection *input_section,
 		  bfd *output_bfd, char **error_message)
@@ -255,13 +254,13 @@ elfNN_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
   if (input_section->flags & SEC_DEBUGGING)
     return bfd_reloc_continue;
 
-  *error_message = "Unsupported call to elfNN_ia64_reloc";
+  *error_message = "Unsupported call to elfxx_ia64_reloc";
   return bfd_reloc_notsupported;
 }
 
 #define IA64_HOWTO(TYPE, NAME, SIZE, PCREL, IN)			\
   HOWTO (TYPE, 0, SIZE, 0, PCREL, 0, complain_overflow_signed,	\
-	 elfNN_ia64_reloc, NAME, FALSE, 0, -1, IN)
+	 elfxx_ia64_reloc, NAME, FALSE, 0, -1, IN)
 
 /* This table has to be sorted according to increasing number of the
    TYPE field.  */
@@ -369,8 +368,8 @@ static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1];
 
 /* Given a BFD reloc type, return the matching HOWTO structure.  */
 
-static reloc_howto_type *
-lookup_howto (unsigned int rtype)
+reloc_howto_type *
+elfxx_ia64_lookup_howto (unsigned int rtype)
 {
   static int inited = 0;
   int i;
@@ -392,8 +391,8 @@ lookup_howto (unsigned int rtype)
   return ia64_howto_table + i;
 }
 
-static reloc_howto_type*
-elfNN_ia64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+reloc_howto_type*
+elfxx_ia64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 			      bfd_reloc_code_real_type bfd_code)
 {
   unsigned int rtype;
@@ -498,11 +497,11 @@ elfNN_ia64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
     default: return 0;
     }
-  return lookup_howto (rtype);
+  return elfxx_ia64_lookup_howto (rtype);
 }
 
-static reloc_howto_type *
-elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+reloc_howto_type *
+elfxx_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 			      const char *r_name)
 {
   unsigned int i;
@@ -516,16 +515,17 @@ elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
   return NULL;
 }
+#endif /* ARCH_SIZE == 64 */
 
 /* Given a ELF reloc, return the matching HOWTO structure.  */
 
-static void
+void
 elfNN_ia64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
 			  arelent *bfd_reloc,
 			  Elf_Internal_Rela *elf_reloc)
 {
   bfd_reloc->howto
-    = lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
+    = elfxx_ia64_lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
 }
 

 #define PLT_HEADER_SIZE		(3 * 16)
@@ -593,6 +593,8 @@ bfd_elfNN_ia64_after_parse (int itanium)
   oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl);
 }
 
+#if ARCH_SIZE == 64
+
 #define BTYPE_SHIFT	6
 #define Y_SHIFT		26
 #define X6_SHIFT	27
@@ -628,8 +630,8 @@ bfd_elfNN_ia64_after_parse (int itanium)
 #define IS_BR_CALL(i) \
   (((i) & OPCODE_BITS) == (0x5LL << OPCODE_SHIFT))
 
-static bfd_boolean
-elfNN_ia64_relax_br (bfd_byte *contents, bfd_vma off)
+bfd_boolean
+elfxx_ia64_relax_br (bfd_byte *contents, bfd_vma off)
 {
   unsigned int template_val, mlx;
   bfd_vma t0, t1, s0, s1, s2, br_code;
@@ -731,8 +733,8 @@ elfNN_ia64_relax_br (bfd_byte *contents, bfd_vma off)
   return TRUE;
 }
 
-static void
-elfNN_ia64_relax_brl (bfd_byte *contents, bfd_vma off)
+void
+elfxx_ia64_relax_brl (bfd_byte *contents, bfd_vma off)
 {
   int template_val;
   bfd_byte *hit_addr;
@@ -763,12 +765,43 @@ elfNN_ia64_relax_brl (bfd_byte *contents, bfd_vma off)
   bfd_putl64 (t1, hit_addr + 8);
 }
 
+void
+elfxx_ia64_relax_ldxmov (bfd_byte *contents, bfd_vma off)
+{
+  int shift, r1, r3;
+  bfd_vma dword, insn;
+
+  switch ((int)off & 0x3)
+    {
+    case 0: shift =  5; break;
+    case 1: shift = 14; off += 3; break;
+    case 2: shift = 23; off += 6; break;
+    default:
+      abort ();
+    }
+
+  dword = bfd_getl64 (contents + off);
+  insn = (dword >> shift) & 0x1ffffffffffLL;
+
+  r1 = (insn >> 6) & 127;
+  r3 = (insn >> 20) & 127;
+  if (r1 == r3)
+    insn = 0x8000000;				   /* nop */
+  else
+    insn = (insn & 0x7f01fff) | 0x10800000000LL;   /* (qp) mov r1 = r3 */
+
+  dword &= ~(0x1ffffffffffLL << shift);
+  dword |= (insn << shift);
+  bfd_putl64 (dword, contents + off);
+}
+#endif /* ARCH_SIZE == 64 */
+

+
 /* Rename some of the generic section flags to better document how they
    are used here.  */
 #define skip_relax_pass_0 sec_flg0
 #define skip_relax_pass_1 sec_flg1
 
-

 /* These functions do relaxation for IA-64 ELF.  */
 
 static void
@@ -1075,7 +1108,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 	      /* If the 60-bit branch is in 21-bit range, optimize it. */
 	      if (r_type == R_IA64_PCREL60B)
 		{
-		  elfNN_ia64_relax_brl (contents, roff);
+		  elfxx_ia64_relax_brl (contents, roff);
 
 		  irel->r_info
 		    = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
@@ -1091,7 +1124,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 	    }
 	  else if (r_type == R_IA64_PCREL60B)
 	    continue;
-	  else if (elfNN_ia64_relax_br (contents, roff))
+	  else if (elfxx_ia64_relax_br (contents, roff))
 	    {
 	      irel->r_info
 		= ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
@@ -1205,7 +1238,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 	    }
 
 	  /* Fix up the existing branch to hit the trampoline.  */
-	  if (elfNN_ia64_install_value (contents + roff, offset, r_type)
+	  if (elfxx_ia64_install_value (contents + roff, offset, r_type)
 	      != bfd_reloc_ok)
 	    goto error_return;
 
@@ -1253,7 +1286,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 	    }
 	  else
 	    {
-	      elfNN_ia64_relax_ldxmov (contents, roff);
+	      elfxx_ia64_relax_ldxmov (contents, roff);
 	      irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
 	      changed_contents = TRUE;
 	      changed_relocs = TRUE;
@@ -1355,36 +1388,6 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 }
 #undef skip_relax_pass_0
 #undef skip_relax_pass_1
-
-static void
-elfNN_ia64_relax_ldxmov (bfd_byte *contents, bfd_vma off)
-{
-  int shift, r1, r3;
-  bfd_vma dword, insn;
-
-  switch ((int)off & 0x3)
-    {
-    case 0: shift =  5; break;
-    case 1: shift = 14; off += 3; break;
-    case 2: shift = 23; off += 6; break;
-    default:
-      abort ();
-    }
-
-  dword = bfd_getl64 (contents + off);
-  insn = (dword >> shift) & 0x1ffffffffffLL;
-
-  r1 = (insn >> 6) & 127;
-  r3 = (insn >> 20) & 127;
-  if (r1 == r3)
-    insn = 0x8000000;				   /* nop */
-  else
-    insn = (insn & 0x7f01fff) | 0x10800000000LL;   /* (qp) mov r1 = r3 */
-
-  dword &= ~(0x1ffffffffffLL << shift);
-  dword |= (insn << shift);
-  bfd_putl64 (dword, contents + off);
-}
 

 /* Return TRUE if NAME is an unwind table section name.  */
 
@@ -2648,7 +2651,7 @@ count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
       rent->count = 0;
       dyn_i->reloc_entries = rent;
     }
-  rent->reltext = reltext;
+  rent->reltext |= reltext;
   rent->count++;
 
   return TRUE;
@@ -3744,8 +3747,10 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
   return TRUE;
 }
 
-static bfd_reloc_status_type
-elfNN_ia64_install_value (bfd_byte *hit_addr, bfd_vma v,
+#if ARCH_SIZE == 64
+
+bfd_reloc_status_type
+elfxx_ia64_install_value (bfd_byte *hit_addr, bfd_vma v,
 			  unsigned int r_type)
 {
   const struct ia64_operand *op;
@@ -3966,6 +3971,7 @@ elfNN_ia64_install_value (bfd_byte *hit_addr, bfd_vma v,
 
   return bfd_reloc_ok;
 }
+#endif /* ARCH_SIZE == 64 */
 
 static void
 elfNN_ia64_install_dyn_reloc (bfd *abfd, struct bfd_link_info *info,
@@ -4585,7 +4591,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	  continue;
 	}
 
-      howto = lookup_howto (r_type);
+      howto = elfxx_ia64_lookup_howto (r_type);
       r_symndx = ELFNN_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
@@ -4759,7 +4765,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	case R_IA64_LTV32LSB:
 	case R_IA64_LTV64MSB:
 	case R_IA64_LTV64LSB:
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_GPREL22:
@@ -4780,7 +4786,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	      continue;
 	    }
 	  value -= gp_val;
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_LTOFF22:
@@ -4790,7 +4796,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	  value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1),
 				 rel->r_addend, value, R_IA64_DIRNNLSB);
 	  value -= gp_val;
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_PLTOFF22:
@@ -4800,7 +4806,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
           dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
 	  value = set_pltoff_entry (output_bfd, info, dyn_i, value, FALSE);
 	  value -= gp_val;
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_FPTR64I:
@@ -4865,7 +4871,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 					    dynindx, addend);
 	    }
 
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_LTOFF_FPTR22:
@@ -4907,7 +4913,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	    value = set_got_entry (output_bfd, info, dyn_i, dynindx,
 				   rel->r_addend, value, R_IA64_FPTRNNLSB);
 	    value -= gp_val;
-	    r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	    r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  }
 	  break;
 
@@ -4992,7 +4998,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	  value -= (input_section->output_section->vma
 		    + input_section->output_offset
 		    + rel->r_offset) & ~ (bfd_vma) 0x3;
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_SEGREL32MSB:
@@ -5016,7 +5022,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 		    value -= p->p_vaddr;
 		  else
 		    value = 0;
-		  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+		  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 		}
 	      break;
 	    }
@@ -5029,7 +5035,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	     is defined. PR 475  */
 	  if (sym_sec)
 	    value -= sym_sec->output_section->vma;
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_IPLTMSB:
@@ -5070,8 +5076,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	    r_type = R_IA64_DIR64MSB;
 	  else
 	    r_type = R_IA64_DIR64LSB;
-	  elfNN_ia64_install_value (hit_addr, value, r_type);
-	  r = elfNN_ia64_install_value (hit_addr + 8, gp_val, r_type);
+	  elfxx_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr + 8, gp_val, r_type);
 	  break;
 
 	case R_IA64_TPREL14:
@@ -5080,7 +5086,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	  if (elf_hash_table (info)->tls_sec == NULL)
 	    goto missing_tls_sec;
 	  value -= elfNN_ia64_tprel_base (info);
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_DTPREL14:
@@ -5093,7 +5099,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	  if (elf_hash_table (info)->tls_sec == NULL)
 	    goto missing_tls_sec;
 	  value -= elfNN_ia64_dtprel_base (info);
-	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	  r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_LTOFF_TPREL22:
@@ -5141,7 +5147,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
 	    value = set_got_entry (input_bfd, info, dyn_i, dynindx, r_addend,
 				   value, got_r_type);
 	    value -= gp_val;
-	    r = elfNN_ia64_install_value (hit_addr, value, r_type);
+	    r = elfxx_ia64_install_value (hit_addr, value, r_type);
 	  }
 	  break;
 
@@ -5284,8 +5290,8 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
       loc = plt_sec->contents + dyn_i->plt_offset;
 
       memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE);
-      elfNN_ia64_install_value (loc, plt_index, R_IA64_IMM22);
-      elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B);
+      elfxx_ia64_install_value (loc, plt_index, R_IA64_IMM22);
+      elfxx_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B);
 
       plt_addr = (plt_sec->output_section->vma
 		  + plt_sec->output_offset
@@ -5298,7 +5304,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
 	  loc = plt_sec->contents + dyn_i->plt2_offset;
 
 	  memcpy (loc, plt_full_entry, PLT_FULL_ENTRY_SIZE);
-	  elfNN_ia64_install_value (loc, pltoff_addr - gp_val, R_IA64_IMM22);
+	  elfxx_ia64_install_value (loc, pltoff_addr - gp_val, R_IA64_IMM22);
 
 	  /* Mark the symbol as undefined, rather than as defined in the
 	     plt section.  Leave the value alone.  */
@@ -5423,7 +5429,7 @@ elfNN_ia64_finish_dynamic_sections (bfd *abfd,
 		    + sgotplt->output_offset
 		    - gp_val);
 
-	  elfNN_ia64_install_value (loc+1, pltres, R_IA64_GPREL22);
+	  elfxx_ia64_install_value (loc+1, pltres, R_IA64_GPREL22);
 	}
     }
 
@@ -6015,9 +6021,9 @@ elfNN_vms_close_and_cleanup (bfd *abfd)
 	elfNN_ia64_info_to_howto
 
 #define bfd_elfNN_bfd_reloc_type_lookup \
-	elfNN_ia64_reloc_type_lookup
+	elfxx_ia64_reloc_type_lookup
 #define bfd_elfNN_bfd_reloc_name_lookup \
-	elfNN_ia64_reloc_name_lookup
+	elfxx_ia64_reloc_name_lookup
 #define bfd_elfNN_bfd_is_local_label_name \
 	elfNN_ia64_is_local_label_name
 #define bfd_elfNN_bfd_relax_section \
diff --git a/bfd/elfxx-ia64.h b/bfd/elfxx-ia64.h
new file mode 100644
index 0000000..002de02
--- /dev/null
+++ b/bfd/elfxx-ia64.h
@@ -0,0 +1,37 @@
+/* IA-64 support for 64-bit ELF
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010  Free Software Foundation, Inc.
+   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+reloc_howto_type *elfxx_ia64_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
+
+reloc_howto_type *elfxx_ia64_reloc_name_lookup (bfd *, const char *);
+
+reloc_howto_type *elfxx_ia64_lookup_howto (unsigned int rtype);
+
+bfd_boolean elfxx_ia64_relax_br (bfd_byte *contents, bfd_vma off);
+void elfxx_ia64_relax_brl (bfd_byte *contents, bfd_vma off);
+void elfxx_ia64_relax_ldxmov (bfd_byte *contents, bfd_vma off);
+
+void elf32_ia64_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *);
+void elf64_ia64_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *);
+
+bfd_reloc_status_type elfxx_ia64_install_value (bfd_byte *hit_addr, bfd_vma v,
+                                                unsigned int r_type);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Patch] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 12:56 [Patch] bfd elfxx-ia64: share code between elf32 and elf64 Tristan Gingold
@ 2011-05-17 13:04 ` H.J. Lu
  2011-05-17 13:10   ` Tristan Gingold
  2011-05-17 13:08 ` [Patch] " Andreas Schwab
  1 sibling, 1 reply; 18+ messages in thread
From: H.J. Lu @ 2011-05-17 13:04 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

On Tue, May 17, 2011 at 5:56 AM, Tristan Gingold <gingold@adacore.com> wrote:
> Hi,
>
> some functions of elfxx-ia64.c are in fact the same when compiled for elf32 and for elf64.  This patch adds a new file,
> elfxx-ia64.h which declares these functions and compiles them only for elf64.
>
> No regression for linux/gnu ia64 and hpux ia64.
>
> This work is in fact preliminary work to support gnu ld on vms/ia64.  Although VMS uses elf64, it doesn't use the same shared library
> model.  Its DSO model is derived from the previous vms one (vector based). This made code reuse difficult.
>
> Ok for trunk ?
>

Why not do something similar to SPARC/MIPS to put common codes in
a new .c file?


-- 
H.J.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Patch] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 12:56 [Patch] bfd elfxx-ia64: share code between elf32 and elf64 Tristan Gingold
  2011-05-17 13:04 ` H.J. Lu
@ 2011-05-17 13:08 ` Andreas Schwab
  2011-05-17 13:11   ` Tristan Gingold
  1 sibling, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2011-05-17 13:08 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

Tristan Gingold <gingold@adacore.com> writes:

> -elfNN_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
> +elfxx_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,

I'd prefer s/elfxx_/elf_/.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Patch] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 13:04 ` H.J. Lu
@ 2011-05-17 13:10   ` Tristan Gingold
  2011-05-17 13:15     ` H.J. Lu
  0 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2011-05-17 13:10 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils Development


On May 17, 2011, at 3:04 PM, H.J. Lu wrote:

> On Tue, May 17, 2011 at 5:56 AM, Tristan Gingold <gingold@adacore.com> wrote:
>> Hi,
>> 
>> some functions of elfxx-ia64.c are in fact the same when compiled for elf32 and for elf64.  This patch adds a new file,
>> elfxx-ia64.h which declares these functions and compiles them only for elf64.
>> 
>> No regression for linux/gnu ia64 and hpux ia64.
>> 
>> This work is in fact preliminary work to support gnu ld on vms/ia64.  Although VMS uses elf64, it doesn't use the same shared library
>> model.  Its DSO model is derived from the previous vms one (vector based). This made code reuse difficult.
>> 
>> Ok for trunk ?
>> 
> 
> Why not do something similar to SPARC/MIPS to put common codes in
> a new .c file?

That's fine with me.  My proposal would be:

size specific code to elfnn-ia64.c
common code to elfxx-ia64.c (to match mips and sparc).

Do you agree with this proposal ?

Tristan.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Patch] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 13:08 ` [Patch] " Andreas Schwab
@ 2011-05-17 13:11   ` Tristan Gingold
  0 siblings, 0 replies; 18+ messages in thread
From: Tristan Gingold @ 2011-05-17 13:11 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils Development


On May 17, 2011, at 3:07 PM, Andreas Schwab wrote:

> Tristan Gingold <gingold@adacore.com> writes:
> 
>> -elfNN_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
>> +elfxx_ia64_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
> 
> I'd prefer s/elfxx_/elf_/.

Ok.  I think we also should use the ia64_elf_ prefix, like sparc and mips.

Tristan.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Patch] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 13:10   ` Tristan Gingold
@ 2011-05-17 13:15     ` H.J. Lu
  2011-05-17 15:12       ` [Patch v2] " Tristan Gingold
  0 siblings, 1 reply; 18+ messages in thread
From: H.J. Lu @ 2011-05-17 13:15 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

On Tue, May 17, 2011 at 6:10 AM, Tristan Gingold <gingold@adacore.com> wrote:
>
> On May 17, 2011, at 3:04 PM, H.J. Lu wrote:
>
>> On Tue, May 17, 2011 at 5:56 AM, Tristan Gingold <gingold@adacore.com> wrote:
>>> Hi,
>>>
>>> some functions of elfxx-ia64.c are in fact the same when compiled for elf32 and for elf64.  This patch adds a new file,
>>> elfxx-ia64.h which declares these functions and compiles them only for elf64.
>>>
>>> No regression for linux/gnu ia64 and hpux ia64.
>>>
>>> This work is in fact preliminary work to support gnu ld on vms/ia64.  Although VMS uses elf64, it doesn't use the same shared library
>>> model.  Its DSO model is derived from the previous vms one (vector based). This made code reuse difficult.
>>>
>>> Ok for trunk ?
>>>
>>
>> Why not do something similar to SPARC/MIPS to put common codes in
>> a new .c file?
>
> That's fine with me.  My proposal would be:
>
> size specific code to elfnn-ia64.c
> common code to elfxx-ia64.c (to match mips and sparc).
>
> Do you agree with this proposal ?
>

I like it.  FWIW, I planned to do it a long ago.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 13:15     ` H.J. Lu
@ 2011-05-17 15:12       ` Tristan Gingold
  2011-05-23  8:00         ` Ping " Tristan Gingold
  0 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2011-05-17 15:12 UTC (permalink / raw)
  To: binutils Development; +Cc: H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]

Hi,

patch reworked.  Much bigger but much cleaner too, so attached.

No regressions on linux/ia64 and hpux/ia64.

Ok for trunk ?

Tristan.

bfd/
2011-05-17  Tristan Gingold  <gingold@adacore.com>

	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
	* Makefile.am (BFD64_BACKENDS): Add elfnn-ia64.lo
	(BFD64_BACKENDS_CFILES): Add elfnn-ia64.c
	(elf32-ia64.c): Created from elfnn-ia64.c
	(elf64-ia64.c): Likewise.
	* elfxx-ia64.h: New file.
	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
	functions.Includes elfxx-ia64.h.
	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
	(IA64_HOWTO): Adjust.
	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
	(elfNN_ia64_reloc_type_lookup): Renames to
	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
	(elfNN_ia64_reloc_name_lookup): Renames to
	ia64_elf_reloc_name_lookup. Make it public.
	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
	public.
	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
	Move it and make it public.  Move prototype to elfxx-ia64.h
	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
	Move prototype to elfxx-ia64.h
	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
	(elfNN_ia64_info_to_howto): Adjust calls.
	(elfNN_ia64_relax_section): Adjust calls.
	(count_dyn_reloc): Fix typo.
	(elfNN_ia64_relocate_section): Adjust calls.
	(elfNN_ia64_finish_dynamic_symbol): Likewise.
	(bfd_elfNN_bfd_reloc_type_lookup)
	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.


[-- Attachment #2: ia64.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 46446 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-17 15:12       ` [Patch v2] " Tristan Gingold
@ 2011-05-23  8:00         ` Tristan Gingold
  2011-05-24 13:50           ` Nick Clifton
  0 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2011-05-23  8:00 UTC (permalink / raw)
  To: binutils Development


Ping for:

On May 17, 2011, at 5:12 PM, Tristan Gingold wrote:

> Hi,
> 
> patch reworked.  Much bigger but much cleaner too, so attached.
> 
> No regressions on linux/ia64 and hpux/ia64.
> 
> Ok for trunk ?
> 
> Tristan.
> 
> bfd/
> 2011-05-17  Tristan Gingold  <gingold@adacore.com>
> 
> 	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
> 	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
> 	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
> 	* Makefile.am (BFD64_BACKENDS): Add elfnn-ia64.lo
> 	(BFD64_BACKENDS_CFILES): Add elfnn-ia64.c
> 	(elf32-ia64.c): Created from elfnn-ia64.c
> 	(elf64-ia64.c): Likewise.
> 	* elfxx-ia64.h: New file.
> 	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
> 	functions.Includes elfxx-ia64.h.
> 	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
> 	(IA64_HOWTO): Adjust.
> 	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
> 	(elfNN_ia64_reloc_type_lookup): Renames to
> 	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
> 	(elfNN_ia64_reloc_name_lookup): Renames to
> 	ia64_elf_reloc_name_lookup. Make it public.
> 	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
> 	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
> 	public.
> 	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
> 	Move it and make it public.  Move prototype to elfxx-ia64.h
> 	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
> 	Move prototype to elfxx-ia64.h
> 	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
> 	(elfNN_ia64_info_to_howto): Adjust calls.
> 	(elfNN_ia64_relax_section): Adjust calls.
> 	(count_dyn_reloc): Fix typo.
> 	(elfNN_ia64_relocate_section): Adjust calls.
> 	(elfNN_ia64_finish_dynamic_symbol): Likewise.
> 	(bfd_elfNN_bfd_reloc_type_lookup)
> 	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.
> 
> <ia64.diff.bz2>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-23  8:00         ` Ping " Tristan Gingold
@ 2011-05-24 13:50           ` Nick Clifton
  2011-05-24 14:17             ` Tristan Gingold
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2011-05-24 13:50 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

Hi Tristan,

> Ping for:
>> patch reworked.  Much bigger but much cleaner too, so attached.
>> No regressions on linux/ia64 and hpux/ia64.

When I tried this I found some build errors for my all-64 target 
(configured with --enable-64bit-bfd --enable-targets=all):

   bfd/elfnn-ia64.c: In function 'elfNN_ia64_info_to_howto':
   bfd/elfnn-ia64.c:215:5: error: implicit declaration of function 
'ELFNN_R_TYPE'
   bfd/elfnn-ia64.c: At top level:
   bfd/elfnn-ia64.c:278:1: error: no previous prototype for 
'bfd_elfNN_ia64_after_parse'

And so on.  Please could you check this locally and assuming that it 
happens for you too, fix it ?

Cheers
   Nick

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-24 13:50           ` Nick Clifton
@ 2011-05-24 14:17             ` Tristan Gingold
  2011-05-25  8:07               ` Nick Clifton
  0 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2011-05-24 14:17 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils Development

[-- Attachment #1: Type: text/plain, Size: 2492 bytes --]


On May 24, 2011, at 3:51 PM, Nick Clifton wrote:

Hi,

>> Ping for:
>>> patch reworked.  Much bigger but much cleaner too, so attached.
>>> No regressions on linux/ia64 and hpux/ia64.
> 
> When I tried this I found some build errors for my all-64 target (configured with --enable-64bit-bfd --enable-targets=all):
> 
>  bfd/elfnn-ia64.c: In function 'elfNN_ia64_info_to_howto':
>  bfd/elfnn-ia64.c:215:5: error: implicit declaration of function 'ELFNN_R_TYPE'
>  bfd/elfnn-ia64.c: At top level:
>  bfd/elfnn-ia64.c:278:1: error: no previous prototype for 'bfd_elfNN_ia64_after_parse'
> 
> And so on.  Please could you check this locally and assuming that it happens for you too, fix it ?

Argh, sorry.  I added the wrong files to BFD64_BACKENDS.  Thank you for catching that.

Attached is the corrected patch.

Tristan.

bfd/
2011-05-17  Tristan Gingold  <gingold@adacore.com>

	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
	* Makefile.am (BFD64_BACKENDS): Add elfxx-ia64.lo
	(BFD64_BACKENDS_CFILES): Add elfxx-ia64.c
	(elf32-ia64.c): Created from elfnn-ia64.c
	(elf64-ia64.c): Likewise.
	* elfxx-ia64.h: New file.
	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
	functions.Includes elfxx-ia64.h.
	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
	(IA64_HOWTO): Adjust.
	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
	(elfNN_ia64_reloc_type_lookup): Renames to
	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
	(elfNN_ia64_reloc_name_lookup): Renames to
	ia64_elf_reloc_name_lookup. Make it public.
	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
	public.
	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
	Move it and make it public.  Move prototype to elfxx-ia64.h
	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
	Move prototype to elfxx-ia64.h
	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
	(elfNN_ia64_info_to_howto): Adjust calls.
	(elfNN_ia64_relax_section): Adjust calls.
	(count_dyn_reloc): Fix typo.
	(elfNN_ia64_relocate_section): Adjust calls.
	(elfNN_ia64_finish_dynamic_symbol): Likewise.
	(bfd_elfNN_bfd_reloc_type_lookup)
	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.


[-- Attachment #2: ia64.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 46421 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-24 14:17             ` Tristan Gingold
@ 2011-05-25  8:07               ` Nick Clifton
  2011-05-25 12:03                 ` Tristan Gingold
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2011-05-25  8:07 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

Hi Tristan,

> bfd/
> 2011-05-17  Tristan Gingold<gingold@adacore.com>
>
> 	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
> 	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
> 	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
> 	* Makefile.am (BFD64_BACKENDS): Add elfxx-ia64.lo
> 	(BFD64_BACKENDS_CFILES): Add elfxx-ia64.c
> 	(elf32-ia64.c): Created from elfnn-ia64.c
> 	(elf64-ia64.c): Likewise.
> 	* elfxx-ia64.h: New file.
> 	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
> 	functions.Includes elfxx-ia64.h.
> 	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
> 	(IA64_HOWTO): Adjust.
> 	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
> 	(elfNN_ia64_reloc_type_lookup): Renames to
> 	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
> 	(elfNN_ia64_reloc_name_lookup): Renames to
> 	ia64_elf_reloc_name_lookup. Make it public.
> 	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
> 	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
> 	public.
> 	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
> 	Move it and make it public.  Move prototype to elfxx-ia64.h
> 	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
> 	Move prototype to elfxx-ia64.h
> 	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
> 	(elfNN_ia64_info_to_howto): Adjust calls.
> 	(elfNN_ia64_relax_section): Adjust calls.
> 	(count_dyn_reloc): Fix typo.
> 	(elfNN_ia64_relocate_section): Adjust calls.
> 	(elfNN_ia64_finish_dynamic_symbol): Likewise.
> 	(bfd_elfNN_bfd_reloc_type_lookup)
> 	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.

Approved - please apply.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-25  8:07               ` Nick Clifton
@ 2011-05-25 12:03                 ` Tristan Gingold
  2011-07-05 19:06                   ` Aurelien Jarno
  0 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2011-05-25 12:03 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils Development


On May 25, 2011, at 9:21 AM, Nick Clifton wrote:

> Hi Tristan,
> 
>> bfd/
>> 2011-05-17  Tristan Gingold<gingold@adacore.com>
>> 
>> 	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
>> 	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
>> 	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
>> 	* Makefile.am (BFD64_BACKENDS): Add elfxx-ia64.lo
>> 	(BFD64_BACKENDS_CFILES): Add elfxx-ia64.c
>> 	(elf32-ia64.c): Created from elfnn-ia64.c
>> 	(elf64-ia64.c): Likewise.
>> 	* elfxx-ia64.h: New file.
>> 	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
>> 	functions.Includes elfxx-ia64.h.
>> 	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
>> 	(IA64_HOWTO): Adjust.
>> 	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
>> 	(elfNN_ia64_reloc_type_lookup): Renames to
>> 	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
>> 	(elfNN_ia64_reloc_name_lookup): Renames to
>> 	ia64_elf_reloc_name_lookup. Make it public.
>> 	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
>> 	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
>> 	public.
>> 	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
>> 	Move it and make it public.  Move prototype to elfxx-ia64.h
>> 	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
>> 	Move prototype to elfxx-ia64.h
>> 	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
>> 	(elfNN_ia64_info_to_howto): Adjust calls.
>> 	(elfNN_ia64_relax_section): Adjust calls.
>> 	(count_dyn_reloc): Fix typo.
>> 	(elfNN_ia64_relocate_section): Adjust calls.
>> 	(elfNN_ia64_finish_dynamic_symbol): Likewise.
>> 	(bfd_elfNN_bfd_reloc_type_lookup)
>> 	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.
> 
> Approved - please apply.

Thanks, committed.

Tristan.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-05-25 12:03                 ` Tristan Gingold
@ 2011-07-05 19:06                   ` Aurelien Jarno
  2011-07-06  7:00                     ` Tristan Gingold
  0 siblings, 1 reply; 18+ messages in thread
From: Aurelien Jarno @ 2011-07-05 19:06 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Nick Clifton, binutils Development

Hello Tristan,

On Wed, May 25, 2011 at 02:02:49PM +0200, Tristan Gingold wrote:
> 
> On May 25, 2011, at 9:21 AM, Nick Clifton wrote:
> 
> > Hi Tristan,
> > 
> >> bfd/
> >> 2011-05-17  Tristan Gingold<gingold@adacore.com>
> >> 
> >> 	* configure.in (bfd_elf32_ia64_big_vec, bfd_elf32_ia64_hpux_big_vec)
> >> 	(bfd_elf64_ia64_big_vec, bfd_elf64_ia64_hpux_big_vec)
> >> 	(bfd_elf64_ia64_little_vec, bfd_elf64_ia64_vms_vec): Add elfxx-ia64.lo
> >> 	* Makefile.am (BFD64_BACKENDS): Add elfxx-ia64.lo
> >> 	(BFD64_BACKENDS_CFILES): Add elfxx-ia64.c
> >> 	(elf32-ia64.c): Created from elfnn-ia64.c
> >> 	(elf64-ia64.c): Likewise.
> >> 	* elfxx-ia64.h: New file.
> >> 	* elfxx-ia64.c: Split with elfnn-ia64.c.  Keep only the following
> >> 	functions.Includes elfxx-ia64.h.
> >> 	(elfNN_ia64_reloc): Renames to ia64_elf_reloc.  Adjust error message.
> >> 	(IA64_HOWTO): Adjust.
> >> 	(lookup_howto): Renames to ia64_elf_lookup_howto.  Make it public.
> >> 	(elfNN_ia64_reloc_type_lookup): Renames to
> >> 	ia64_elf_reloc_type_lookup. Make it public. Adjust calls.
> >> 	(elfNN_ia64_reloc_name_lookup): Renames to
> >> 	ia64_elf_reloc_name_lookup. Make it public.
> >> 	(elfNN_ia64_relax_br): Renames to ia64_elf_relax_br.  Make it public.
> >> 	(elfNN_ia64_relax_brl): Renames to ia64_elf_relax_brl. Make it
> >> 	public.
> >> 	(elfNN_ia64_relax_ldxmov): Renames to ia64_elf_relax_ldxmov.
> >> 	Move it and make it public.  Move prototype to elfxx-ia64.h
> >> 	(elfNN_ia64_install_value): Renames to ia64_elf_install_value.
> >> 	Move prototype to elfxx-ia64.h
> >> 	* elfnn-ia64.c: New file, split from elfxx-ia64.c.
> >> 	(elfNN_ia64_info_to_howto): Adjust calls.
> >> 	(elfNN_ia64_relax_section): Adjust calls.
> >> 	(count_dyn_reloc): Fix typo.
> >> 	(elfNN_ia64_relocate_section): Adjust calls.
> >> 	(elfNN_ia64_finish_dynamic_symbol): Likewise.
> >> 	(bfd_elfNN_bfd_reloc_type_lookup)
> >> 	(bfd_elfNN_bfd_reloc_name_lookup): Adjust macros.
> > 
> > Approved - please apply.
> 
> Thanks, committed.
> 

This patch seems to break libc on ia64. ld-2.13.so produced with
binutils using this patch works when called as a standalone, but just
segfault when used with other binaries:

| $ ./ld.so 
| Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
| You have invoked `ld.so', the helper program for shared library executables.
| This program usually lives in the file `/lib/ld.so', and special directives
| in executable files using ELF shared libraries tell the system's program
| loader to load the helper program from this file.  This helper program loads
| the shared libraries needed by the program executable, prepares the program
| to run, and runs it.  You may invoke this helper program directly from the
| command line to load and run an ELF executable file; this is like executing
| that file itself, but always uses this helper program from the file you
| specified, instead of the helper program file specified in the executable
| file you run.  This is mostly of use for maintainers to test new versions
| of this helper program; chances are you did not intend to run this program.
| 
|   --list                list all dependencies and how they are resolved
|   --verify              verify that given object really is a dynamically linked
|                         object we can handle
|   --library-path PATH   use given PATH instead of content of the environment
|                         variable LD_LIBRARY_PATH
|   --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names
|                         in LIST
|   --audit LIST          use objects named in LIST as auditors
| $ ./ld.so  /bin/ls
| Segmentation fault
| 

I don't know what is the best way to proceed for debugging this issue. I
can provide you the correct and the broken ld.so if it can help.

Thanks,
Aurelien

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-07-05 19:06                   ` Aurelien Jarno
@ 2011-07-06  7:00                     ` Tristan Gingold
  2011-07-09 18:18                       ` Aurelien Jarno
  2011-07-10 11:53                       ` Andreas Schwab
  0 siblings, 2 replies; 18+ messages in thread
From: Tristan Gingold @ 2011-07-06  7:00 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: Nick Clifton, binutils Development


On Jul 5, 2011, at 8:29 PM, Aurelien Jarno wrote:

> Hello Tristan,

[...]

> This patch seems to break libc on ia64. ld-2.13.so produced with
> binutils using this patch works when called as a standalone, but just
> segfault when used with other binaries:

[...]

> I don't know what is the best way to proceed for debugging this issue. I
> can provide you the correct and the broken ld.so if it can help.

This patch shouldn't have made any functional change, but ...

It would be useful if you could send (either directly to me or just open a bugzilla entry) *all* the object files required to build
ld.so and the 'ld' command line to build it.

Tristan.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-07-06  7:00                     ` Tristan Gingold
@ 2011-07-09 18:18                       ` Aurelien Jarno
  2011-07-10 11:53                       ` Andreas Schwab
  1 sibling, 0 replies; 18+ messages in thread
From: Aurelien Jarno @ 2011-07-09 18:18 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Nick Clifton, binutils Development

On Wed, Jul 06, 2011 at 08:45:56AM +0200, Tristan Gingold wrote:
> 
> On Jul 5, 2011, at 8:29 PM, Aurelien Jarno wrote:
> 
> > Hello Tristan,
> 
> [...]
> 
> > This patch seems to break libc on ia64. ld-2.13.so produced with
> > binutils using this patch works when called as a standalone, but just
> > segfault when used with other binaries:
> 
> [...]
> 
> > I don't know what is the best way to proceed for debugging this issue. I
> > can provide you the correct and the broken ld.so if it can help.
> 
> This patch shouldn't have made any functional change, but ...
> 
> It would be useful if you could send (either directly to me or just open a bugzilla entry) *all* the object files required to build
> ld.so and the 'ld' command line to build it.

This is now done in bugzilla entry 12978.

Thanks,
Aurelien

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-07-06  7:00                     ` Tristan Gingold
  2011-07-09 18:18                       ` Aurelien Jarno
@ 2011-07-10 11:53                       ` Andreas Schwab
  2011-07-11 16:20                         ` H.J. Lu
  2011-07-25 13:35                         ` Tristan Gingold
  1 sibling, 2 replies; 18+ messages in thread
From: Andreas Schwab @ 2011-07-10 11:53 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Aurelien Jarno, Nick Clifton, binutils Development

Tristan Gingold <gingold@adacore.com> writes:

> This patch shouldn't have made any functional change, but ...

There is one functional change:

@@ -2648,7 +2135,7 @@ count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
       rent->count = 0;
       dyn_i->reloc_entries = rent;
     }
-  rent->reltext = reltext;
+  rent->reltext |= reltext;
   rent->count++;
 
   return TRUE;

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-07-10 11:53                       ` Andreas Schwab
@ 2011-07-11 16:20                         ` H.J. Lu
  2011-07-25 13:35                         ` Tristan Gingold
  1 sibling, 0 replies; 18+ messages in thread
From: H.J. Lu @ 2011-07-11 16:20 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Tristan Gingold, Aurelien Jarno, Nick Clifton, binutils Development

On Sat, Jul 9, 2011 at 11:18 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Tristan Gingold <gingold@adacore.com> writes:
>
>> This patch shouldn't have made any functional change, but ...
>
> There is one functional change:
>
> @@ -2648,7 +2135,7 @@ count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
>       rent->count = 0;
>       dyn_i->reloc_entries = rent;
>     }
> -  rent->reltext = reltext;
> +  rent->reltext |= reltext;
>   rent->count++;
>
>   return TRUE;
>
>

I am checking this as an obvious fix.


-- 
H.J.
----
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a1b9197..e469ef2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/12978
+	* elfnn-ia64.c (count_dyn_reloc): Fix a typo.
+
 2011-07-09  Alan Modra  <amodra@gmail.com>

 	PR ld/12942
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index bc31fca..3e2ee0b 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -2129,7 +2129,7 @@ count_dyn_reloc (bfd *abfd, struct
elfNN_ia64_dyn_sym_info *dyn_i,
       rent->count = 0;
       dyn_i->reloc_entries = rent;
     }
-  rent->reltext |= reltext;
+  rent->reltext = reltext;
   rent->count++;

   return TRUE;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ping [Patch v2] bfd elfxx-ia64: share code between elf32 and elf64
  2011-07-10 11:53                       ` Andreas Schwab
  2011-07-11 16:20                         ` H.J. Lu
@ 2011-07-25 13:35                         ` Tristan Gingold
  1 sibling, 0 replies; 18+ messages in thread
From: Tristan Gingold @ 2011-07-25 13:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Aurelien Jarno, Nick Clifton, binutils Development


On Jul 9, 2011, at 8:18 PM, Andreas Schwab wrote:

> Tristan Gingold <gingold@adacore.com> writes:
> 
>> This patch shouldn't have made any functional change, but ...
> 
> There is one functional change:
> 
> @@ -2648,7 +2135,7 @@ count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
>       rent->count = 0;
>       dyn_i->reloc_entries = rent;
>     }
> -  rent->reltext = reltext;
> +  rent->reltext |= reltext;
>   rent->count++;
> 
>   return TRUE;

Argh, thank you for catching that.

Tristan.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-07-25  7:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 12:56 [Patch] bfd elfxx-ia64: share code between elf32 and elf64 Tristan Gingold
2011-05-17 13:04 ` H.J. Lu
2011-05-17 13:10   ` Tristan Gingold
2011-05-17 13:15     ` H.J. Lu
2011-05-17 15:12       ` [Patch v2] " Tristan Gingold
2011-05-23  8:00         ` Ping " Tristan Gingold
2011-05-24 13:50           ` Nick Clifton
2011-05-24 14:17             ` Tristan Gingold
2011-05-25  8:07               ` Nick Clifton
2011-05-25 12:03                 ` Tristan Gingold
2011-07-05 19:06                   ` Aurelien Jarno
2011-07-06  7:00                     ` Tristan Gingold
2011-07-09 18:18                       ` Aurelien Jarno
2011-07-10 11:53                       ` Andreas Schwab
2011-07-11 16:20                         ` H.J. Lu
2011-07-25 13:35                         ` Tristan Gingold
2011-05-17 13:08 ` [Patch] " Andreas Schwab
2011-05-17 13:11   ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).