* tc_mips.h (MAX_GPREL_OFFSET): Change it to the maximum allowed
[deliverable/binutils-gdb.git] / gas / config / tc-s390.c
index 4f012778f512757f878ddd7bef5e6bde7a24225d..42bb2643b780178e761e1f6c70a7c0ba6b18f498 100644 (file)
@@ -80,7 +80,7 @@ const pseudo_typeS md_pseudo_table[] =
 {
   { "align", s_align_bytes, 0 },
   /* Pseudo-ops which must be defined. */
-  { "bss",      s390_bss,       0 }, 
+  { "bss",      s390_bss,       0 },
   { "insn",     s390_insn,      0 },
   /* Pseudo-ops which must be overridden.  */
   { "byte",    s390_byte,      0 },
@@ -157,21 +157,21 @@ static const struct pd_reg pre_defined_registers[] =
   { "c9", 9 },
 
   { "f0", 0 },     /* Floating point registers */
-  { "f1", 1 }, 
-  { "f10", 10 }, 
-  { "f11", 11 }, 
-  { "f12", 12 }, 
-  { "f13", 13 }, 
-  { "f14", 14 }, 
-  { "f15", 15 }, 
-  { "f2", 2 }, 
-  { "f3", 3 }, 
-  { "f4", 4 }, 
-  { "f5", 5 }, 
-  { "f6", 6 }, 
-  { "f7", 7 }, 
-  { "f8", 8 }, 
-  { "f9", 9 }, 
+  { "f1", 1 },
+  { "f10", 10 },
+  { "f11", 11 },
+  { "f12", 12 },
+  { "f13", 13 },
+  { "f14", 14 },
+  { "f15", 15 },
+  { "f2", 2 },
+  { "f3", 3 },
+  { "f4", 4 },
+  { "f5", 5 },
+  { "f6", 6 },
+  { "f7", 7 },
+  { "f8", 8 },
+  { "f9", 9 },
 
   { "lit", 13 },   /* Pointer to literal pool */
 
@@ -196,7 +196,7 @@ static const struct pd_reg pre_defined_registers[] =
 
 };
 
-#define REG_NAME_CNT (sizeof(pre_defined_registers) / sizeof(struct pd_reg))
+#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct pd_reg))
 
 /* Given NAME, find the register number associated with that name, return
    the integer value associated with the given name or -1 on failure.  */
@@ -251,7 +251,7 @@ register_name (expressionP)
   char *start;
   char c;
 
-  /* Find the spelling of the operand */
+  /* Find the spelling of the operand */
   start = name = input_line_pointer;
   if (name[0] == '%' && isalpha (name[1]))
     name = ++input_line_pointer;
@@ -261,25 +261,24 @@ register_name (expressionP)
   c = get_symbol_end ();
   reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
 
-  /* look to see if it's in the register table */
-  if (reg_number >= 0) 
+  /* Put back the delimiting char.  */
+  *input_line_pointer = c;
+
+  /* Look to see if it's in the register table.  */
+  if (reg_number >= 0)
     {
       expressionP->X_op = O_register;
       expressionP->X_add_number = reg_number;
-      
-      /* make the rest nice */
+
+      /* Make the rest nice.  */
       expressionP->X_add_symbol = NULL;
       expressionP->X_op_symbol = NULL;
-      *input_line_pointer = c;   /* put back the delimiting char */
       return true;
     }
-  else
-    {
-      /* reset the line as if we had not done anything */
-      *input_line_pointer = c;   /* put back the delimiting char */
-      input_line_pointer = start; /* reset input_line pointer */
-      return false;
-    }
+
+  /* Reset the line as if we had not done anything.  */
+  input_line_pointer = start;
+  return false;
 }
 
 /* Local variables.  */
@@ -304,7 +303,7 @@ CONST char *md_shortopts = "A:m:kVQ:";
 struct option md_longopts[] = {
   {NULL, no_argument, NULL, 0}
 };
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
 
 /* Initialize the default opcode arch and word size from the default
    architecture name.  */
@@ -314,12 +313,12 @@ init_default_arch ()
   if (current_arch_requested)
     return;
 
-  if (strcmp(default_arch, "s390") == 0)
+  if (strcmp (default_arch, "s390") == 0)
     {
       s390_arch_size = 32;
       current_architecture = S390_OPCODE_ESA;
     }
