]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gas/config/tc-s390.c
2.41 Release sources
[thirdparty/binutils-gdb.git] / gas / config / tc-s390.c
index 4af635beac34804b0d3f21f7b10eb4b681296ad6..955851946f9c1a0335f9bd548ffc38d816fc881b 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-s390.c -- Assemble for the S390
-   Copyright (C) 2000-2022 Free Software Foundation, Inc.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
    This file is part of GAS, the GNU Assembler.
@@ -584,7 +584,7 @@ md_begin (void)
 
 /* Called after all assembly has been done.  */
 void
-s390_md_end (void)
+s390_md_finish (void)
 {
   if (s390_arch_size == 64)
     bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_64);
@@ -617,20 +617,20 @@ s390_insert_operand (unsigned char *insn,
       if (val < min || val > max)
        {
          const char *err =
-           _("operand out of range (%s not between %ld and %ld)");
-         char buf[100];
+           _("operand out of range (%" PRId64 " not between %" PRId64
+             " and %" PRId64 ")");
 
          if (operand->flags & S390_OPERAND_PCREL)
            {
-             val <<= 1;
-             min <<= 1;
-             max <<= 1;
+             val = (offsetT) ((addressT) val << 1);
+             min = (offsetT) ((addressT) min << 1);
+             max = (offsetT) ((addressT) max << 1);
            }
-         bfd_sprintf_vma (stdoutput, buf, val);
          if (file == (char *) NULL)
-           as_bad (err, buf, (int) min, (int) max);
+           as_bad (err, (int64_t) val, (int64_t) min, (int64_t) max);
          else
-           as_bad_where (file, line, err, buf, (int) min, (int) max);
+           as_bad_where (file, line,
+                         err, (int64_t) val, (int64_t) min, (int64_t) max);
          return;
        }
       /* val is ok, now restrict it to operand->bits bits.  */
@@ -1308,7 +1308,10 @@ md_gather_operands (char *str,
 
       /* Parse the operand.  */
       if (! register_name (&ex))
-       expression (&ex);
+       {
+         expression (&ex);
+         resolve_register (&ex);
+       }
 
       str = input_line_pointer;
       input_line_pointer = hold;
@@ -1619,6 +1622,7 @@ md_gather_operands (char *str,
      md_apply_fix.  */
   for (i = 0; i < fc; i++)
     {
+      fixS *fixP;
 
       if (fixups[i].opindex < 0)
        {
@@ -1633,7 +1637,6 @@ md_gather_operands (char *str,
       if (fixups[i].reloc != BFD_RELOC_UNUSED)
        {
          reloc_howto_type *reloc_howto;
-         fixS *fixP;
          int size;
 
          reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
@@ -1661,10 +1664,14 @@ md_gather_operands (char *str,
            fixP->fx_pcrel_adjust = operand->shift / 8;
        }
       else
-       fix_new_exp (frag_now, f - frag_now->fr_literal, 4, &fixups[i].exp,
-                    (operand->flags & S390_OPERAND_PCREL) != 0,
-                    ((bfd_reloc_code_real_type)
-                     (fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
+       fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
+                           &fixups[i].exp,
+                           (operand->flags & S390_OPERAND_PCREL) != 0,
+                           ((bfd_reloc_code_real_type)
+                            (fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
+      /* s390_insert_operand () does the range checking.  */
+      if (operand->flags & S390_OPERAND_PCREL)
+       fixP->fx_no_overflow = 1;
     }
   return str;
 }