This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

(Almost) the last patch for HP-UX IA64 support.



This patch is the last change I have for HP-UX IA64 support except for
libtool changes and a possible change to bfd/elf.c that is probably
going to need some discussion before it can be approved.  I am hoping we
might update to the latest libtools at some time (before 2.12?) because
this already has HP-UX IA64 support in it and then I won't need a patch
for the version of libtools in binutils.

Here is a patch to put an IA64 HP-UX target in configure.in and
to add gas support.

Steve Ellcey
sje@cup.hp.com


2002-01-07  Steve Ellcey  <sje@cup.hp.com>
	* configure.in (ia64*-*-hpux*): New target for IA64 HP-UX,
	  ld and gdb are not supported.
	* configure: Regenerate
	* gas/config/tc-ia64.h (MD_FLAGS_DEFAULT): New Macro for
	  setting default md.flags.
	  (SHT_INIT_ARRAY): New elf special section used by HP-UX.
	  (SHT_FINI_ARRAY): New elf special section used by HP-UX.
	* gas/config/tc-ia64.c (setup_unwind_header): Add support
	  for 32 bit unwind info blocks.
	  (generate_unwind_image): Add support for different types
	  of unwind images (32 bits and/or big-endian).
	  (ia64_init): Use MD_FLAGS_DEFAULT to set md.flags.
	  (ia64_target_format): Add support for hpux target formats.
	  (ia64_gen_real_reloc_type): Add support for FUNC_IPLT_RELOC.
	* gas/config/obj-elf.c (obj_elf_section_type): Add support
	  for SHT_INIT_ARRAY and SHT_FINI_ARRAY elf section types.

--- orig/src/configure.in	Mon Jan  7 12:25:27 2002
+++ src/configure.in	Mon Jan  7 12:26:11 2002
@@ -742,6 +742,10 @@ case "${target}" in
     # No gdb support yet.
     noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
     ;;
+  ia64*-*-hpux*)
+    # No gdb or ld support yet.
+    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb ld"
+    ;;
   i[3456]86-*-coff | i[3456]86-*-elf)
     if [ x${is_cross_compiler} != xno ] ; then
          target_configdirs="${target_configdirs} target-libstub target-cygmon"
--- orig/src/gas/config/tc-ia64.h	Mon Jan  7 12:25:51 2002
+++ src/gas/config/tc-ia64.h	Mon Jan  7 12:26:52 2002
@@ -28,9 +28,11 @@
 #ifdef TE_HPUX
 #define md_number_to_chars		number_to_chars_bigendian
 #define TARGET_BYTES_BIG_ENDIAN		1
+#define MD_FLAGS_DEFAULT		EF_IA_64_BE
 #else
 #define md_number_to_chars		number_to_chars_littleendian
 #define TARGET_BYTES_BIG_ENDIAN		0
+#define MD_FLAGS_DEFAULT		EF_IA_64_ABI64
 #endif /* TE_HPUX */
 
 /* We need to set the default object file format in ia64_init and not in
@@ -123,7 +125,9 @@ extern void ia64_after_parse_args PARAMS
 
 #define ELF_TC_SPECIAL_SECTIONS						   \
 { ".sbss",	SHT_NOBITS,	SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \
-{ ".sdata",	SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+{ ".sdata",	SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \
+{ ".init_array",SHT_INIT_ARRAY,	SHF_ALLOC + SHF_WRITE                   }, \
+{ ".fini_array",SHT_FINI_ARRAY,	SHF_ALLOC + SHF_WRITE                   },
 
 #define DWARF2_LINE_MIN_INSN_LENGTH 1	/* so slot-multipliers can be 1 */
 