-  else if (strcmp(default_arch, "s390x") == 0)
+  else if (strcmp (default_arch, "s390x") == 0)
     {
       s390_arch_size = 64;
       current_architecture = S390_OPCODE_ESAME;
@@ -354,17 +353,17 @@ md_parse_option (c, arg)
     case 'm':
       if (arg != NULL && strcmp (arg, "regnames") == 0)
        reg_names_p = true;
-    
+
       else if (arg != NULL && strcmp (arg, "no-regnames") == 0)
        reg_names_p = false;
-    
+
       else
        {
          as_bad (_("invalid switch -m%s"), arg);
          return 0;
        }
       break;
-    
+
     case 'A':
       if (arg != NULL && strcmp (arg, "esa") == 0)
        {
@@ -386,16 +385,16 @@ md_parse_option (c, arg)
     case 'V':
       print_version_id ();
       break;
-    
+
       /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
         should be emitted or not.  FIXME: Not implemented.  */
     case 'Q':
       break;
-      
+
     default:
       return 0;
     }
-  
+
   return 1;
 }
 
@@ -484,7 +483,7 @@ s390_align_code (fragP, count)
   /* We use nop pattern 0x0707.  */
   if (count > 0)
     {
-      memset(fragP->fr_literal + fragP->fr_fix, 0x07, count);
+      memset (fragP->fr_literal + fragP->fr_fix, 0x07, count);
       fragP->fr_var = count;
     }
 }
@@ -537,7 +536,7 @@ s390_insert_operand (insn, operand, val, file, line)
   else
     {
       addressT min, max;
-      
+
       max = (((addressT) 1 << (operand->bits - 1))<<1) - 1;
       min = (offsetT) 0;
       uval = (addressT) val;
@@ -550,7 +549,7 @@ s390_insert_operand (insn, operand, val, file, line)
          const char *err =
            "operand out of range (%s not between %ld and %ld)";
          char buf[100];
-    
+
          if (operand->flags & S390_OPERAND_LENGTH)
            {
              uval++;
@@ -618,13 +617,13 @@ s390_elf_suffix (str_p, exp_p)
     return ELF_SUFFIX_NONE;
 
   ident = str;
-  while (isalnum(*str))
+  while (isalnum (*str))
     str++;
   len = str - ident;
 
   for (ptr = &mapping[0]; ptr->length > 0; ptr++)
     if (len == ptr->length &&
-       strncasecmp(ident, ptr->string, ptr->length) == 0)
+       strncasecmp (ident, ptr->string, ptr->length) == 0)
       {
        if (exp_p->X_add_number != 0)
          as_warn (_("identifier+constant@%s means identifier@%s+constant"),
@@ -710,7 +709,7 @@ s390_exp_compare(exp1, exp2)
       return exp1->X_add_number == exp2->X_add_number;
 
     case O_big:
-      as_bad(_("Can't handle O_big in s390_exp_compare")); 
+      as_bad (_("Can't handle O_big in s390_exp_compare"));
 
     case O_symbol:     /* X_add_symbol & X_add_number must be equal.  */
     case O_symbol_rva:
@@ -764,13 +763,13 @@ s390_lit_suffix (str_p, exp_p, suffix)
 
   if (*str++ != ':')
     return suffix;       /* No modification.  */
+
   /* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8".  */
   ident = str;
-  while (isalnum(*str))
+  while (isalnum (*str))
     str++;
   len = str - ident;
-  if (len != 4 || strncasecmp(ident, "lit", 3) != 0 ||
+  if (len != 4 || strncasecmp (ident, "lit", 3) != 0 ||
       (ident[3]!='1' && ident[3]!='2' && ident[3]!='4' && ident[3]!='8'))
     return suffix;      /* no modification */
   nbytes = ident[3] - '0';
@@ -838,7 +837,7 @@ s390_lit_suffix (str_p, exp_p, suffix)
        }
       else
        {
-         lpe = (struct s390_lpe *) xmalloc(sizeof(struct s390_lpe));
+         lpe = (struct s390_lpe *) xmalloc(sizeof (struct s390_lpe));
        }
 
       lpe->ex = *exp_p;
@@ -849,7 +848,7 @@ s390_lit_suffix (str_p, exp_p, suffix)
            lpe->floatnum = generic_floating_point_number;
          else if (exp_p->X_add_number <= 4)
            memcpy (lpe->bignum, generic_bignum,
-                   exp_p->X_add_number*sizeof(LITTLENUM_TYPE));
+                   exp_p->X_add_number*sizeof (LITTLENUM_TYPE));
          else
            as_bad (_("Big number is too big"));
        }
@@ -859,12 +858,12 @@ s390_lit_suffix (str_p, exp_p, suffix)
       /* Literal pool name defined ?  */
       if (lp_sym == NULL)
        {
-         sprintf(tmp_name, ".L\001%i", lp_count);
+         sprintf (tmp_name, ".L\001%i", lp_count);
          lp_sym = symbol_make(tmp_name);
        }
 
       /* Make name for literal pool entry.  */
-      sprintf(tmp_name, ".L\001%i\002%i", lp_count, lpe_count);
+      sprintf (tmp_name, ".L\001%i\002%i", lp_count, lpe_count);
       lpe_count++;
       lpe->sym = symbol_make(tmp_name);
 
@@ -878,7 +877,7 @@ s390_lit_suffix (str_p, exp_p, suffix)
       else
        lpe_list = lpe_list_tail = lpe;
     }
