bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

binutils-2.10.1 patch for Solaris 2.8


From: Eddie C. Dost
Subject: binutils-2.10.1 patch for Solaris 2.8
Date: Fri, 29 Dec 2000 22:34:29 +0100 (MET)

Hi,

we have setup a tool chain using GNU gcc and gas under Solaris2.8,
we use the Solaris2.8 ld.

To support full dwarf-2 debug information, we need the UA32 and UA64
relocs in libbfd.

Appended is a patch against binutils-2.10.1 to run under Solaris2.8
in a 64 bit environment.

Eddie C. Dost               senior software engineer                ATecoM GmbH
address@hidden                 address@hidden                 Kaiserstr. 100
Phone: +49 2407 9586 0       Fax: +49 2407 9586 44         D-52134 Herzogenrath
GSM:   +49 172 9312808                                                  Germany
--
diff -u -r binutils-2.10.1/bfd/bfd-in2.h ../../binutils-2.10.1/bfd/bfd-in2.h
--- binutils-2.10.1/bfd/bfd-in2.h       Sat Apr 29 03:45:48 2000
+++ ../../binutils-2.10.1/bfd/bfd-in2.h Fri Dec 29 18:47:51 2000
@@ -1809,6 +1809,8 @@
   BFD_RELOC_SPARC_JMP_SLOT,
   BFD_RELOC_SPARC_RELATIVE,
   BFD_RELOC_SPARC_UA32,
+  BFD_RELOC_SPARC_UA16,
+  BFD_RELOC_SPARC_UA64,
 
 /* I think these are specific to SPARC a.out (e.g., Sun 4). */
   BFD_RELOC_SPARC_BASE13,
