This is the mail archive of the binutils@sourceware.org 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]

patches for Irix binutils 2.18


These small reasonable patches let you build binutils 2.18 with Irix's /usr/WorkShop/usr/bin/ncc, which is an old EDG compiler, and which seems to come with the system "for no additional cost".


specifically:
  no C++ comments
  no free cast from non-void* to other non-void* -- go through void* or cast to the correct type
   These patches are applied by some Python code, so lack context, so just use the lazy void*.
   I realize using the right type might be preferred, like for C++ compati.


gas works (and is required by gcc 4.3.2) 


cross GNU ld (which doesn't need these patches) fails to find libc.a -- yes, I think I have an ok sysroot.
 If you point cross GNU ld at the libc.a directly, or if you just let native GNU ld run -- it finds it --
  you hit an assertion failure. I'll look into that /much/ later. Meantime, I can build gcc with ncc and GNU as.


Well, it isn't finished yet, but it is far along.



diff -ru binutils-2.18.orig/gas/bfin-parse.c binutils-2.18/gas/bfin-parse.c
--- binutils-2.18.orig/gas/bfin-parse.c 2007-08-06 13:39:29.000000000 -0700
+++ binutils-2.18/gas/bfin-parse.c      2008-10-19 06:10:04.578125000 -0700
@@ -424,7 +424,7 @@
 #include "as.h"
 #include 

-#include "bfin-aux.h"  // opcode generating auxiliaries
+#include "bfin-aux.h"  /* opcode generating auxiliaries */
 #include "libbfd.h"
 #include "elf/common.h"
 #include "elf/bfin.h"
diff -ru binutils-2.18.orig/gas/config/tc-bfin.c binutils-2.18/gas/config/tc-bfin.c
--- binutils-2.18.orig/gas/config/tc-bfin.c     2007-08-06 12:59:55.000000000 -0700
+++ binutils-2.18/gas/config/tc-bfin.c  2008-10-19 06:10:19.500000000 -0700
@@ -1488,14 +1488,14 @@
     {
       int value, offset;
       switch (sz)
-       {                               // load/store access size
-       case 0:                 // 32 bit
+       {                               /* load/store access size */
+       case 0:                 /* 32 bit */
          value = EXPR_VALUE (poffset)>> 2;
          break;
-       case 1:                 // 16 bit
+       case 1:                 /* 16 bit */
          value = EXPR_VALUE (poffset)>> 1;
          break;
-       case 2:                 // 8 bit
+       case 2:                 /* 8 bit */
          value = EXPR_VALUE (poffset);
          break;
        default:
diff -ru binutils-2.18.orig/gas/config/tc-cr16.c binutils-2.18/gas/config/tc-cr16.c
--- binutils-2.18.orig/gas/config/tc-cr16.c     2007-07-03 04:01:04.000000000 -0700
+++ binutils-2.18/gas/config/tc-cr16.c  2008-10-19 06:10:19.531250000 -0700
@@ -1733,10 +1733,10 @@
        {
          if (instruction->size == 2)
            {
-             CR16_PRINT (0, ((constant)&0xf), shift);         // 0-3 bits
-             CR16_PRINT (0, ((constant>>4)&0x3), (shift+20)); // 4-5 bits
-             CR16_PRINT (0, ((constant>>6)&0x3), (shift+14)); // 6-7 bits
-             CR16_PRINT (0, ((constant>>8)&0x3f), (shift+8)); // 8-13 bits
+             CR16_PRINT (0, ((constant)&0xf), shift);         /* 0-3 bits */
+             CR16_PRINT (0, ((constant>>4)&0x3), (shift+20)); /* 4-5 bits */
+             CR16_PRINT (0, ((constant>>6)&0x3), (shift+14)); /* 6-7 bits */
+             CR16_PRINT (0, ((constant>>8)&0x3f), (shift+8)); /* 8-13 bits */
            }
          else
            CR16_PRINT (0, constant, shift);
diff -ru binutils-2.18.orig/gas/config/tc-hppa.c binutils-2.18/gas/config/tc-hppa.c
--- binutils-2.18.orig/gas/config/tc-hppa.c     2007-08-06 12:59:57.000000000 -0700
+++ binutils-2.18/gas/config/tc-hppa.c  2008-10-19 06:10:19.812500000 -0700
@@ -1211,7 +1211,7 @@
              int unwind_bits ATTRIBUTE_UNUSED)
 {
   fixS *new_fix;
-  struct hppa_fix_struct *hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+  struct hppa_fix_struct *hppa_fix = (void *) obstack_alloc (&notes, sizeof (struct hppa_fix_struct));

   if (exp != NULL)
     new_fix = fix_new_exp (frag, where, size, exp, pcrel, r_type);
@@ -8568,7 +8568,7 @@

   if (new_fix)
     {
-      struct hppa_fix_struct * hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+      struct hppa_fix_struct * hppa_fix = (void *) obstack_alloc (&notes, sizeof (struct hppa_fix_struct));

       hppa_fix->fx_r_type = R_HPPA;
       hppa_fix->fx_r_field = e_fsel;
@@ -8589,7 +8589,7 @@

   if (new_fix)
     {
-      struct hppa_fix_struct * hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+      struct hppa_fix_struct * hppa_fix = (void *) obstack_alloc (&notes, sizeof (struct hppa_fix_struct));

       hppa_fix->fx_r_type = R_HPPA;
       hppa_fix->fx_r_field = e_fsel;
diff -ru binutils-2.18.orig/gas/config/tc-ia64.c binutils-2.18/gas/config/tc-ia64.c
--- binutils-2.18.orig/gas/config/tc-ia64.c     2007-08-06 12:59:58.000000000 -0700
+++ binutils-2.18/gas/config/tc-ia64.c  2008-10-19 06:10:20.093750000 -0700
@@ -4865,11 +4865,11 @@

       if (!*drpp)
        {
-         *drpp = obstack_alloc (&notes, sizeof (*dr));
+         *drpp = (void *) obstack_alloc (&notes, sizeof (*dr));
          memset (*drpp, 0, sizeof (*dr));
        }

-      name = obstack_alloc (&notes, len + 1);
+      name = (void *) obstack_alloc (&notes, len + 1);
       memcpy (name, start, len);
       name[len] = '\0';

@@ -7913,7 +7913,7 @@
      labels.  */
   if (defining_tag)
     {
-      fix = obstack_alloc (&notes, sizeof (*fix));
+      fix = (void *) obstack_alloc (&notes, sizeof (*fix));
       fix->sym = sym;
       fix->next = CURR_SLOT.tag_fixups;
       fix->dw2_mark_labels = FALSE;
@@ -7925,7 +7925,7 @@
   if (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE)
     {
       md.last_text_seg = now_seg;
-      fix = obstack_alloc (&notes, sizeof (*fix));
+      fix = (void *) obstack_alloc (&notes, sizeof (*fix));
       fix->sym = sym;
       fix->next = CURR_SLOT.label_fixups;
       fix->dw2_mark_labels = dwarf2_loc_mark_labels;
diff -ru binutils-2.18.orig/gas/config/tc-m68k.c binutils-2.18/gas/config/tc-m68k.c
--- binutils-2.18.orig/gas/config/tc-m68k.c     2007-08-06 13:00:00.000000000 -0700
+++ binutils-2.18/gas/config/tc-m68k.c  2008-10-19 06:10:20.312500000 -0700
@@ -4414,7 +4414,7 @@
          if (i + 1 != m68k_numopcodes
              && !strcmp (ins->name, m68k_sorted_opcodes[i + 1]->name))
            {
-             slak->m_next = obstack_alloc (&robyn, sizeof (struct m68k_incant));
+             slak->m_next = (void *) obstack_alloc (&robyn, sizeof (struct m68k_incant));
              i++;
            }
          else
@@ -4531,7 +4531,7 @@

     while (mote_pseudo_table[n].poc_name)
       {
-       hack = obstack_alloc (&robyn, sizeof (struct m68k_incant));
+       hack = (void *) obstack_alloc (&robyn, sizeof (struct m68k_incant));
        hash_insert (op_hash,
                     mote_pseudo_table[n].poc_name, (char *) hack);
        hack->m_operands = 0;
@@ -6177,8 +6177,8 @@
     case MCC ('g', 't'): return MCC ('l', 't');
     case MCC ('l', 'e'): return MCC ('g', 'e');
     /* Issue a warning for conditions we can not swap.  */
-    case MCC ('n', 'e'): return MCC ('n', 'e'); // no problem here
-    case MCC ('e', 'q'): return MCC ('e', 'q'); // also no problem
+    case MCC ('n', 'e'): return MCC ('n', 'e'); /* no problem here */
+    case MCC ('e', 'q'): return MCC ('e', 'q'); /* also no problem */
     case MCC ('v', 'c'):
     case MCC ('v', 's'):
     default :
diff -ru binutils-2.18.orig/gas/config/tc-mips.c binutils-2.18/gas/config/tc-mips.c
--- binutils-2.18.orig/gas/config/tc-mips.c     2007-08-06 13:00:02.000000000 -0700
+++ binutils-2.18/gas/config/tc-mips.c  2008-10-19 06:10:20.609375000 -0700
@@ -1823,17 +1823,17 @@
      helps us detect invalid uses of them.  */
   for (i = 0; reg_names[i].name; i++)
     symbol_table_insert (symbol_new (reg_names[i].name, reg_section,
-                                    reg_names[i].num, // & RNUM_MASK,
+                                    reg_names[i].num, /* & RNUM_MASK, */
                                     &zero_address_frag));
   if (HAVE_NEWABI)
     for (i = 0; reg_names_n32n64[i].name; i++)
       symbol_table_insert (symbol_new (reg_names_n32n64[i].name, reg_section,
-                                      reg_names_n32n64[i].num, // & RNUM_MASK,
+                                      reg_names_n32n64[i].num, /* & RNUM_MASK, */
                                       &zero_address_frag));
   else
     for (i = 0; reg_names_o32[i].name; i++)
       symbol_table_insert (symbol_new (reg_names_o32[i].name, reg_section,
-                                      reg_names_o32[i].num, // & RNUM_MASK,
+                                      reg_names_o32[i].num, /* & RNUM_MASK, */
                                       &zero_address_frag));

   mips_no_prev_insn ();
diff -ru binutils-2.18.orig/gas/config/tc-score.c binutils-2.18/gas/config/tc-score.c
--- binutils-2.18.orig/gas/config/tc-score.c    2007-08-06 13:00:04.000000000 -0700
+++ binutils-2.18/gas/config/tc-score.c 2008-10-19 06:10:21.000000000 -0700
@@ -4626,8 +4626,8 @@
       unsigned len = strlen (insn->template);
       struct asm_opcode *new;
       char *template;
-      new = obstack_alloc (&insn_obstack, sizeof (struct asm_opcode));
-      template = obstack_alloc (&insn_obstack, len + 1);
+      new = (void *) obstack_alloc (&insn_obstack, sizeof (struct asm_opcode));
+      template = (void *) obstack_alloc (&insn_obstack, len + 1);

       strcpy (template, insn->template);
       new->template = template;
@@ -4653,8 +4653,8 @@
       unsigned len = strlen (tmp->insn_name);
       struct insn_to_dependency *new;

-      new = obstack_alloc (&dependency_obstack, sizeof (struct insn_to_dependency));
-      new->insn_name = obstack_alloc (&dependency_obstack, len + 1);
+      new = (void *) obstack_alloc (&dependency_obstack, sizeof (struct insn_to_dependency));
+      new->insn_name = (void *) obstack_alloc (&dependency_obstack, len + 1);

       strcpy (new->insn_name, tmp->insn_name);
       new->type = tmp->type;
diff -ru binutils-2.18.orig/gas/hash.c binutils-2.18/gas/hash.c
--- binutils-2.18.orig/gas/hash.c       2007-08-06 12:59:51.000000000 -0700
+++ binutils-2.18/gas/hash.c    2008-10-19 06:10:04.937500000 -0700
@@ -116,7 +116,7 @@
   ret = xmalloc (sizeof *ret);
   obstack_begin (&ret->memory, chunksize);
   alloc = size * sizeof (struct hash_entry *);
-  ret->table = obstack_alloc (&ret->memory, alloc);
+  ret->table = (void *) obstack_alloc (&ret->memory, alloc);
   memset (ret->table, 0, alloc);
   ret->size = size;

diff -ru binutils-2.18.orig/gas/subsegs.c binutils-2.18/gas/subsegs.c
--- binutils-2.18.orig/gas/subsegs.c    2007-08-06 12:59:51.000000000 -0700
+++ binutils-2.18/gas/subsegs.c 2008-10-19 06:10:05.171875000 -0700
@@ -103,7 +103,7 @@
     {
       /* This should be the only code that creates a frchainS.  */

-      newP = obstack_alloc (&frchains, sizeof (frchainS));
+      newP = (void *) obstack_alloc (&frchains, sizeof (frchainS));
       newP->frch_subseg = subseg;
       newP->fix_root = NULL;
       newP->fix_tail = NULL;
diff -ru binutils-2.18.orig/gas/symbols.c binutils-2.18/gas/symbols.c
--- binutils-2.18.orig/gas/symbols.c    2007-08-06 12:59:51.000000000 -0700
+++ binutils-2.18/gas/symbols.c 2008-10-19 06:10:05.218750000 -0700
@@ -563,7 +563,7 @@
     orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP);
   bsymorg = orgsymP->bsym;

-  newsymP = obstack_alloc (&notes, sizeof (*newsymP));
+  newsymP = (void *) obstack_alloc (&notes, sizeof (*newsymP));
   *newsymP = *orgsymP;
   bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg));
   if (bsymnew == NULL)
@@ -1880,7 +1880,7 @@
     instance_number = (10 * instance_number) + *p - '0';

   message_format = _("\"%d\" (instance number %d of a %s label)");
-  symbol_decode = obstack_alloc (&notes, strlen (message_format) + 30);
+  symbol_decode = (void *) obstack_alloc (&notes, strlen (message_format) + 30);
   sprintf (symbol_decode, message_format, label_number, instance_number, type);

   return symbol_decode;
diff -ru binutils-2.18.orig/gas/write.c binutils-2.18/gas/write.c
--- binutils-2.18.orig/gas/write.c      2007-08-06 12:59:51.000000000 -0700
+++ binutils-2.18/gas/write.c   2008-10-19 06:10:05.281250000 -0700
@@ -148,7 +148,7 @@

   n_fixups++;

-  fixP = obstack_alloc (&notes, sizeof (fixS));
+  fixP = (void *) obstack_alloc (&notes, sizeof (fixS));

   fixP->fx_frag = frag;
   fixP->fx_where = where;
diff -ru binutils-2.18.orig/ld/ldlang.c binutils-2.18/ld/ldlang.c
--- binutils-2.18.orig/ld/ldlang.c      2007-08-06 13:00:21.000000000 -0700
+++ binutils-2.18/ld/ldlang.c   2008-10-19 06:10:11.625000000 -0700
@@ -1851,7 +1851,7 @@
       else if  (!ud->map_symbol_def_tail)
        ud->map_symbol_def_tail = &ud->map_symbol_def_head;

-      def = obstack_alloc (&map_obstack, sizeof *def);
+      def = (void *) obstack_alloc (&map_obstack, sizeof *def);
       def->entry = hash_entry;
       *(ud->map_symbol_def_tail) = def;
       ud->map_symbol_def_tail = &def->next;


Thanks,
 - Jay

Attachment: diff2.txt
Description: Text document


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