-  
+
   /* Now change exp_p to the offset into the literal pool.
      Thats the expression: .L^Ax^By-.L^Ax   */
   exp_p->X_add_symbol = lpe->sym;
@@ -941,10 +940,12 @@ s390_elf_cons (nbytes)
              if (size > nbytes)
                as_bad (_("%s relocations do not fit in %d bytes"),
                        reloc_howto->name, nbytes);
-             where = frag_more(nbytes);
+             where = frag_more (nbytes);
              md_number_to_chars (where, 0, size);
-             fix_new_exp (frag_now, where - frag_now->fr_literal, 
-                          size, &exp, reloc_howto->pc_relative, reloc);
+             /* To make fixup_segment do the pc relative conversion the
+                pcrel parameter on the fix_new_exp call needs to be false.  */
+             fix_new_exp (frag_now, where - frag_now->fr_literal,
+                          size, &exp, false, reloc);
            }
          else
            as_bad (_("relocation not applicable"));
@@ -1002,27 +1003,27 @@ md_gather_operands (str, insn, opcode)
       char *hold;
 
       operand = s390_operands + *opindex_ptr;
-    
+
       if (skip_optional && (operand->flags & S390_OPERAND_INDEX))
        {
          /* We do an early skip. For D(X,B) constructions the index
-            register is skipped (X is optional). For D(L,B) the base  
+            register is skipped (X is optional). For D(L,B) the base
             register will be the skipped operand, because L is NOT
             optional.  */
          skip_optional = 0;
          continue;
        }
-    
+
       /* Gather the operand.  */
       hold = input_line_pointer;
       input_line_pointer = str;
 
       if (! register_name (&ex))    /* parse the operand */
        expression (&ex);
-    
+
       str = input_line_pointer;
       input_line_pointer = hold;
-    
+
       /* Write the operand to the insn.  */
       if (ex.X_op == O_illegal)
        as_bad (_("illegal operand"));
@@ -1046,9 +1047,9 @@ md_gather_operands (str, insn, opcode)
          else
            {
              if ((operand->flags & S390_OPERAND_INDEX) && ex.X_add_number == 0)
-               as_warn("index register specified but zero");
+               as_warn ("index register specified but zero");
              if ((operand->flags & S390_OPERAND_BASE) && ex.X_add_number == 0)
-               as_warn("base register specified but zero");
+               as_warn ("base register specified but zero");
              s390_insert_operand (insn, operand, ex.X_add_number, NULL, 0);
            }
        }
@@ -1096,7 +1097,7 @@ md_gather_operands (str, insn, opcode)
          fixups[fc].reloc = reloc;
          ++fc;
        }
+
       /* Check the next character. The call to expression has advanced
         str past any whitespace.  */
       if (operand->flags & S390_OPERAND_DISP)
@@ -1114,12 +1115,12 @@ md_gather_operands (str, insn, opcode)
              /* Ok, skip all operands until S390_OPERAND_BASE.  */
              while (!(operand->flags & S390_OPERAND_BASE))
                operand = s390_operands + *(++opindex_ptr);
-       
+
              /* If there is a next operand it must be seperated by a comma.  */
              if (opindex_ptr[1] != '\0')
                {
                  if (*str++ != ',')
-                   as_bad(_("syntax error; expected ,"));
+                   as_bad (_("syntax error; expected ,"));
                }
            }
          else