diff -u -r binutils-2.10.1/bfd/elf32-sparc.c 
../../binutils-2.10.1/bfd/elf32-sparc.c
--- binutils-2.10.1/bfd/elf32-sparc.c   Sun Oct 22 17:19:57 2000
+++ ../../binutils-2.10.1/bfd/elf32-sparc.c     Fri Dec 29 18:58:57 2000
@@ -157,8 +157,7 @@
   { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
   { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
   { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
-  /* ??? Doesn't dwarf use this?  */
-/*{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
+  { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
   {BFD_RELOC_SPARC_10, R_SPARC_10},
   {BFD_RELOC_SPARC_11, R_SPARC_11},
   {BFD_RELOC_SPARC_64, R_SPARC_64},
diff -u -r binutils-2.10.1/bfd/elf64-sparc.c 
../../binutils-2.10.1/bfd/elf64-sparc.c
--- binutils-2.10.1/bfd/elf64-sparc.c   Sun Oct 22 17:19:57 2000
+++ ../../binutils-2.10.1/bfd/elf64-sparc.c     Fri Dec 29 18:58:05 2000
@@ -183,8 +183,7 @@
   { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
   { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
   { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
-  /* ??? Doesn't dwarf use this?  */
-/*{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
+  { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
   {BFD_RELOC_SPARC_10, R_SPARC_10},
   {BFD_RELOC_SPARC_11, R_SPARC_11},
   {BFD_RELOC_SPARC_64, R_SPARC_64},
@@ -207,7 +206,9 @@
   {BFD_RELOC_SPARC_H44, R_SPARC_H44},
   {BFD_RELOC_SPARC_M44, R_SPARC_M44},
   {BFD_RELOC_SPARC_L44, R_SPARC_L44},
-  {BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER}
+  {BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER},
+  {BFD_RELOC_SPARC_UA64, R_SPARC_UA64},
+  {BFD_RELOC_SPARC_UA16, R_SPARC_UA16}
 };
 
 static reloc_howto_type *
diff -u -r binutils-2.10.1/gas/config/tc-sparc.c 
../../binutils-2.10.1/gas/config/tc-sparc.c
--- binutils-2.10.1/gas/config/tc-sparc.c       Wed Apr  5 11:36:19 2000
+++ ../../binutils-2.10.1/gas/config/tc-sparc.c Fri Dec 29 19:03:25 2000
@@ -235,6 +235,7 @@
   /* This exists to allow configure.in/Makefile.in to pass one
      value to specify both the default machine and default word size.  */
   { "v9-64", "v9", v9, 64, 0 },
+  { "v9a-64", "v9a", v9, 64, 0 },
   { NULL, NULL, v8, 0, 0 }
 };
 
@@ -338,7 +339,7 @@
  *             complicated gcc's ASM_SPECs, so now opcode selection is
  *             specified orthogonally to word size (except when specifying
  *             the default, but that is an internal implementation detail).
- *     -xarch=v8plus, -xarch=v8plusa
+ *     -xarch=v8plus, -xarch=v8plusa, -xarch=v9, -xarch=v9a
  *             Same as -Av8plus{,a}, for compatibility with Sun's assembler.
  *
  *             Select the architecture and possibly the file format.
@@ -437,15 +438,70 @@
       break;
 
     case OPTION_XARCH:
-      /* This is for compatibility with Sun's assembler.  */
-      if (strcmp (arg, "v8plus") != 0
-         && strcmp (arg, "v8plusa") != 0)
-       {
-         as_bad (_("invalid architecture -xarch=%s"), arg);
-         return 0;
-       }
+      {
+       struct sparc_arch *sa;
+       enum sparc_opcode_arch_val opcode_arch;
+       const char **list, **l;
 
-      /* fall through */
+        /* This is for compatibility with Sun's assembler.  */
+        if (strcmp (arg, "v8plus") != 0
+           && strcmp (arg, "v8plusa") != 0
+           && strcmp (arg, "v9") != 0
+           && strcmp (arg, "v9a") != 0)
+         {
+           as_bad (_("invalid architecture -xarch=%s"), arg);
+           return 0;
+         }
+
+       if (strcmp (arg, "v9") == 0)
+         {
+           sa = lookup_arch ("v9-64");
+           sparc_arch_size = 64;
+         }
+        else if (strcmp (arg, "v9a") == 0)
+         {
+           sa = lookup_arch ("v9a-64");
+           sparc_arch_size = 64;
+         }
+       else
+         {
+           sa = lookup_arch (arg);
+           sparc_arch_size = 32;
+          }
+
+       if (sa == NULL)
+         {
+           as_bad (_("invalid architecture -xarch=%s"), arg);
+           return 0;
+         }
+
+       opcode_arch = sparc_opcode_lookup_arch (sa->opcode_arch);
+       if (opcode_arch == SPARC_OPCODE_ARCH_BAD)
+         as_fatal (_("Bad opcode table, broken assembler."));
+
+       max_architecture = opcode_arch;
+       architecture_requested = 1;
+
+       list = bfd_target_list ();
+       for (l = list; *l != NULL; l++)
+         {
+           if (sparc_arch_size == 32)
+             {
+               if (strcmp (*l, "elf32-sparc") == 0)
+                 break;
+             }
+           else
+             {
+               if (strcmp (*l, "elf64-sparc") == 0)
+                 break;
+             }
+         }
+       if (*l == NULL)
+         as_fatal (_("No compiled in support for %d bit object file format"),
+                   sparc_arch_size);
+       free (list);
+      }
+      break;
 
     case 'A':
       {
@@ -600,7 +656,7 @@
       if (arch->user_option_p)
        fprintf (stream, "-A%s", arch->name);
     }
-  fprintf (stream, _("\n-xarch=v8plus | -xarch=v8plusa\n"));
+  fprintf (stream, _("\n-xarch=v8plus | -xarch=v8plusa | -xarch=v9 | 
-xarch=v9a\n"));
   fprintf (stream, _("\
                        specify variant of SPARC architecture\n\
 -bump                  warn when assembler switches architectures\n\
@@ -2086,7 +2142,7 @@
                      { "l44", 3, BFD_RELOC_SPARC_L44, 1, 0 },
                      { "uhi", 3, BFD_RELOC_SPARC_HH22, 1, 0 },
                      { "ulo", 3, BFD_RELOC_SPARC_HM10, 1, 0 },
-                     { NULL }
+                     { NULL, 0, 0, 0, 0 }
                    };
                    const struct ops *o;
   
@@ -2877,16 +2933,19 @@
 
   /* If this is a data relocation, just output VAL.  */
 
-  if (fixP->fx_r_type == BFD_RELOC_16)
+  if (fixP->fx_r_type == BFD_RELOC_16
+      || fixP->fx_r_type == BFD_RELOC_SPARC_UA16)
     {
       md_number_to_chars (buf, val, 2);
     }
   else if (fixP->fx_r_type == BFD_RELOC_32
+          || fixP->fx_r_type == BFD_RELOC_SPARC_UA32
           || fixP->fx_r_type == BFD_RELOC_SPARC_REV32)
     {
       md_number_to_chars (buf, val, 4);
     }
-  else if (fixP->fx_r_type == BFD_RELOC_64)
+  else if (fixP->fx_r_type == BFD_RELOC_64
+          || fixP->fx_r_type == BFD_RELOC_SPARC_UA64)
     {
       md_number_to_chars (buf, val, 8);
     }
@@ -3139,6 +3198,9 @@
     case BFD_RELOC_SPARC_OLO10:
     case BFD_RELOC_VTABLE_ENTRY:
     case BFD_RELOC_VTABLE_INHERIT:
+    case BFD_RELOC_SPARC_UA32:
+    case BFD_RELOC_SPARC_UA64:
+    case BFD_RELOC_SPARC_UA16:
       code = fixp->fx_r_type;
       break;
     default:
@@ -3730,6 +3792,7 @@
   /* Tell sparc_cons_align not to align this value.  */
   sparc_no_align_cons = 1;
   cons (bytes);
+  sparc_no_align_cons = 0;
 }
 
 /* This handles the native word allocation pseudo-op .nword.
@@ -3883,11 +3946,7 @@
     return;
 
   if (sparc_no_align_cons)
-    {
-      /* This is an unaligned pseudo-op.  */
-      sparc_no_align_cons = 0;
-      return;
-    }
+    return;
 
   nalign = log2 (nbytes);
   if (nalign == 0)
@@ -3992,9 +4051,18 @@
 {
   bfd_reloc_code_real_type r;
 
-  r = (nbytes == 1 ? BFD_RELOC_8 :
-       (nbytes == 2 ? BFD_RELOC_16 :
-       (nbytes == 4 ? BFD_RELOC_32 : BFD_RELOC_64)));
+  if (sparc_no_align_cons)
+    {
+      r = (nbytes == 1 ? BFD_RELOC_8 :
+           (nbytes == 2 ? BFD_RELOC_SPARC_UA16 :
+           (nbytes == 4 ? BFD_RELOC_SPARC_UA32 : BFD_RELOC_SPARC_UA64)));
+    }
+  else
+    {
+      r = (nbytes == 1 ? BFD_RELOC_8 :
+           (nbytes == 2 ? BFD_RELOC_16 :
+           (nbytes == 4 ? BFD_RELOC_32 : BFD_RELOC_64)));
+    }
 
   if (target_little_endian_data && nbytes == 4
       && now_seg->flags & SEC_ALLOC)  
diff -u -r binutils-2.10.1/gas/write.c ../../binutils-2.10.1/gas/write.c
--- binutils-2.10.1/gas/write.c Sun Sep 12 05:44:41 1999
+++ ../../binutils-2.10.1/gas/write.c   Fri Dec 29 18:53:31 2000
@@ -1035,8 +1035,8 @@
                            _("relocation overflow"));
              break;
            default:
-             as_fatal (_("%s:%u: bad return from bfd_install_relocation"),
-                       fixp->fx_file, fixp->fx_line);
+             as_fatal (_("%s:%u: bad return from bfd_install_relocation: %x"),
+                       fixp->fx_file, fixp->fx_line, s);
            }
         }
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]