--- orig/src/gas/config/tc-ia64.c	Mon Jan  7 12:25:49 2002
+++ src/gas/config/tc-ia64.c	Mon Jan  7 12:26:51 2002
@@ -2791,6 +2791,7 @@ static int
 setup_unwind_header (int size, unsigned char **mem)
 {
   int x, extra = 0;
+  valueT flag_value;
 
   /* pad to pointer-size boundry.  */
   x = size % md.pointer_size;
@@ -2803,12 +2804,20 @@ setup_unwind_header (int size, unsigned 
 
   /* Clear the padding area and personality.  */
   memset (*mem + 8 + size, 0 , extra + md.pointer_size);
+
   /* Initialize the header area.  */
+  if (unwind.personality_routine)
+    {
+      if (md.flags & EF_IA_64_ABI64)
+	flag_value = (bfd_vma) 3 << 32;
+      else
+	flag_value = (bfd_vma) 0x1003 << 32; /* 32-bit unwind info block.  */
+    }
+  else
+    flag_value = 0;
 
   md_number_to_chars (*mem, (((bfd_vma) 1 << 48)     /* version */
-			     | (unwind.personality_routine
-				? ((bfd_vma) 3 << 32) /* U & E handler flags */
-				: 0)
+			     | flag_value            /* U & E handler flags */
 			     | ((size + extra) / md.pointer_size)), /* length */
 		      8);
 
@@ -3220,6 +3229,7 @@ generate_unwind_image (text_name)
       unsigned char *where;
       char *sec_name;
       expressionS exp;
+      bfd_reloc_code_real_type reloc;
 
       make_unw_section_name (SPECIAL_SECTION_UNWIND_INFO, text_name, sec_name);
       set_section (sec_name);
@@ -3249,8 +3259,18 @@ generate_unwind_image (text_name)
 	  exp.X_op  = O_symbol;
 	  exp.X_add_symbol = unwind.personality_routine;
 	  exp.X_add_number = 0;
-	  fix_new_exp (frag_now, frag_now_fix () - 8, 8,
-	  		     &exp, 0, BFD_RELOC_IA64_LTOFF_FPTR64LSB);
+	  if (md.flags & EF_IA_64_BE)
+	    if (md.flags & EF_IA_64_ABI64)
+	      reloc = BFD_RELOC_IA64_LTOFF_FPTR64MSB;
+	    else
+	      reloc = BFD_RELOC_IA64_LTOFF_FPTR32MSB;
+          else
+	    if (md.flags & EF_IA_64_ABI64)
+	      reloc = BFD_RELOC_IA64_LTOFF_FPTR64LSB;
+	    else
+	      reloc = BFD_RELOC_IA64_LTOFF_FPTR32LSB;
+	  fix_new_exp (frag_now, frag_now_fix () - md.pointer_size,
+			     md.pointer_size, &exp, 0, reloc);
 	  unwind.personality_routine = 0;
 	}
     }
@@ -6614,9 +6634,7 @@ ia64_init (argc, argv)
      int argc ATTRIBUTE_UNUSED;
      char **argv ATTRIBUTE_UNUSED;
 {
-  md.flags = EF_IA_64_ABI64;
-  if (TARGET_BYTES_BIG_ENDIAN)
-    md.flags |= EF_IA_64_BE;
+  md.flags = MD_FLAGS_DEFAULT;
 }
 
 /* Return a string for the target object file format.  */
@@ -6629,14 +6647,18 @@ ia64_target_format ()
       if (md.flags & EF_IA_64_BE)
 	{
 	  if (md.flags & EF_IA_64_ABI64)
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
 	    return "elf64-ia64-aix-big";
+#elif defined(TE_HPUX)
+	    return "elf64-ia64-hpux-big";
 #else
 	    return "elf64-ia64-big";
 #endif
 	  else
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
 	    return "elf32-ia64-aix-big";
+#elif defined(TE_HPUX)
+	    return "elf32-ia64-hpux-big";
 #else
 	    return "elf32-ia64-big";
 #endif
@@ -6644,13 +6666,13 @@ ia64_target_format ()
       else
 	{
 	  if (md.flags & EF_IA_64_ABI64)
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
 	    return "elf64-ia64-aix-little";
 #else
 	    return "elf64-ia64-little";
 #endif
 	  else
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
 	    return "elf32-ia64-aix-little";
 #else
 	    return "elf32-ia64-little";
@@ -10023,6 +10045,9 @@ ia64_gen_real_reloc_type (sym, r_type)
 	  break;
 	}
       break;
+
+    case  FUNC_IPLT_RELOC:
+        break;
 
     default:
       abort ();
--- orig/src/gas/config/obj-elf.c	Mon Jan  7 12:25:43 2002
+++ src/gas/config/obj-elf.c	Mon Jan  7 12:26:47 2002
@@ -838,6 +838,10 @@ obj_elf_section_type (str, len)
     return SHT_PROGBITS;
   if (len == 6 && strncmp (str, "nobits", 6) == 0)
     return SHT_NOBITS;
+  if (len == 10 && strncmp (str, "init_array",10) == 0)
+    return SHT_INIT_ARRAY;
+  if (len == 10 && strncmp (str, "fini_array",10) == 0)
+    return SHT_FINI_ARRAY;
 
 #ifdef md_elf_section_type
   {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]