@@ -1171,7 +1172,7 @@ md_gather_operands (str, insn, opcode)
          if (opindex_ptr[1] != '\0')
            {
              if (*str++ != ',')
-               as_bad(_("syntax error; expected ,"));
+               as_bad (_("syntax error; expected ,"));
            }
        }
     }
@@ -1183,7 +1184,7 @@ md_gather_operands (str, insn, opcode)
     {
       char *linefeed;
 
-      if ((linefeed = strchr(str, '\n')) != NULL)
+      if ((linefeed = strchr (str, '\n')) != NULL)
        *linefeed = '\0';
       as_bad (_("junk at end of line: `%s'"), str);
       if (linefeed != NULL)
@@ -1209,18 +1210,18 @@ md_gather_operands (str, insn, opcode)
          reloc_howto_type *reloc_howto;
          fixS *fixP;
          int size;
-      
+
          reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
          if (!reloc_howto)
            abort ();
-      
+
          size = bfd_get_reloc_size (reloc_howto);
 
          if (size < 1 || size > 4)
            abort ();
-      
-         fixP = fix_new_exp (frag_now, 
-                             f - frag_now->fr_literal + (operand->shift/8), 
+
+         fixP = fix_new_exp (frag_now,
+                             f - frag_now->fr_literal + (operand->shift/8),
                              size, &fixups[i].exp, reloc_howto->pc_relative,
                              fixups[i].reloc);
          /* Turn off overflow checking in fixup_segment. This is necessary
@@ -1264,11 +1265,11 @@ md_assemble (str)
     }
   else if (!(opcode->architecture & current_arch_mask))
     {
-      as_bad("Opcode %s not available in this architecture", str);
+      as_bad ("Opcode %s not available in this architecture", str);
       return;
     }
 
-  memcpy (insn, opcode->opcode, sizeof(insn));
+  memcpy (insn, opcode->opcode, sizeof (insn));
   md_gather_operands (s, insn, opcode);
 }
 
@@ -1309,7 +1310,7 @@ s390_bss (ignore)
 /* Pseudo-op handling.  */
 
 void
-s390_insn(ignore)
+s390_insn (ignore)
      int ignore ATTRIBUTE_UNUSED;
 {
   expressionS exp;
@@ -1341,11 +1342,11 @@ s390_insn(ignore)
          (opformat->oplen == 2 && exp.X_op < 0x10000))
        md_number_to_chars (insn, exp.X_add_number, opformat->oplen);
       else
-       as_bad(_("Invalid .insn format\n"));
+       as_bad (_("Invalid .insn format\n"));
     }
   else if (exp.X_op == O_big)
     {
-      if (exp.X_add_number > 0 && 
+      if (exp.X_add_number > 0 &&
          opformat->oplen == 6 &&
          generic_bignum[3] == 0)
        {
@@ -1354,14 +1355,14 @@ s390_insn(ignore)
          md_number_to_chars (&insn[4], generic_bignum[0], 2);
        }
       else
-       as_bad(_("Invalid .insn format\n"));
+       as_bad (_("Invalid .insn format\n"));
     }
   else
     as_bad (_("second operand of .insn not a constant\n"));
   if (*input_line_pointer++ != ',')
     as_bad (_("missing comma after insn constant\n"));
 
-  if ((s = strchr(input_line_pointer, '\n')) != NULL)
+  if ((s = strchr (input_line_pointer, '\n')) != NULL)
     *s = '\0';
   input_line_pointer = md_gather_operands (input_line_pointer, insn, opformat);
   if (s != NULL)
@@ -1405,7 +1406,7 @@ s390_byte (ignore)
 }
 
 /* The .ltorg pseudo-op.This emits all literals defined since the last
-   .ltorg or the invocation of gas. Literals are defined with the 
+   .ltorg or the invocation of gas. Literals are defined with the
    @lit suffix.  */
 
 static void
@@ -1433,7 +1434,7 @@ s390_literals (ignore)
       /* Emit literal pool entry.  */
       if (lpe->reloc != BFD_RELOC_UNUSED)
        {
-         reloc_howto_type *reloc_howto = 
+         reloc_howto_type *reloc_howto =
            bfd_reloc_type_lookup (stdoutput, lpe->reloc);
          int size = bfd_get_reloc_size (reloc_howto);
          char *where;
@@ -1441,7 +1442,7 @@ s390_literals (ignore)
          if (size > lpe->nbytes)
            as_bad (_("%s relocations do not fit in %d bytes"),
                    reloc_howto->name, lpe->nbytes);
-         where = frag_more(lpe->nbytes);
+         where = frag_more (lpe->nbytes);
          md_number_to_chars (where, 0, size);
          fix_new_exp (frag_now, where - frag_now->fr_literal,
                       size, &lpe->ex, reloc_howto->pc_relative, lpe->reloc);
@@ -1454,7 +1455,7 @@ s390_literals (ignore)
                generic_floating_point_number = lpe->floatnum;
              else
                memcpy (generic_bignum, lpe->bignum,
-                       lpe->ex.X_add_number*sizeof(LITTLENUM_TYPE));
+                       lpe->ex.X_add_number*sizeof (LITTLENUM_TYPE));
            }
          emit_expr (&lpe->ex, lpe->nbytes);
        }
@@ -1510,7 +1511,7 @@ md_atof (type, litp, sizep)
       md_number_to_chars (litp, (valueT) words[i], 2);
       litp += 2;
     }
-     
+
   return NULL;
 }
 
@@ -1553,12 +1554,12 @@ md_undefined_symbol (name)
      char *name;
 {
   if (*name == '_' && *(name+1) == 'G'
-      && strcmp(name, "_GLOBAL_OFFSET_TABLE_") == 0)
+      && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
    {
-     if(!GOT_symbol)
+     if (!GOT_symbol)
       {
-        if(symbol_find(name))
-          as_bad(_("GOT already in symbol table"));
+        if (symbol_find (name))
+          as_bad (_("GOT already in symbol table"));
         GOT_symbol = symbol_new (name, undefined_section,
                                  (valueT) 0, &zero_address_frag);
       }
@@ -1648,7 +1649,7 @@ md_apply_fix3 (fixp, valuep, seg)
          && S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
          && ! bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy)))
        value -= S_GET_VALUE (fixp->fx_addsy);
-      
+
       if (fixp->fx_pcrel)
        value += fixp->fx_frag->fr_address + fixp->fx_where;
     }
@@ -1659,10 +1660,10 @@ md_apply_fix3 (fixp, valuep, seg)
     {
       const struct s390_operand *operand;
       int opindex;
-    
+
       opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
       operand = &s390_operands[opindex];
-      
+
       if (fixp->fx_done)
        {
          /* Insert the fully resolved operand value.  */
@@ -1671,7 +1672,7 @@ md_apply_fix3 (fixp, valuep, seg)
 
          return 1;
        }
-    
+
       /* Determine a BFD reloc value based on the operand information.
         We are only prepared to turn a few of the operands into
         relocs.  */
@@ -1718,7 +1719,7 @@ md_apply_fix3 (fixp, valuep, seg)
        {
          char *sfile;
          unsigned int sline;
-      
+
          /* Use expr_symbol_where to see if this is an expression
             symbol.  */
          if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
@@ -1750,9 +1751,9 @@ md_apply_fix3 (fixp, valuep, seg)
              mop = bfd_getb16 ((unsigned char *) where);
              mop |= (unsigned short) (value & 0xfff);
              bfd_putb16 ((bfd_vma) mop, (unsigned char *) where);
-           } 
+           }
          break;
-    
+
        case BFD_RELOC_16:
        case BFD_RELOC_GPREL16:
        case BFD_RELOC_16_GOT_PCREL:
@@ -1809,7 +1810,7 @@ md_apply_fix3 (fixp, valuep, seg)
 
        case BFD_RELOC_32_GOTOFF:
          if (fixp->fx_done)
-           md_number_to_chars (where, value, sizeof(int));
+           md_number_to_chars (where, value, sizeof (int));
          break;
 
        case BFD_RELOC_390_GOT64:
@@ -1841,7 +1842,7 @@ md_apply_fix3 (fixp, valuep, seg)
        default:
          {
            const char *reloc_name = bfd_get_reloc_code_name (fixp->fx_r_type);
-           
+
            if (reloc_name != NULL)
              fprintf (stderr, "Gas failure, reloc type %s\n", reloc_name);
            else
@@ -1895,15 +1896,3 @@ tc_gen_reloc (seg, fixp)
 
   return reloc;
 }
-
-int
-s390_force_relocation (fixp)
-     struct fix * fixp;
-{
-  if (   fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
-      || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
-    return 1;
-
-  return 0;
-}
-
This page took 0.031675 seconds and 4 git commands to generate.