Merge branch 'master' into merge-job
authorJenkins as Icarus Sparry <icarus.sparry@amd.com>
Tue, 7 Jan 2020 15:08:13 +0000 (15:08 +0000)
committerJenkins as Icarus Sparry <icarus.sparry@amd.com>
Tue, 7 Jan 2020 15:08:13 +0000 (15:08 +0000)
60 files changed:
bfd/ChangeLog
bfd/elfnn-riscv.c
bfd/format.c
bfd/mach-o.c
bfd/som.c
bfd/version.h
bfd/vms-alpha.c
cpu/ChangeLog
cpu/m32c.cpu
gas/ChangeLog
gas/config/tc-arc.c
gdb/ChangeLog
gdb/Makefile.in
gdb/NEWS
gdb/cli/cli-cmds.c
gdb/cli/cli-style.c
gdb/coff-pe-read.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/win32-low.c
gdb/gdbsupport/gdb_wait.c [new file with mode: 0644]
gdb/gdbsupport/gdb_wait.h
gdb/source.c
gdb/stack.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/backtrace.c [new file with mode: 0644]
gdb/testsuite/gdb.base/backtrace.exp [new file with mode: 0644]
gdb/tui/tui-disasm.c
gdb/tui/tui-source.c
gdb/windows-nat.c
gdb/windows-tdep.c
include/ChangeLog
include/opcode/arc.h
ld/ChangeLog
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-mips-elf/eh-frame5.s
ld/testsuite/ld-mips-elf/ehdr_start-new.s
ld/testsuite/ld-mips-elf/ehdr_start-o32.s
ld/testsuite/ld-mips-elf/mips16-call-global-1.s
ld/testsuite/ld-mips-elf/mips16-intermix-1.s
ld/testsuite/ld-mips-elf/mips16-pic-1b.s
ld/testsuite/ld-mips-elf/mips16-pic-4c.s
ld/testsuite/ld-mips-elf/no-shared-1-n64.s
ld/testsuite/ld-mips-elf/no-shared-1-o32.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-1b.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-2a.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-5a.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32c.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64c.s
ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32c.s
ld/testsuite/ld-mips-elf/pie.s
ld/testsuite/ld-mips-elf/relax-jalr.s
ld/testsuite/ld-plugin/lto.exp
opcodes/ChangeLog
opcodes/arc-tbl.h
opcodes/m32c-ibld.c
opcodes/z80-dis.c

index 148de794bc44e4803d15fb8451b87d5c692d2cbf..da9260b10539a39c0ce3009270a814bed1cec426 100644 (file)
@@ -1,3 +1,47 @@
+2020-01-06  Jim Wilson  <jimw@sifive.com>
+
+       PR 25205
+       * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
+       check for !bfd_link_pic (info).
+       <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
+       <R_RISCV_JAL>: Add comment.
+       (_bfd_riscv_relax_section): For plt.offset check, add check for
+       bfd_link_pic (info).  Add comment.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * format.c (bfd_check_format_matches): Ignore bfd_error on target
+       match failures.  Don't init to bfd_error_wrong_format before
+       calling _bfd_check_format.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
+       status rather than exiting on stack overflow or underflow.
+       (_bfd_vms_slurp_etir): Adjust to suit.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
+       command.  Check name offset is within command.
+       (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
+       (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
+       (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
+       (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
+       (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
+       (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
+       (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
+       (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
+       (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
+       (bfd_mach_o_read_segment): Similarly.
+       (bfd_mach_o_read_thread): Properly bound check thread struct.
+       Don't repeat checks on second loop.
+       (bfd_mach_o_read_command): Fail on invalid command length.
+
 2020-01-04  Alan Modra  <amodra@gmail.com>
 
        * format.c (bfd_check_format_matches): Add preserve_match.
index d30fc8b66a780b687228b6375dbb057bdde8ffbb..46f0100ace3da966ee94932df17cfc1721266451 100644 (file)
@@ -1987,10 +1987,11 @@ riscv_elf_relocate_section (bfd *output_bfd,
          break;
 
        case R_RISCV_CALL:
+       case R_RISCV_CALL_PLT:
          /* Handle a call to an undefined weak function.  This won't be
             relaxed, so we have to handle it here.  */
          if (h != NULL && h->root.type == bfd_link_hash_undefweak
-             && h->plt.offset == MINUS_ONE)
+             && (!bfd_link_pic (info) || h->plt.offset == MINUS_ONE))
            {
              /* We can use x0 as the base register.  */
              bfd_vma insn = bfd_get_32 (input_bfd,
@@ -2003,9 +2004,9 @@ riscv_elf_relocate_section (bfd *output_bfd,
            }
          /* Fall through.  */
 
-       case R_RISCV_CALL_PLT:
        case R_RISCV_JAL:
        case R_RISCV_RVC_JUMP:
+         /* This line has to match the check in _bfd_riscv_relax_section.  */
          if (bfd_link_pic (info) && h != NULL && h->plt.offset != MINUS_ONE)
            {
              /* Refer to the PLT entry.  */
@@ -4128,7 +4129,9 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
              undefined_weak = TRUE;
            }
 
-         if (h->plt.offset != MINUS_ONE)
+         /* This line has to match the check in riscv_elf_relocate_section
+            in the R_RISCV_CALL[_PLT] case.  */
+         if (bfd_link_pic (info) && h->plt.offset != MINUS_ONE)
            {
              sym_sec = htab->elf.splt;
              symval = h->plt.offset;
index e53955eb45878dda7a1303bd421084490ba4ca2e..a80a175b8ae90b9c377a9f0bd5a3d578c1d36ec0 100644 (file)
@@ -325,12 +325,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
        goto err_ret;
 
-      /* If _bfd_check_format neglects to set bfd_error, assume
-        bfd_error_wrong_format.  We didn't used to even pay any
-        attention to bfd_error, so I suspect that some
-        _bfd_check_format might have this problem.  */
-      bfd_set_error (bfd_error_wrong_format);
-
       temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
       if (temp)
        {
@@ -389,8 +383,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
                goto err_ret;
            }
        }
-      else if (bfd_get_error () != bfd_error_wrong_format)
-       goto err_ret;
     }
 
   if (best_count == 1)
index 3b6fbb57888eec0228af39dc00c9b633d0af3a3e..c1ef64eff015383e321a583532643923ff4bdb7f 100644 (file)
@@ -3998,10 +3998,14 @@ bfd_mach_o_read_dylinker (bfd *abfd, bfd_mach_o_load_command *command)
   unsigned int nameoff;
   unsigned int namelen;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
   nameoff = bfd_h_get_32 (abfd, raw.str);
+  if (nameoff > command->len)
+    return FALSE;
 
   cmd->name_offset = nameoff;
   namelen = command->len - nameoff;
@@ -4024,6 +4028,8 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
   unsigned int nameoff;
   unsigned int namelen;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   switch (command->type)
     {
     case BFD_MACH_O_LC_LOAD_DYLIB:
@@ -4042,6 +4048,8 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
     return FALSE;
 
   nameoff = bfd_h_get_32 (abfd, raw.name);
+  if (nameoff > command->len)
+    return FALSE;
   cmd->timestamp = bfd_h_get_32 (abfd, raw.timestamp);
   cmd->current_version = bfd_h_get_32 (abfd, raw.current_version);
   cmd->compatibility_version = bfd_h_get_32 (abfd, raw.compatibility_version);
@@ -4068,6 +4076,8 @@ bfd_mach_o_read_prebound_dylib (bfd *abfd,
   unsigned int str_len;
   unsigned char *str;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4099,6 +4109,8 @@ bfd_mach_o_read_prebind_cksum (bfd *abfd,
   bfd_mach_o_prebind_cksum_command *cmd = &command->command.prebind_cksum;
   struct mach_o_prebind_cksum_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4113,6 +4125,8 @@ bfd_mach_o_read_twolevel_hints (bfd *abfd,
   bfd_mach_o_twolevel_hints_command *cmd = &command->command.twolevel_hints;
   struct mach_o_twolevel_hints_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4129,10 +4143,14 @@ bfd_mach_o_read_fvmlib (bfd *abfd, bfd_mach_o_load_command *command)
   unsigned int nameoff;
   unsigned int namelen;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
   nameoff = bfd_h_get_32 (abfd, raw.name);
+  if (nameoff > command->len)
+    return FALSE;
   fvm->minor_version = bfd_h_get_32 (abfd, raw.minor_version);
   fvm->header_addr = bfd_h_get_32 (abfd, raw.header_addr);
 
@@ -4155,6 +4173,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
   unsigned int offset;
   unsigned int nflavours;
   unsigned int i;
+  struct mach_o_thread_command_external raw;
 
   BFD_ASSERT ((command->type == BFD_MACH_O_LC_THREAD)
              || (command->type == BFD_MACH_O_LC_UNIXTHREAD));
@@ -4162,24 +4181,27 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
   /* Count the number of threads.  */
   offset = 8;
   nflavours = 0;
-  while (offset != command->len)
+  while (offset + sizeof (raw) <= command->len)
     {
-      struct mach_o_thread_command_external raw;
-
-      if (offset >= command->len)
-       return FALSE;
+      unsigned int count;
 
       if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
          || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
        return FALSE;
 
-      offset += sizeof (raw) + bfd_h_get_32 (abfd, raw.count) * 4;
+      count = bfd_h_get_32 (abfd, raw.count);
+      if (count > (unsigned) -1 / 4
+         || command->len - (offset + sizeof (raw)) < count * 4)
+       return FALSE;
+      offset += sizeof (raw) + count * 4;
       nflavours++;
     }
+  if (nflavours == 0 || offset != command->len)
+    return FALSE;
 
   /* Allocate threads.  */
-  cmd->flavours = bfd_alloc2
-    (abfd, nflavours, sizeof (bfd_mach_o_thread_flavour));
+  cmd->flavours = bfd_alloc2 (abfd, nflavours,
+                             sizeof (bfd_mach_o_thread_flavour));
   if (cmd->flavours == NULL)
     return FALSE;
   cmd->nflavours = nflavours;
@@ -4188,14 +4210,6 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
   nflavours = 0;
   while (offset != command->len)
     {
-      struct mach_o_thread_command_external raw;
-
-      if (offset >= command->len)
-       return FALSE;
-
-      if (nflavours >= cmd->nflavours)
-       return FALSE;
-
       if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
          || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
        return FALSE;
@@ -4271,6 +4285,8 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
   {
     struct mach_o_dysymtab_command_external raw;
 
+    if (command->len < sizeof (raw) + 8)
+      return FALSE;
     if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
       return FALSE;
 
@@ -4447,6 +4463,8 @@ bfd_mach_o_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
 
   BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB);
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4473,6 +4491,8 @@ bfd_mach_o_read_uuid (bfd *abfd, bfd_mach_o_load_command *command)
 
   BFD_ASSERT (command->type == BFD_MACH_O_LC_UUID);
 
+  if (command->len < 16 + 8)
+    return FALSE;
   if (bfd_bread (cmd->uuid, 16, abfd) != 16)
     return FALSE;
 
@@ -4485,6 +4505,8 @@ bfd_mach_o_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_linkedit_command *cmd = &command->command.linkedit;
   struct mach_o_linkedit_data_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4500,10 +4522,15 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
   struct mach_o_str_command_external raw;
   unsigned long off;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
   off = bfd_get_32 (abfd, raw.str);
+  if (off > command->len)
+    return FALSE;
+
   cmd->stroff = command->offset + off;
   cmd->str_len = command->len - off;
   cmd->str = bfd_alloc (abfd, cmd->str_len);
@@ -4586,6 +4613,8 @@ bfd_mach_o_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_dyld_info_command *cmd = &command->command.dyld_info;
   struct mach_o_dyld_info_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4613,6 +4642,8 @@ bfd_mach_o_read_version_min (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_version_min_command *cmd = &command->command.version_min;
   struct mach_o_version_min_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4627,6 +4658,8 @@ bfd_mach_o_read_encryption_info (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_encryption_info_command *cmd = &command->command.encryption_info;
   struct mach_o_encryption_info_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4642,6 +4675,8 @@ bfd_mach_o_read_encryption_info_64 (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_encryption_info_command *cmd = &command->command.encryption_info;
   struct mach_o_encryption_info_64_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4657,6 +4692,8 @@ bfd_mach_o_read_main (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_main_command *cmd = &command->command.main;
   struct mach_o_entry_point_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4672,6 +4709,8 @@ bfd_mach_o_read_source_version (bfd *abfd, bfd_mach_o_load_command *command)
   struct mach_o_source_version_command_external raw;
   bfd_uint64_t ver;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4697,6 +4736,8 @@ bfd_mach_o_read_note (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_note_command *cmd = &command->command.note;
   struct mach_o_note_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4712,6 +4753,8 @@ bfd_mach_o_read_build_version (bfd *abfd, bfd_mach_o_load_command *command)
   bfd_mach_o_build_version_command *cmd = &command->command.build_version;
   struct mach_o_build_version_command_external raw;
 
+  if (command->len < sizeof (raw) + 8)
+    return FALSE;
   if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
     return FALSE;
 
@@ -4736,6 +4779,8 @@ bfd_mach_o_read_segment (bfd *abfd,
 
       BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);
 
+      if (command->len < sizeof (raw) + 8)
+       return FALSE;
       if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
        return FALSE;
 
@@ -4757,6 +4802,8 @@ bfd_mach_o_read_segment (bfd *abfd,
 
       BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
 
+      if (command->len < sizeof (raw) + 8)
+       return FALSE;
       if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
        return FALSE;
 
@@ -4815,9 +4862,11 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
     return FALSE;
 
   cmd = bfd_h_get_32 (abfd, raw.cmd);
-  command->type =  cmd & ~BFD_MACH_O_LC_REQ_DYLD;
+  command->type = cmd & ~BFD_MACH_O_LC_REQ_DYLD;
   command->type_required = cmd & BFD_MACH_O_LC_REQ_DYLD ? TRUE : FALSE;
   command->len = bfd_h_get_32 (abfd, raw.cmdsize);
+  if (command->len < 8 || command->len % 4 != 0)
+    return FALSE;
 
   switch (command->type)
     {
index 954b75213ea59e0c6f719f50f67671fe26854c54..779fd5d3883a1a5c87254bdaae10f5fcebb2d706 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6002,6 +6002,7 @@ som_bfd_fill_in_ar_symbols (bfd *abfd,
       size_t len;
       unsigned char ext_len[4];
       char *name;
+      unsigned int ndx;
 
       /* An empty chain has zero as it's file offset.  */
       hash_val = bfd_getb32 (hash_table + 4 * i);
@@ -6048,9 +6049,14 @@ som_bfd_fill_in_ar_symbols (bfd *abfd,
 
       /* Fill in the file offset.  Note that the "location" field points
         to the SOM itself, not the ar_hdr in front of it.  */
-      set->file_offset =
-       bfd_getb32 (som_dict[bfd_getb32 (lst_symbol.som_index)].location)
-       - sizeof (struct ar_hdr);
+      ndx = bfd_getb32 (lst_symbol.som_index);
+      if (ndx >= lst_header->module_count)
+       {
+         bfd_set_error (bfd_error_bad_value);
+         goto error_return;
+       }
+      set->file_offset
+       = bfd_getb32 (som_dict[ndx].location) - sizeof (struct ar_hdr);
 
       /* Go to the next symbol.  */
       set++;
@@ -6097,9 +6103,14 @@ som_bfd_fill_in_ar_symbols (bfd *abfd,
 
          /* Fill in the file offset.  Note that the "location" field points
             to the SOM itself, not the ar_hdr in front of it.  */
-         set->file_offset =
-           bfd_getb32 (som_dict[bfd_getb32 (lst_symbol.som_index)].location)
-           - sizeof (struct ar_hdr);
+         ndx = bfd_getb32 (lst_symbol.som_index);
+         if (ndx >= lst_header->module_count)
+           {
+             bfd_set_error (bfd_error_bad_value);
+             goto error_return;
+           }
+         set->file_offset
+           = bfd_getb32 (som_dict[ndx].location) - sizeof (struct ar_hdr);
 
          /* Go on to the next symbol.  */
          set++;
index 6c21df174532512c8b0a1429cbb1516512babfe0..7961e2f9d9e2137e29e71d1ee909678bdad00785 100644 (file)
@@ -16,7 +16,7 @@
 
    In releases, the date is not included in either version strings or
    sonames.  */
-#define BFD_VERSION_DATE 20200106
+#define BFD_VERSION_DATE 20200107
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
index c2a17eede3b2f62c15faeb8df7a37c49a6aa70fc..73e728538463e83b08f449a5899def6c4eb0a1b6 100644 (file)
@@ -1456,7 +1456,7 @@ _bfd_vms_slurp_egsd (bfd *abfd)
 
 /* Push value and section index.  */
 
-static void
+static bfd_boolean
 _bfd_vms_push (bfd *abfd, bfd_vma val, unsigned int reloc)
 {
   vms_debug2 ((4, "<push %08lx (0x%08x) at %d>\n",
@@ -1469,26 +1469,28 @@ _bfd_vms_push (bfd *abfd, bfd_vma val, unsigned int reloc)
     {
       bfd_set_error (bfd_error_bad_value);
       _bfd_error_handler (_("stack overflow (%d) in _bfd_vms_push"), PRIV (stackptr));
-      exit (1);
+      return FALSE;
     }
+  return TRUE;
 }
 
 /* Pop value and section index.  */
 
-static void
+static bfd_boolean
 _bfd_vms_pop (bfd *abfd, bfd_vma *val, unsigned int *rel)
 {
   if (PRIV (stackptr) == 0)
     {
       bfd_set_error (bfd_error_bad_value);
       _bfd_error_handler (_("stack underflow in _bfd_vms_pop"));
-      exit (1);
+      return FALSE;
     }
   PRIV (stackptr)--;
   *val = PRIV (stack[PRIV (stackptr)]).value;
   *rel = PRIV (stack[PRIV (stackptr)]).reloc;
 
   vms_debug2 ((4, "<pop %08lx (0x%08x)>\n", (unsigned long)*val, *rel));
+  return TRUE;
 }
 
 /* Routines to fill sections contents during tir/etir read.  */
@@ -1905,7 +1907,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
             stack 32 bit value of symbol (high bits set to 0).  */
        case ETIR__C_STA_GBL:
          _bfd_vms_get_value (abfd, ptr, maxptr, info, &op1, &h);
-         _bfd_vms_push (abfd, op1, alpha_vms_sym_to_ctxt (h));
+         if (!_bfd_vms_push (abfd, op1, alpha_vms_sym_to_ctxt (h)))
+           return FALSE;
          break;
 
          /* Stack longword
@@ -1915,7 +1918,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
        case ETIR__C_STA_LW:
          if (ptr + 4 > maxptr)
            goto corrupt_etir;
-         _bfd_vms_push (abfd, bfd_getl32 (ptr), RELC_NONE);
+         if (!_bfd_vms_push (abfd, bfd_getl32 (ptr), RELC_NONE))
+           return FALSE;
          break;
 
          /* Stack quadword
@@ -1925,7 +1929,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
        case ETIR__C_STA_QW:
          if (ptr + 8 > maxptr)
            goto corrupt_etir;
-         _bfd_vms_push (abfd, bfd_getl64 (ptr), RELC_NONE);
+         if (!_bfd_vms_push (abfd, bfd_getl64 (ptr), RELC_NONE))
+           return FALSE;
          break;
 
          /* Stack psect base plus quadword offset
@@ -1949,7 +1954,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
                return FALSE;
              }
            op1 = bfd_getl64 (ptr + 4);
-           _bfd_vms_push (abfd, op1, psect | RELC_SEC_BASE);
+           if (!_bfd_vms_push (abfd, op1, psect | RELC_SEC_BASE))
+             return FALSE;
          }
          break;
 
@@ -1964,7 +1970,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Store byte: pop stack, write byte
             arg: -.  */
        case ETIR__C_STO_B:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
          image_write_b (abfd, (unsigned int) op1 & 0xff);
@@ -1973,7 +1980,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Store word: pop stack, write word
             arg: -.  */
        case ETIR__C_STO_W:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
          image_write_w (abfd, (unsigned int) op1 & 0xffff);
@@ -1982,7 +1990,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Store longword: pop stack, write longword
             arg: -.  */
        case ETIR__C_STO_LW:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 & RELC_SEC_BASE)
            {
              op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
@@ -2005,7 +2014,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Store quadword: pop stack, write quadword
             arg: -.  */
        case ETIR__C_STO_QW:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 & RELC_SEC_BASE)
            {
              op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
@@ -2032,7 +2042,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
            if (ptr + 4 > maxptr)
              goto corrupt_etir;
            size = bfd_getl32 (ptr);
-           _bfd_vms_pop (abfd, &op1, &rel1);
+           if (!_bfd_vms_pop (abfd, &op1, &rel1))
+             return FALSE;
            if (rel1 != RELC_NONE)
              goto bad_context;
            while (op1-- > 0)
@@ -2095,7 +2106,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Store offset to psect: pop stack, add low 32 bits to base of psect
             arg: none.  */
        case ETIR__C_STO_OFF:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
 
          if (!(rel1 & RELC_SEC_BASE))
            abort ();
@@ -2266,7 +2278,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Det relocation base: pop stack, set image location counter
             arg: none.  */
        case ETIR__C_CTL_SETRB:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (!(rel1 & RELC_SEC_BASE))
            abort ();
          image_set_ptr (abfd, op1, rel1 & RELC_MASK, info);
@@ -2284,7 +2297,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Define location: pop index, save location counter under index
             arg: none.  */
        case ETIR__C_CTL_DFLOC:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
          dst_define_location (abfd, op1);
@@ -2293,7 +2307,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Set location: pop index, restore location counter from index
             arg: none.  */
        case ETIR__C_CTL_STLOC:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
          dst_restore_location (abfd, op1);
@@ -2302,28 +2317,34 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          /* Stack defined location: pop index, push location counter from index
             arg: none.  */
        case ETIR__C_CTL_STKDL:
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, dst_retrieve_location (abfd, op1), RELC_NONE);
+         if (!_bfd_vms_push (abfd, dst_retrieve_location (abfd, op1),
+                             RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_NOP:      /* No-op.  */
          break;
 
        case ETIR__C_OPR_ADD:      /* Add.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 == RELC_NONE && rel2 != RELC_NONE)
            rel1 = rel2;
          else if (rel1 != RELC_NONE && rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op1 + op2, rel1);
+         if (!_bfd_vms_push (abfd, op1 + op2, rel1))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_SUB:      /* Subtract.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 == RELC_NONE && rel2 != RELC_NONE)
            rel1 = rel2;
          else if ((rel1 & RELC_SEC_BASE) && (rel2 & RELC_SEC_BASE))
@@ -2334,69 +2355,90 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
            }
          else if (rel1 != RELC_NONE && rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op2 - op1, rel1);
+         if (!_bfd_vms_push (abfd, op2 - op1, rel1))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_MUL:      /* Multiply.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op1 * op2, RELC_NONE);
+         if (!_bfd_vms_push (abfd, op1 * op2, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_DIV:      /* Divide.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            goto bad_context;
          if (op2 == 0)
-           _bfd_vms_push (abfd, 0, RELC_NONE);
+           {
+             if (!_bfd_vms_push (abfd, 0, RELC_NONE))
+               return FALSE;
+           }
          else
-           _bfd_vms_push (abfd, op2 / op1, RELC_NONE);
+           {
+             if (!_bfd_vms_push (abfd, op2 / op1, RELC_NONE))
+               return FALSE;
+           }
          break;
 
        case ETIR__C_OPR_AND:      /* Logical AND.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op1 & op2, RELC_NONE);
+         if (!_bfd_vms_push (abfd, op1 & op2, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_IOR:      /* Logical inclusive OR.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op1 | op2, RELC_NONE);
+         if (!_bfd_vms_push (abfd, op1 | op2, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_EOR:      /* Logical exclusive OR.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, op1 ^ op2, RELC_NONE);
+         if (!_bfd_vms_push (abfd, op1 ^ op2, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_NEG:      /* Negate.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, -op1, RELC_NONE);
+         if (!_bfd_vms_push (abfd, -op1, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_COM:      /* Complement.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (rel1 != RELC_NONE)
            goto bad_context;
-         _bfd_vms_push (abfd, ~op1, RELC_NONE);
+         if (!_bfd_vms_push (abfd, ~op1, RELC_NONE))
+           return FALSE;
          break;
 
        case ETIR__C_OPR_ASH:      /* Arithmetic shift.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
-         _bfd_vms_pop (abfd, &op2, &rel2);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1)
+             || !_bfd_vms_pop (abfd, &op2, &rel2))
+           return FALSE;
          if (rel1 != RELC_NONE || rel2 != RELC_NONE)
            {
            bad_context:
@@ -2408,7 +2450,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
            op1 >>= -(int)op2;
          else                  /* Shift left.  */
            op1 <<= (int)op2;
-         _bfd_vms_push (abfd, op1, RELC_NONE); /* FIXME: sym.  */
+         if (!_bfd_vms_push (abfd, op1, RELC_NONE)) /* FIXME: sym.  */
+           return FALSE;
          break;
 
        case ETIR__C_OPR_INSV:      /* Insert field.   */
@@ -2422,14 +2465,20 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          break;
 
        case ETIR__C_OPR_SEL:      /* Select.  */
-         _bfd_vms_pop (abfd, &op1, &rel1);
+         if (!_bfd_vms_pop (abfd, &op1, &rel1))
+           return FALSE;
          if (op1 & 0x01L)
-           _bfd_vms_pop (abfd, &op1, &rel1);
+           {
+             if (!_bfd_vms_pop (abfd, &op1, &rel1))
+               return FALSE;
+           }
          else
            {
-             _bfd_vms_pop (abfd, &op1, &rel1);
-             _bfd_vms_pop (abfd, &op2, &rel2);
-             _bfd_vms_push (abfd, op1, rel1);
+             if (!_bfd_vms_pop (abfd, &op1, &rel1)
+                 || !_bfd_vms_pop (abfd, &op2, &rel2))
+               return FALSE;
+             if (!_bfd_vms_push (abfd, op1, rel1))
+               return FALSE;
            }
          break;
 
index 09311d15aa95c84d7fdf2d51ce1dff5db828dfe7..a5d0843c4cdda0ef67baa2472a231e6f2bcfcae2 100644 (file)
@@ -1,4 +1,13 @@
-2020-02-04  Alan Modra  <amodra@gmail.com>
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * m32c.cpu (f-dsp-8-u16, f-dsp-8-s16): Rearrange to mask any sign
+       bits before shifting rather than masking after shifting.
+       (f-dsp-16-u16, f-dsp-16-s16, f-dsp-32-u16, f-dsp-32-s16): Likewise.
+       (f-dsp-40-u16, f-dsp-40-s16, f-dsp-48-u16, f-dsp-48-s16): Likewise.
+       (f-dsp-64-u16, f-dsp-8-s24): Likewise.
+       (f-bitbase32-16-s19-unprefixed): Avoid signed left shift.
+
+2020-01-04  Alan Modra  <amodra@gmail.com>
 
        * m32r.cpu (f-disp8): Avoid left shift of negative values.
        (f-disp16, f-disp24): Likewise.
index 5a38f1bd5264a574ae95c8569dc3d02fd185466b..1e630a4a51a197541bf4af71dc1cebca17f4b7ba 100644 (file)
 
 (df f-dsp-8-u16 "16 bit unsigned" (all-isas) 8 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 
 (df f-dsp-8-s16 "8 bit   signed" (all-isas) 8 16 INT
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; insert
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8)))))   ; insert
      ((value pc) (ext INT
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; extract
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8)))))   ; extract
 )
 
 (df f-dsp-16-u16 "16 bit unsigned" (all-isas) 16 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 
 (df f-dsp-16-s16 "16 bit   signed" (all-isas) 16 16 INT
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; insert
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; insert
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; extract
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; extract
 )
 
 (dnmf f-dsp-24-u16 "16 bit unsigned" (all-isas) UINT
 
 (df f-dsp-32-u16 "16 bit unsigned" (all-isas) 32 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 
 (df f-dsp-32-s16 "16 bit   signed" (all-isas) 32 16 INT
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; insert
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; insert
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; extract
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8)))))   ; extract
 )
 
 (df f-dsp-40-u16 "16 bit unsigned" (all-isas) 40 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 
 (df f-dsp-40-s16 "16 bit   signed" (all-isas) 40 16 INT
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; insert
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; insert
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; extract
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; extract
 )
 
 (df f-dsp-48-u16 "16 bit unsigned" (all-isas) 48 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 
 (df f-dsp-48-s16 "16 bit   signed" (all-isas) 48 16 INT
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; insert
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; insert
      ((value pc) (ext INT 
                      (trunc HI
-                            (or (and (srl value 8) #x00ff)
-                                (and (sll value 8) #xff00))))) ; extract
+                            (or (and (srl value 8) #xff)
+                                (sll (and value #xff) 8))))) ; extract
 )
 
 (df f-dsp-64-u16 "16 bit unsigned" (all-isas) 64 16 UINT
      ((value pc) (or UHI
-                    (and (srl value 8) #x00ff)
-                    (and (sll value 8) #xff00))) ; insert
+                    (and (srl value 8) #xff)
+                    (sll (and value #xff) 8))) ; insert
      ((value pc) (or UHI
-                    (and UHI (srl UHI value 8) #x00ff)
-                    (and UHI (sll UHI value 8) #xff00))) ; extract
+                    (and UHI (srl UHI value 8) #xff)
+                    (sll UHI (and UHI value #xff) 8))) ; extract
 )
 (df  f-dsp-8-s24 "24 bit signed" (all-isas) 8 24 INT
-     ((value pc) (or SI
-                    (or (and (srl value 16) #xff) (and value #xff00))
-                    (sll (ext INT (trunc QI (and value #xff))) 16)))
-     ((value pc) (or SI
-                    (or (and (srl value 16) #xff) (and value #xff00))
-                    (sll (ext INT (trunc QI (and value #xff))) 16)))
+     ((value pc) (sub SI (xor (or SI (or (and (srl value 16) #xff)
+                                        (and value #xff00))
+                                 (sll (and value #xff) 16))
+                             #x800000) #x800000))
+     ((value pc) (sub SI (xor (or SI
+                                 (or (and (srl value 16) #xff)
+                                     (and value #xff00))
+                                 (sll (and value #xff) 16))
+                             #x800000) #x800000))
  )
 
 (df  f-dsp-8-u24 "24 bit unsigned" (all-isas) 8 24 UINT
                (set (ifield f-dsp-16-s16) (sra INT (ifield f-bitbase32-16-s19-unprefixed) 3))
                )
       (sequence () ; extract
-               (set (ifield f-bitbase32-16-s19-unprefixed) (or (sll (ifield f-dsp-16-s16) 3)
+               (set (ifield f-bitbase32-16-s19-unprefixed) (or (mul (ifield f-dsp-16-s16) 8)
                                                                (ifield f-bitno32-unprefixed)))
                )
 )
index 5a16b9144aaa2ec23f04b2aeaca3155ba1825946..1c61732fab3b7e693b2bf737dd4195b5c1548d41 100644 (file)
@@ -1,3 +1,10 @@
+2020-01-07  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * onfig/tc-arc.c (parse_reloc_symbol): New function.
+       (tokenize_arguments): Clean up, use parse_reloc_symbol function.
+       (md_operand): Set X_md to absent.
+       (arc_parse_name): Check for X_md.
+
 2020-01-03  Sergey Belyashov  <sergey.belyashov@gmail.com>
 
        PR 25311
index ffccfda05664cd2eb1034a858179395c4f6a7c5d..ed1e3fb5dd5c9504c66e1f377f3d85a4f322a33b 100644 (file)
@@ -1092,6 +1092,102 @@ debug_exp (expressionS *t)
   fflush (stderr);
 }
 
+/* Helper for parsing an argument, used for sorting out the relocation
+   type.  */
+
+static void
+parse_reloc_symbol (expressionS *resultP)
+{
+  char *reloc_name, c, *sym_name;
+  size_t len;
+  int i;
+  const struct arc_reloc_op_tag *r;
+  expressionS right;
+  symbolS *base;
+
+  /* A relocation operand has the following form
+     @identifier@relocation_type.  The identifier is already in
+     tok!  */
+  if (resultP->X_op != O_symbol)
+    {
+      as_bad (_("No valid label relocation operand"));
+      resultP->X_op = O_illegal;
+      return;
+    }
+
+  /* Parse @relocation_type.  */
+  input_line_pointer++;
+  c = get_symbol_name (&reloc_name);
+  len = input_line_pointer - reloc_name;
+  if (len == 0)
+    {
+      as_bad (_("No relocation operand"));
+      resultP->X_op = O_illegal;
+      return;
+    }
+
+  /* Go through known relocation and try to find a match.  */
+  r = &arc_reloc_op[0];
+  for (i = arc_num_reloc_op - 1; i >= 0; i--, r++)
+    if (len == r->length
+       && memcmp (reloc_name, r->name, len) == 0)
+      break;
+  if (i < 0)
+    {
+      as_bad (_("Unknown relocation operand: @%s"), reloc_name);
+      resultP->X_op = O_illegal;
+      return;
+    }
+
+  *input_line_pointer = c;
+  SKIP_WHITESPACE_AFTER_NAME ();
+  /* Extra check for TLS: base.  */
+  if (*input_line_pointer == '@')
+    {
+      if (resultP->X_op_symbol != NULL
+         || resultP->X_op != O_symbol)
+       {
+         as_bad (_("Unable to parse TLS base: %s"),
+                 input_line_pointer);
+         resultP->X_op = O_illegal;
+         return;
+       }
+      input_line_pointer++;
+      c = get_symbol_name (&sym_name);
+      base = symbol_find_or_make (sym_name);
+      resultP->X_op = O_subtract;
+      resultP->X_op_symbol = base;
+      restore_line_pointer (c);
+      right.X_add_number = 0;
+    }
+
+  if ((*input_line_pointer != '+')
+      && (*input_line_pointer != '-'))
+    right.X_add_number = 0;
+  else
+    {
+      /* Parse the constant of a complex relocation expression
+        like @identifier@reloc +/- const.  */
+      if (! r->complex_expr)
+       {
+         as_bad (_("@%s is not a complex relocation."), r->name);
+         resultP->X_op = O_illegal;
+         return;
+       }
+      expression (&right);
+      if (right.X_op != O_constant)
+       {
+         as_bad (_("Bad expression: @%s + %s."),
+                 r->name, input_line_pointer);
+         resultP->X_op = O_illegal;
+         return;
+       }
+    }
+
+  resultP->X_md = r->op;
+  resultP->X_add_number = right.X_add_number;
+}
+
 /* Parse the arguments to an opcode.  */
 
 static int
@@ -1104,11 +1200,6 @@ tokenize_arguments (char *str,
   bfd_boolean saw_arg = FALSE;
   int brk_lvl = 0;
   int num_args = 0;
-  int i;
-  size_t len;
-  const struct arc_reloc_op_tag *r;
-  expressionS tmpE;
-  char *reloc_name, c;
 
   memset (tok, 0, sizeof (*tok) * ntok);
 
@@ -1170,95 +1261,21 @@ tokenize_arguments (char *str,
            goto err;
 
          /* Parse @label.  */
+         input_line_pointer++;
          tok->X_op = O_symbol;
          tok->X_md = O_absent;
          expression (tok);
-         if (*input_line_pointer != '@')
-           goto normalsymbol; /* This is not a relocation.  */
-
-       relocationsym:
-
-         /* A relocation operand has the following form
-            @identifier@relocation_type.  The identifier is already
-            in tok!  */
-         if (tok->X_op != O_symbol)
-           {
-             as_bad (_("No valid label relocation operand"));
-             goto err;
-           }
-
-         /* Parse @relocation_type.  */
-         input_line_pointer++;
-         c = get_symbol_name (&reloc_name);
-         len = input_line_pointer - reloc_name;
-         if (len == 0)
-           {
-             as_bad (_("No relocation operand"));
-             goto err;
-           }
-
-         /* Go through known relocation and try to find a match.  */
-         r = &arc_reloc_op[0];
-         for (i = arc_num_reloc_op - 1; i >= 0; i--, r++)
-           if (len == r->length
-               && memcmp (reloc_name, r->name, len) == 0)
-             break;
-         if (i < 0)
-           {
-             as_bad (_("Unknown relocation operand: @%s"), reloc_name);
-             goto err;
-           }
 
-         *input_line_pointer = c;
-         SKIP_WHITESPACE_AFTER_NAME ();
-         /* Extra check for TLS: base.  */
          if (*input_line_pointer == '@')
-           {
-             symbolS *base;
-             if (tok->X_op_symbol != NULL
-                 || tok->X_op != O_symbol)
-               {
-                 as_bad (_("Unable to parse TLS base: %s"),
-                         input_line_pointer);
-                 goto err;
-               }
-             input_line_pointer++;
-             char *sym_name;
-             c = get_symbol_name (&sym_name);
-             base = symbol_find_or_make (sym_name);
-             tok->X_op = O_subtract;
-             tok->X_op_symbol = base;
-             restore_line_pointer (c);
-             tmpE.X_add_number = 0;
-           }
-         if ((*input_line_pointer != '+')
-                  && (*input_line_pointer != '-'))
-           {
-             tmpE.X_add_number = 0;
-           }
-         else
-           {
-             /* Parse the constant of a complex relocation expression
-                like @identifier@reloc +/- const.  */
-             if (! r->complex_expr)
-               {
-                 as_bad (_("@%s is not a complex relocation."), r->name);
-                 goto err;
-               }
-             expression (&tmpE);
-             if (tmpE.X_op != O_constant)
-               {
-                 as_bad (_("Bad expression: @%s + %s."),
-                         r->name, input_line_pointer);
-                 goto err;
-               }
-           }
-
-         tok->X_md = r->op;
-         tok->X_add_number = tmpE.X_add_number;
+           parse_reloc_symbol (tok);
 
          debug_exp (tok);
 
+         if (tok->X_op == O_illegal
+              || tok->X_op == O_absent
+              || num_args == ntok)
+           goto err;
+
          saw_comma = FALSE;
          saw_arg = TRUE;
          tok++;
@@ -1282,9 +1299,8 @@ tokenize_arguments (char *str,
             identifier@relocation_type, if it is the case parse the
             relocation type as well.  */
          if (*input_line_pointer == '@')
-           goto relocationsym;
+           parse_reloc_symbol (tok);
 
-       normalsymbol:
          debug_exp (tok);
 
          if (tok->X_op == O_illegal
@@ -3336,16 +3352,18 @@ md_atof (int type, char *litP, int *sizeP)
 
 /* Called for any expression that can not be recognized.  When the
    function is called, `input_line_pointer' will point to the start of
-   the expression.  */
+   the expression.  We use it when we have complex operations like
+   @label1 - @label2.  */
 
 void
-md_operand (expressionS *expressionP ATTRIBUTE_UNUSED)
+md_operand (expressionS *expressionP)
 {
   char *p = input_line_pointer;
   if (*p == '@')
     {
       input_line_pointer++;
       expressionP->X_op = O_symbol;
+      expressionP->X_md = O_absent;
       expression (expressionP);
     }
 }
@@ -3364,7 +3382,8 @@ arc_parse_name (const char *name,
   if (!assembling_insn)
     return FALSE;
 
-  if (e->X_op == O_symbol)
+  if (e->X_op == O_symbol
+      && e->X_md == O_absent)
     return FALSE;
 
   sym = hash_find (arc_reg_hash, name);
index c24dccaaa97cf90806296b5691526cf7126281da..b82ef3d09d72a2c4568de15dc00e23a0ddf57a18 100644 (file)
@@ -1,3 +1,64 @@
+2020-01-02  Jon Turney  <jon.turney@dronecode.org.uk>
+
+       * cli/cli-style.c: Set cli_styling to 'true' in the Cygwin build.
+
+2020-01-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * stack.c (print_frame_info): Move disassemble_next_line code
+       inside source_print block.
+
+2020-01-06  Eli Zaretskii  <eliz@gnu.org>
+
+       * gdbsupport/gdb_wait.c: Include <signal.h> instead of
+       gdb/signals.h, as we are now using native signal symbols.
+
+2020-01-06  Shahab Vahedi  <shahab@synopsys.com>
+
+       * tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): Avoid
+       overflow by an early check of content vs threshold.
+        * tui/tui-source.c (tui_source_window::line_is_displayed):
+       Likewise.
+
+2020-01-06  Eli Zaretskii  <eliz@gnu.org>
+
+       * NEWS: Mention the recent fix of $_exitsignal on MS-Windows.
+
+2020-01-02  Jon Turney  <jon.turney@dronecode.org.uk>
+
+       * coff-pe-read.c (read_pe_exported_syms): Don't try to read the
+       export table if no section contains it's RVA.
+
+2020-01-06  Eli Zaretskii  <eliz@gnu.org>
+
+       * windows-tdep.c: Fix a typo in WINDOWS_SIGABRT.
+
+2020-01-06  Hannes Domani  <ssbssa@yahoo.de>
+
+       * source.c (print_source_lines_base): Set last_line_listed.
+
+2020-01-06  Shahab Vahedi  <shahab@synopsys.com>
+
+       * tui/tui-disasm.c: Remove trailing spaces.
+
+2020-01-06  Eli Zaretskii  <eliz@gnu.org>
+           Pedro Alves  <palves@redhat.com>
+
+       * Makefile.in (COMMON_SFILES): Add gdbsupport/gdb_wait.c.
+       * windows-tdep.c: New enumeration of WINDOWS_SIG* signals.
+       (windows_gdb_signal_to_target): New function, uses the above
+       enumeration to convert GDB internal signal codes to equivalent
+       Windows codes.
+       (windows_init_abi): Call set_gdbarch_gdb_signal_to_target.
+       * windows-nat.c: Include "gdb_wait.h".
+       (get_windows_debug_event): Extract the fatal exception from the
+       exit status and convert to the equivalent Posix signal number.
+       * cli/cli-cmds.c (exit_status_set_internal_vars): Account for the
+       possibility that WTERMSIG returns GDB_SIGNAL_UNKNOWN.
+       * gdbsupport/gdb_wait.c: New file, implements
+       windows_status_to_termsig.
+       * gdbsupport/gdb_wait.h (WIFEXITED, WIFSIGNALED, WEXITSTATUS)
+       (WTERMSIG) [__MINGW32__]: Separate definitions for MinGW.
+
 2020-01-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not
index 70bf3e4cea05044c2bed23759563a32af959b229..084c83dcef7ef25458f7a71796e0c2cef6bc22df 100644 (file)
@@ -987,6 +987,7 @@ COMMON_SFILES = \
        gdbsupport/gdb-dlfcn.c \
        gdbsupport/gdb_tilde_expand.c \
        gdbsupport/gdb_vecs.c \
+       gdbsupport/gdb_wait.c \
        gdbsupport/netstuff.c \
        gdbsupport/new-op.c \
        gdbsupport/pathstuff.c \
index f51a989fef18eb80f39857f7064ffbbc0719ec5d..8405bd06320aa70e438e182820aaabfae9fccb63 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,9 @@
 
 *** Changes since GDB 9
 
+* Debugging MS-Windows processes now sets $_exitsignal when the
+  inferior is terminated by a signal, instead of setting $_exitcode.
+
 * Multithreaded symbol loading has now been enabled by default on systems
   that support it (see entry for GDB 9, below), providing faster
   performance for programs with many symbols.
index 6c678250c7a9240aef0bd5a8f0f1fcbdfdd34b0a..e1204f74ef1aea3840f4c94007cdcaa158551fb8 100644 (file)
@@ -801,6 +801,18 @@ exit_status_set_internal_vars (int exit_status)
   clear_internalvar (var_signal);
   if (WIFEXITED (exit_status))
     set_internalvar_integer (var_code, WEXITSTATUS (exit_status));
+#ifdef __MINGW32__
+  else if (WIFSIGNALED (exit_status) && WTERMSIG (exit_status) == -1)
+    {
+      /* The -1 condition can happen on MinGW, if we don't recognize
+        the fatal exception code encoded in the exit status; see
+        gdbsupport/gdb_wait.c.  We don't want to lose information in
+        the exit status in that case.  Record it as a normal exit
+        with the full exit status, including the higher 0xC0000000
+        bits.  */
+      set_internalvar_integer (var_code, exit_status);
+    }
+#endif
   else if (WIFSIGNALED (exit_status))
     set_internalvar_integer (var_signal, WTERMSIG (exit_status));
   else
index 7e20c1b4826b3d903fd94027a6c177d5b3e96754..f3d98ae4091008cf524ed7085e7c31e204d8cf72 100644 (file)
@@ -25,7 +25,7 @@
 
 /* True if styling is enabled.  */
 
-#if defined (__MSDOS__) || defined (__CYGWIN__)
+#if defined (__MSDOS__)
 bool cli_styling = false;
 #else
 bool cli_styling = true;
index e1c51d45e382c0d8a8eebe4ab0fd662e0836f978..d0c1e050c891fbc438f6550ff66ad97748724d5d 100644 (file)
@@ -441,6 +441,12 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
        }
     }
 
+  if (expptr == 0)
+    {
+      /* no section contains export table rva */
+      return;
+    }
+
   export_rva = export_opthdrrva;
   export_size = export_opthdrsize;
 
index 4d16083c380bc1759477062ba22879c3ccab2685..63778e2d2a3581595ef5f3cf9a3baa57f29f28ba 100644 (file)
@@ -1,3 +1,12 @@
+2020-01-06  Eli Zaretskii  <eliz@gnu.org>
+           Pedro Alves  <palves@redhat.com>
+
+       * win32-low.c (get_child_debug_event): Extract the fatal exception
+       from the exit status and convert to the equivalent Posix signal
+       number.
+       (win32_wait): Allow TARGET_WAITKIND_SIGNALLED status as well.
+       * Makefile.in (OBS, SFILES): Add gdb_wait.[co].
+
 2020-01-01  Hannes Domani  <ssbssa@yahoo.de>
 
        * Makefile.in: Use INSTALL_PROGRAM_ENV.
index d39c065f6d00b40866504516fa46dd35c76a25a1..1125426778b8d3e5566740b70c60941b1283e045 100644 (file)
@@ -217,6 +217,7 @@ SFILES = \
        $(srcdir)/gdbsupport/gdb-dlfcn.c \
        $(srcdir)/gdbsupport/gdb_tilde_expand.c \
        $(srcdir)/gdbsupport/gdb_vecs.c \
+       $(srcdir)/gdbsupport/gdb_wait.c \
        $(srcdir)/gdbsupport/netstuff.c \
        $(srcdir)/gdbsupport/new-op.c \
        $(srcdir)/gdbsupport/pathstuff.c \
@@ -264,6 +265,7 @@ OBS = \
        gdbsupport/gdb-dlfcn.o \
        gdbsupport/gdb_tilde_expand.o \
        gdbsupport/gdb_vecs.o \
+       gdbsupport/gdb_wait.o \
        gdbsupport/netstuff.o \
        gdbsupport/new-op.o \
        gdbsupport/pathstuff.o \
index b4ee0f45c4faa999c2e16a720bf1b8be822ae174..340f65bbf95a49ccf4677adc972d62673f4ca8e3 100644 (file)
@@ -34,6 +34,7 @@
 #include <process.h>
 #include "gdbsupport/gdb_tilde_expand.h"
 #include "gdbsupport/common-inferior.h"
+#include "gdbsupport/gdb_wait.h"
 
 #ifndef USE_WIN32API
 #include <sys/cygwin.h>
@@ -1511,8 +1512,24 @@ get_child_debug_event (struct target_waitstatus *ourstatus)
                "for pid=%u tid=%x\n",
                (unsigned) current_event.dwProcessId,
                (unsigned) current_event.dwThreadId));
-      ourstatus->kind = TARGET_WAITKIND_EXITED;
-      ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
+      {
+       DWORD exit_status = current_event.u.ExitProcess.dwExitCode;
+       /* If the exit status looks like a fatal exception, but we
+          don't recognize the exception's code, make the original
+          exit status value available, to avoid losing information.  */
+       int exit_signal
+         = WIFSIGNALED (exit_status) ? WTERMSIG (exit_status) : -1;
+       if (exit_signal == -1)
+         {
+           ourstatus->kind = TARGET_WAITKIND_EXITED;
+           ourstatus->value.integer = exit_status;
+         }
+       else
+         {
+           ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+           ourstatus->value.sig = gdb_signal_from_host (exit_signal);
+         }
+      }
       child_continue (DBG_CONTINUE, -1);
       CloseHandle (current_process_handle);
       current_process_handle = NULL;
@@ -1607,6 +1624,7 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
          win32_clear_inferiors ();
          return ptid_t (current_event.dwProcessId);
        case TARGET_WAITKIND_STOPPED:
+       case TARGET_WAITKIND_SIGNALLED:
        case TARGET_WAITKIND_LOADED:
          OUTMSG2 (("Child Stopped with signal = %d \n",
                    ourstatus->value.sig));
diff --git a/gdb/gdbsupport/gdb_wait.c b/gdb/gdbsupport/gdb_wait.c
new file mode 100644 (file)
index 0000000..6facc48
--- /dev/null
@@ -0,0 +1,83 @@
+/* Support code for standard wait macros in gdb_wait.h.
+
+   Copyright (C) 2019 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "common-defs.h"
+
+#ifdef __MINGW32__
+
+/* The underlying idea is that when a Windows program is terminated by
+   a fatal exception, its exit code is the value of that exception, as
+   defined by the various EXCEPTION_* symbols in the Windows API
+   headers.  We thus emulate WTERMSIG etc. by translating the fatal
+   exception codes to more-or-less equivalent Posix signals.
+
+   The translation below is not perfect, because a program could
+   legitimately exit normally with a status whose value happens to
+   have the high bits set, but that's extremely rare, to say the
+   least, and it is deemed such a negligibly small probability of
+   false positives is justified by the utility of reporting the
+   terminating signal in the "normal" cases.  */
+
+# include <signal.h>
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>          /* for EXCEPTION_* constants */
+
+struct xlate_status
+{
+  /* The exit status (actually, fatal exception code).  */
+  DWORD status;
+
+  /* The corresponding signal value.  */
+  int sig;
+};
+
+int
+windows_status_to_termsig (unsigned long status)
+{
+  static const xlate_status status_xlate_tbl[] =
+    {
+     {EXCEPTION_ACCESS_VIOLATION,        SIGSEGV},
+     {EXCEPTION_IN_PAGE_ERROR,           SIGSEGV},
+     {EXCEPTION_INVALID_HANDLE,                  SIGSEGV},
+     {EXCEPTION_ILLEGAL_INSTRUCTION,     SIGILL},
+     {EXCEPTION_NONCONTINUABLE_EXCEPTION, SIGILL},
+     {EXCEPTION_ARRAY_BOUNDS_EXCEEDED,   SIGSEGV},
+     {EXCEPTION_FLT_DENORMAL_OPERAND,    SIGFPE},
+     {EXCEPTION_FLT_DIVIDE_BY_ZERO,      SIGFPE},
+     {EXCEPTION_FLT_INEXACT_RESULT,      SIGFPE},
+     {EXCEPTION_FLT_INVALID_OPERATION,   SIGFPE},
+     {EXCEPTION_FLT_OVERFLOW,            SIGFPE},
+     {EXCEPTION_FLT_STACK_CHECK,         SIGFPE},
+     {EXCEPTION_FLT_UNDERFLOW,           SIGFPE},
+     {EXCEPTION_INT_DIVIDE_BY_ZERO,      SIGFPE},
+     {EXCEPTION_INT_OVERFLOW,            SIGFPE},
+     {EXCEPTION_PRIV_INSTRUCTION,        SIGILL},
+     {EXCEPTION_STACK_OVERFLOW,                  SIGSEGV},
+     {CONTROL_C_EXIT,                    SIGTERM}
+    };
+
+  for (const xlate_status &x : status_xlate_tbl)
+    if (x.status == status)
+      return x.sig;
+
+  return -1;
+}
+
+#endif /* __MINGW32__ */
index d00b459205169e0adc4955ce0636608343242955..3563b9cb954cfd3fafcdd668a7c50a6283fb15d8 100644 (file)
    in POSIX.1.  We fail to define WNOHANG and WUNTRACED, which POSIX.1
    <sys/wait.h> defines, since our code does not use waitpid() (but
    NOTE exception for GNU/Linux below).  We also fail to declare
-   wait() and waitpid().  */
+   wait() and waitpid().
+
+   For MinGW, we use the fact that when a Windows program is
+   terminated by a fatal exception, its exit code is the value of that
+   exception, as defined by the various EXCEPTION_* symbols in the
+   Windows API headers.  See also gdb_wait.c.  */
 
 #ifndef        WIFEXITED
-#define WIFEXITED(w)   (((w)&0377) == 0)
+# ifdef __MINGW32__
+#  define WIFEXITED(w) (((w) & 0xC0000000) == 0)
+# else
+#  define WIFEXITED(w) (((w)&0377) == 0)
+# endif
 #endif
 
 #ifndef        WIFSIGNALED
-#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
+# ifdef __MINGW32__
+#  define WIFSIGNALED(w)       (((w) & 0xC0000000) == 0xC0000000)
+# else
+#  define WIFSIGNALED(w)       (((w)&0377) != 0177 && ((w)&~0377) == 0)
+# endif
 #endif
 
 #ifndef        WIFSTOPPED
 #ifdef IBM6000
 
-/* Unfortunately, the above comment (about being compatible in all Unix 
+/* Unfortunately, the above comment (about being compatible in all Unix
    systems) is not quite correct for AIX, sigh.  And AIX 3.2 can generate
    status words like 0x57c (sigtrap received after load), and gdb would
    choke on it.  */
 #endif
 
 #ifndef        WEXITSTATUS
-#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */
+# ifdef __MINGW32__
+#  define WEXITSTATUS(w)       ((w) & ~0xC0000000)
+# else
+#  define WEXITSTATUS(w)       (((w) >> 8) & 0377) /* same as WRETCODE */
+# endif
 #endif
 
 #ifndef        WTERMSIG
-#define WTERMSIG(w)    ((w) & 0177)
+# ifdef __MINGW32__
+extern int windows_status_to_termsig (unsigned long);
+#  define WTERMSIG(w)  windows_status_to_termsig (w)
+# else
+#  define WTERMSIG(w)  ((w) & 0177)
+# endif
 #endif
 
 #ifndef        WSTOPSIG
index 7230c77f7333530803606de71e924f79fc870401..1bc98d376e55ce67b5d78c88b39b1960d16cbf2a 100644 (file)
@@ -1232,6 +1232,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
 
   loc->set (s, line);
   first_line_listed = line;
+  last_line_listed = line;
 
   /* If printing of source lines is disabled, just print file and line
      number.  */
index a90120a5c13abd8710ed7b0bafdfcee53df06a68..92784c93396807929265dc2b8fffa920966f24e1 100644 (file)
@@ -1153,12 +1153,12 @@ print_frame_info (const frame_print_options &fp_opts,
 
          print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
        }
-    }
 
-  /* If disassemble-next-line is set to on and there is line debug
-     messages, output assembly codes for next line.  */
-  if (disassemble_next_line == AUTO_BOOLEAN_TRUE)
-    do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
+      /* If disassemble-next-line is set to on and there is line debug
+        messages, output assembly codes for next line.  */
+      if (disassemble_next_line == AUTO_BOOLEAN_TRUE)
+       do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
+    }
 
   if (set_current_sal)
     {
index ba857a46f3b6299a9ceb4cb96dffa67a8ff123f0..3f243641b8b02df6327ee6ef4d56c3526718a037 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.base/backtrace.c: New file.
+       * gdb.base/backtrace.exp: New file.
+
 2020-01-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.tui/list.exp: Test 'focus next' after 'list main'.
diff --git a/gdb/testsuite/gdb.base/backtrace.c b/gdb/testsuite/gdb.base/backtrace.c
new file mode 100644 (file)
index 0000000..bae8b1a
--- /dev/null
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2019-2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int __attribute__((noinline,noclone))
+baz ()
+{
+  return 0;    /* Break here.  */
+}
+
+int __attribute__((noinline,noclone))
+bar ()
+{
+  return baz ();
+}
+
+int __attribute__((noinline,noclone))
+foo ()
+{
+  return bar ();
+}
+
+int
+main ()
+{
+  return foo ();
+}
diff --git a/gdb/testsuite/gdb.base/backtrace.exp b/gdb/testsuite/gdb.base/backtrace.exp
new file mode 100644 (file)
index 0000000..17e3b61
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# A place for miscellaneous tests related to backtrace.
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if ![runto_main] then {
+    fail "can't run to main"
+    return 0
+}
+
+# Run to the breakpoint at return.
+gdb_breakpoint [gdb_get_line_number "Break here."]
+gdb_continue_to_breakpoint "Break here."
+
+# Backtrace with the default options.
+gdb_test "bt" \
+    [multi_line \
+        "#0\[ \t\]*baz \\(\\) at \[^\r\n\]+" \
+        "#1\[ \t\]*$hex in bar \\(\\) at \[^\r\n\]+" \
+        "#2\[ \t\]*$hex in foo \\(\\) at \[^\r\n\]+" \
+        "#3\[ \t\]*$hex in main \\(\\) at \[^\r\n\]+" ]
+
+# Backtrace with 'set disassemble-next-line on'.  This shouldn't make
+# any difference to the backtrace.
+gdb_test "with disassemble-next-line on -- bt" \
+    [multi_line \
+        "#0\[ \t\]*baz \\(\\) at \[^\r\n\]+" \
+        "#1\[ \t\]*$hex in bar \\(\\) at \[^\r\n\]+" \
+        "#2\[ \t\]*$hex in foo \\(\\) at \[^\r\n\]+" \
+        "#3\[ \t\]*$hex in main \\(\\) at \[^\r\n\]+" ]
index c72b50730b021812232df7d352de2329068d69db..98c691f3387766610d17e7d8ce99c89d450e05c2 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "gdb_curses.h"
 
-struct tui_asm_line 
+struct tui_asm_line
 {
   CORE_ADDR addr;
   std::string addr_string;
@@ -150,7 +150,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
       CORE_ADDR last_addr;
       int pos;
       struct bound_minimal_symbol msymbol;
-              
+
       /* Find backward an address which is a symbol and for which
          disassembling from that address will fill completely the
          window.  */
@@ -176,7 +176,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
         do
           {
             CORE_ADDR next_addr;
-                 
+
             pos++;
             if (pos >= max_lines)
               pos = 0;
@@ -348,19 +348,17 @@ tui_disasm_window::location_matches_p (struct bp_location *loc, int line_no)
 bool
 tui_disasm_window::addr_is_displayed (CORE_ADDR addr) const
 {
-  bool is_displayed = false;
-  int threshold = SCROLL_THRESHOLD;
+  if (content.size () < SCROLL_THRESHOLD)
+    return false;
 
-  int i = 0;
-  while (i < content.size () - threshold && !is_displayed)
+  for (size_t i = 0; i < content.size () - SCROLL_THRESHOLD; ++i)
     {
-      is_displayed
-       = (content[i].line_or_addr.loa == LOA_ADDRESS
-          && content[i].line_or_addr.u.addr == addr);
-      i++;
+      if (content[i].line_or_addr.loa == LOA_ADDRESS
+         && content[i].line_or_addr.u.addr == addr)
+       return true;
     }
 
-  return is_displayed;
+  return false;
 }
 
 void
index e028b724d23c5a18d1353d6f0023f3a5536545b7..1503cd4c63608f3db23965e36488280e5a4762da 100644 (file)
@@ -174,18 +174,17 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
 bool
 tui_source_window::line_is_displayed (int line) const
 {
-  bool is_displayed = false;
-  int threshold = SCROLL_THRESHOLD;
-  int i = 0;
-  while (i < content.size () - threshold && !is_displayed)
+  if (content.size () < SCROLL_THRESHOLD)
+    return false;
+
+  for (size_t i = 0; i < content.size () - SCROLL_THRESHOLD; ++i)
     {
-      is_displayed
-       = (content[i].line_or_addr.loa == LOA_LINE
-          && content[i].line_or_addr.u.line_no == line);
-      i++;
+      if (content[i].line_or_addr.loa == LOA_LINE
+         && content[i].line_or_addr.u.line_no == line)
+       return true;
     }
 
-  return is_displayed;
+  return false;
 }
 
 void
index 2214caacb8198ab8993dd561f9c3aab77b8afb7f..36a47f7cdbc28be0e4791a9e40795580a572166f 100644 (file)
@@ -68,6 +68,7 @@
 #include "inf-child.h"
 #include "gdbsupport/gdb_tilde_expand.h"
 #include "gdbsupport/pathstuff.h"
+#include "gdbsupport/gdb_wait.h"
 
 #define AdjustTokenPrivileges          dyn_AdjustTokenPrivileges
 #define DebugActiveProcessStop         dyn_DebugActiveProcessStop
@@ -1627,8 +1628,23 @@ get_windows_debug_event (struct target_ops *ops,
          windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
                                         current_event.dwThreadId),
                                 0, true /* main_thread_p */);
-         ourstatus->kind = TARGET_WAITKIND_EXITED;
-         ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
+         DWORD exit_status = current_event.u.ExitProcess.dwExitCode;
+         /* If the exit status looks like a fatal exception, but we
+            don't recognize the exception's code, make the original
+            exit status value available, to avoid losing
+            information.  */
+         int exit_signal
+           = WIFSIGNALED (exit_status) ? WTERMSIG (exit_status) : -1;
+         if (exit_signal == -1)
+           {
+             ourstatus->kind = TARGET_WAITKIND_EXITED;
+             ourstatus->value.integer = exit_status;
+           }
+         else
+           {
+             ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+             ourstatus->value.sig = gdb_signal_from_host (exit_signal);
+           }
          thread_id = current_event.dwThreadId;
        }
       break;
index ca9b81df29858409901185b3a235d681b4805d16..b6e5b9ff7c2662a55abbff2c7a8d363b172a9297 100644 (file)
 #include "solib-target.h"
 #include "gdbcore.h"
 
+/* Windows signal numbers differ between MinGW flavors and between
+   those and Cygwin.  The below enumeration was gleaned from the
+   respective headers; the ones marked with MinGW64/Cygwin are defined
+   only by MinGW64 and Cygwin, not by mingw.org's MinGW.  FIXME: We
+   should really have distinct MinGW vs Cygwin OSABIs, and two
+   separate enums, selected at runtime.  */
+
+enum
+  {
+   WINDOWS_SIGHUP = 1, /* MinGW64/Cygwin */
+   WINDOWS_SIGINT = 2,
+   WINDOWS_SIGQUIT = 3,        /* MinGW64/Cygwin */
+   WINDOWS_SIGILL = 4,
+   WINDOWS_SIGTRAP = 5,        /* MinGW64/Cygwin */
+#ifdef __CYGWIN__
+   WINDOWS_SIGABRT = 6,
+#else
+   WINDOWS_SIGIOT = 6, /* MinGW64 */
+#endif
+   WINDOWS_SIGEMT = 7, /* MinGW64/Cygwin */
+   WINDOWS_SIGFPE = 8,
+   WINDOWS_SIGKILL = 9,        /* MinGW64/Cygwin */
+   WINDOWS_SIGBUS = 10,        /* MinGW64/Cygwin */
+   WINDOWS_SIGSEGV = 11,
+   WINDOWS_SIGSYS = 12,        /* MinGW64/Cygwin */
+   WINDOWS_SIGPIPE = 13,/* MinGW64/Cygwin */
+   WINDOWS_SIGALRM = 14,/* MinGW64/Cygwin */
+   WINDOWS_SIGTERM = 15,
+#ifdef __CYGWIN__
+   WINDOWS_SIGURG = 16,
+   WINDOWS_SIGSTOP = 17,
+   WINDOWS_SIGTSTP = 18,
+   WINDOWS_SIGCONT = 19,
+   WINDOWS_SIGCHLD = 20,
+   WINDOWS_SIGTTIN = 21,
+   WINDOWS_SIGTTOU = 22,
+   WINDOWS_SIGIO = 23,
+   WINDOWS_SIGXCPU = 24,
+   WINDOWS_SIGXFSZ = 25,
+   WINDOWS_SIGVTALRM = 26,
+   WINDOWS_SIGPROF = 27,
+   WINDOWS_SIGWINCH = 28,
+   WINDOWS_SIGLOST = 29,
+   WINDOWS_SIGUSR1 = 30,
+   WINDOWS_SIGUSR2 = 31
+#else
+   WINDOWS_SIGBREAK = 21,
+   WINDOWS_SIGABRT = 22
+#endif
+  };
+
 struct cmd_list_element *info_w32_cmdlist;
 
 typedef struct thread_information_block_32
@@ -461,6 +512,83 @@ init_w32_command_list (void)
     }
 }
 
+/* Implementation of `gdbarch_gdb_signal_to_target'.  */
+
+static int
+windows_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
+{
+  switch (signal)
+    {
+    case GDB_SIGNAL_0:
+      return 0;
+    case GDB_SIGNAL_HUP:
+      return WINDOWS_SIGHUP;
+    case GDB_SIGNAL_INT:
+      return WINDOWS_SIGINT;
+    case GDB_SIGNAL_QUIT:
+      return WINDOWS_SIGQUIT;
+    case GDB_SIGNAL_ILL:
+      return WINDOWS_SIGILL;
+    case GDB_SIGNAL_TRAP:
+      return WINDOWS_SIGTRAP;
+    case GDB_SIGNAL_ABRT:
+      return WINDOWS_SIGABRT;
+    case GDB_SIGNAL_EMT:
+      return WINDOWS_SIGEMT;
+    case GDB_SIGNAL_FPE:
+      return WINDOWS_SIGFPE;
+    case GDB_SIGNAL_KILL:
+      return WINDOWS_SIGKILL;
+    case GDB_SIGNAL_BUS:
+      return WINDOWS_SIGBUS;
+    case GDB_SIGNAL_SEGV:
+      return WINDOWS_SIGSEGV;
+    case GDB_SIGNAL_SYS:
+      return WINDOWS_SIGSYS;
+    case GDB_SIGNAL_PIPE:
+      return WINDOWS_SIGPIPE;
+    case GDB_SIGNAL_ALRM:
+      return WINDOWS_SIGALRM;
+    case GDB_SIGNAL_TERM:
+      return WINDOWS_SIGTERM;
+#ifdef __CYGWIN__
+    case GDB_SIGNAL_URG:
+      return WINDOWS_SIGURG;
+    case GDB_SIGNAL_STOP:
+      return WINDOWS_SIGSTOP;
+    case GDB_SIGNAL_TSTP:
+      return WINDOWS_SIGTSTP;
+    case GDB_SIGNAL_CONT:
+      return WINDOWS_SIGCONT;
+    case GDB_SIGNAL_CHLD:
+      return WINDOWS_SIGCHLD;
+    case GDB_SIGNAL_TTIN:
+      return WINDOWS_SIGTTIN;
+    case GDB_SIGNAL_TTOU:
+      return WINDOWS_SIGTTOU;
+    case GDB_SIGNAL_IO:
+      return WINDOWS_SIGIO;
+    case GDB_SIGNAL_XCPU:
+      return WINDOWS_SIGXCPU;
+    case GDB_SIGNAL_XFSZ:
+      return WINDOWS_SIGXFSZ;
+    case GDB_SIGNAL_VTALRM:
+      return WINDOWS_SIGVTALRM;
+    case GDB_SIGNAL_PROF:
+      return WINDOWS_SIGPROF;
+    case GDB_SIGNAL_WINCH:
+      return WINDOWS_SIGWINCH;
+    case GDB_SIGNAL_PWR:
+      return WINDOWS_SIGLOST;
+    case GDB_SIGNAL_USR1:
+      return WINDOWS_SIGUSR1;
+    case GDB_SIGNAL_USR2:
+      return WINDOWS_SIGUSR2;
+#endif /* __CYGWIN__ */
+    }
+  return -1;
+}
+
 /* To be called from the various GDB_OSABI_CYGWIN handlers for the
    various Windows architectures and machine types.  */
 
@@ -477,6 +605,8 @@ windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_iterate_over_objfiles_in_search_order
     (gdbarch, windows_iterate_over_objfiles_in_search_order);
 
+  set_gdbarch_gdb_signal_to_target (gdbarch, windows_gdb_signal_to_target);
+
   set_solib_ops (gdbarch, &solib_target_so_ops);
 }
 
index e28c168f5596f8e07728d522a3e0eb1e880944bc..cd0410494d89400358d7d0758fff132e318ac2bd 100644 (file)
@@ -1,3 +1,7 @@
+2020-01-07  Shahab Vahedi  <shahab@synopsys.com>
+
+       * opcode/arc.h (insn_class_t): Add 'LLOCK' and 'SCOND'.
+
 2020-01-02  Sergey Belyashov  <sergey.belyashov@gmail.com>
 
        * coff/internal.h: Add defintions of Z80 reloc names.
index 13368c04505649a79685a4de6fdae711c3d201e7..3a05cd893320592f197421d7041ff6bda786f19d 100644 (file)
@@ -64,6 +64,7 @@ typedef enum
   JUMP,
   KERNEL,
   LEAVE,
+  LLOCK,
   LOAD,
   LOGICAL,
   LOOP,
@@ -76,6 +77,7 @@ typedef enum
   PMU,
   POP,
   PUSH,
+  SCOND,
   SJLI,
   STORE,
   SUB,
index 476e6cb894c243c4e3ea40693999dccf84f75088..7ff108cbb0c9b79789f9f4cdbc04e63d37481b4e 100644 (file)
@@ -1,3 +1,39 @@
+2020-01-07  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-mips-elf/eh-frame5.s,
+       * testsuite/ld-mips-elf/ehdr_start-new.s,
+       * testsuite/ld-mips-elf/ehdr_start-o32.s,
+       * testsuite/ld-mips-elf/mips16-call-global-1.s,
+       * testsuite/ld-mips-elf/mips16-intermix-1.s,
+       * testsuite/ld-mips-elf/mips16-pic-1b.s,
+       * testsuite/ld-mips-elf/mips16-pic-4c.s,
+       * testsuite/ld-mips-elf/no-shared-1-n64.s,
+       * testsuite/ld-mips-elf/no-shared-1-o32.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-1b.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-2a.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-3b.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-4b.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-5a.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-6-n32c.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-6-n64c.s,
+       * testsuite/ld-mips-elf/pic-and-nonpic-6-o32c.s,
+       * testsuite/ld-mips-elf/pie.s,
+       * testsuite/ld-mips-elf/relax-jalr.s: Revert 2019-12-17 change.
+
+2020-01-06  Nick Clifton  <nickc@redhat.com>
+
+       PR 25327
+       * testsuite/ld-elf/shared.exp: Add -fcommon option to compiler
+       command line when building libcomm1.o and pr13250 tests.
+       * testsuite/ld-plugin/lto.exp: Likewise for pr20267 tests.
+
+2020-01-06  Nick Clifton  <nickc@redhat.com>
+
+       PR 25326
+       * testsuite/ld-elf/shared.exp: Add -fcommon option to compiler
+       command line when building pr19579 binaries.
+
 2020-01-03  Hannes Domani  <ssbssa@yahoo.de>
 
        * emultempl/pe.em: Add new option --enable-reloc-section.
index c47a9db997c0801e2cf8054ecdf4b7f850286ca5..e03906a142d3153336e03949ae291c4bc8c5155c 100644 (file)
@@ -603,7 +603,7 @@ set build_tests {
    "-shared" "-fPIC"
    {data2.c} {} "libdata2.so"}
   {"Build libcomm1.o"
-   "-r -nostdlib" ""
+   "-r -nostdlib" "-fcommon"
    {comm1.c} {} "libcomm1.o"}
   {"Build libfunc1.so"
    "-shared" "-fPIC"
@@ -634,16 +634,16 @@ set build_tests {
    "-r -nostdlib" ""
    {pr11138-2.c} {} "libpr11138-2.o"}
   {"Build pr13250-1.so"
-   "-shared" "-fPIC"
+   "-shared" "-fPIC -fcommon"
    {pr13250-1.c} {} "libpr13250-1.so"}
   {"Build pr13250-2.so with libpr13250-1.so"
-   "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC"
+   "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC -fcommon"
    {pr13250-2.c} {} "libpr13250-2.so"}
   {"Build libpr13250-3.o"
-   "-r -nostdlib" ""
+   "-r -nostdlib" "-fcommon"
    {pr13250-3.c} {} "libpr13250-3.o"}
   {"Build libpr14323-2.so"
-   "-shared" "-fPIC"
+   "-shared" "-fPIC -fcommon"
    {pr14323-2.c} {} "libpr14323-2.so"}
   {"Build pr14862-1.o"
    "-r -nostdlib" ""
@@ -879,7 +879,7 @@ set run_tests [list \
      "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \
      {dummy.c} "pr11138b" "pr11138.out" ] \
     [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \
-     "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" \
+     "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "-fcommon" \
      {dummy.c} "pr13250" "pass.out" ] \
     [list "Run with pr14323-1.c pr14323-2.so" \
      "-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \
@@ -1061,7 +1061,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr19579a.o" \
-           "" "-fPIE" \
+           "" "-fPIE -fcommon" \
            {pr19579a.c} \
            {} \
            "libpr19579a.a" \
@@ -1069,7 +1069,7 @@ if { [istarget *-*-linux*]
        [list \
            "Build libpr19579.so" \
            "-shared" \
-           "-fPIC" \
+           "-fPIC -fcommon" \
            {pr19579b.c} \
            {} \
            "libpr19579.so" \
@@ -1077,7 +1077,7 @@ if { [istarget *-*-linux*]
        [list \
            "Build libpr19579now.so" \
            "-shared -Wl,-z,now" \
-           "-fPIC" \
+           "-fPIC -fcommon" \
            {pr19579b.c} \
            {} \
            "libpr19579.so" \
index cf5a11c37aba81dee47ec2774760ed014e452a55..741a021685dbb822583a7263d4545f201a8bb4df 100644 (file)
@@ -2,7 +2,6 @@
        .cfi_personality 0x0,local_pers
        .cfi_lsda 0x0,LSDA
        .ent    f1
-       .type   f1, @function
 f1:
        nop
        .end    f1
@@ -12,7 +11,6 @@ f1:
        .cfi_personality 0x0,hidden_pers
        .cfi_lsda 0x0,LSDA
        .ent    f2
-       .type   f2, @function
 f2:
        nop
        .end    f2
@@ -22,7 +20,6 @@ f2:
        .cfi_personality 0x0,global_pers
        .cfi_lsda 0x0,LSDA
        .ent    f3
-       .type   f3, @function
 f3:
        nop
        .end    f3
@@ -32,7 +29,6 @@ f3:
        .cfi_personality 0x0,extern_pers
        .cfi_lsda 0x0,LSDA
        .ent    f4
-       .type   f4, @function
 f4:
        nop
        .end    f4
@@ -42,7 +38,6 @@ f4:
        .cfi_personality 0x80,local_indirect_ptr
        .cfi_lsda 0x0,LSDA
        .ent    f5
-       .type   f5, @function
 f5:
        nop
        .end    f5
@@ -52,7 +47,6 @@ f5:
        .cfi_personality 0x80,hidden_indirect_ptr
        .cfi_lsda 0x0,LSDA
        .ent    f6
-       .type   f6, @function
 f6:
        nop
        .end    f6
@@ -62,7 +56,6 @@ f6:
        .cfi_personality 0x80,global_indirect_ptr
        .cfi_lsda 0x0,LSDA
        .ent    f7
-       .type   f7, @function
 f7:
        nop
        .end    f7
@@ -72,7 +65,6 @@ f7:
        .cfi_personality 0x80,extern_indirect_ptr
        .cfi_lsda 0x0,LSDA
        .ent    f8
-       .type   f8, @function
 f8:
        nop
        .end    f8
@@ -80,7 +72,6 @@ f8:
 
 
        .ent    local_pers
-       .type   local_pers, @function
 local_pers:
        nop
        .end    local_pers
@@ -88,14 +79,12 @@ local_pers:
        .globl  hidden_pers
        .hidden hidden_pers
        .ent    hidden_pers
-       .type   hidden_pers, @function
 hidden_pers:
        nop
        .end    hidden_pers
 
        .globl  global_pers
        .ent    global_pers
-       .type   global_pers, @function
 global_pers:
        nop
        .end    global_pers
index ccf20db024a98cd0fb6e235258d31f922a14b662..5ee00dc4addb5732d676bb4125380fc3bb866f9a 100644 (file)
@@ -2,7 +2,6 @@
        .text
        .weak   __ehdr_start
        .globl  __start
-       .type   __start, @function
        .ent    __start
        .frame  $29, 0, $31
        .mask   0x00000000, 0
index 60a5854b9b8f10b92daea188466e9a83f7812052..09734473fa39989ad95fc12353cd067140bf94a1 100644 (file)
@@ -2,7 +2,6 @@
        .text
        .weak   __ehdr_start
        .globl  __start
-       .type   __start, @function
        .ent    __start
        .frame  $29, 0, $31
        .mask   0x00000000, 0
index 485e77c31ef80999610080a555b95e8496655d13..4c6d0a43aae4ab74d4162c76be1400dc16f8b3c8 100644 (file)
@@ -1,7 +1,6 @@
        .set    mips16
 
        .globl  __start
-       .type   __start, @function
        .ent    __start
        .align  4
 __start:
index 56527ea217b726a81e4878b7ef2d2e0783b41e76..c596619c9493e8b77e4db1faa7d861fb2d752ca2 100644 (file)
@@ -1,7 +1,6 @@
        .text
        .align  2
        .globl  __start
-       .type   __start, @function
        .set    nomips16
        .ent    __start
 __start:
index 1fc03c40eb714f563ff144cfffc3aac4f88b4594..9a17072f2e4632120a2a156443a96434c2b607be 100644 (file)
@@ -12,7 +12,6 @@
        callpic used21,mips16
 
        .globl  __start
-       .type   __start, @function
        .ent    __start
        .set    nomips16
 __start:
index 985a7f150d574dbd36f689041923569e452c6581..338d378d75693c165a1ac4e288143052e3bb2af1 100644 (file)
@@ -7,7 +7,6 @@
 
        .section .mips16.call.f2, "ax", @progbits
        .ent    __call
-       .type   __call, @function
 __call:
        la      $25,f2
        jr      $25
@@ -19,7 +18,6 @@ __call:
 
        .section .mips16.call.fp.f3, "ax", @progbits
        .ent    __call_fp
-       .type   __call_fp, @function
 __call_fp:
        la      $25,f3
        jr      $25
index c63b8c879c40eb1c2de01366860000ac2baf1058..8eedf12157b7c2ec9dc3a4364ca33d385587179b 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .text
        .globl  __start
-       .type   __start, @function
        .ent    __start
 __start:
        lui     $2,%hi(__gnu_local_gp)
index 80be39bf36a9eb6612d5e996bcfb1390e0c4f2b9..f00fc4ba91542a81dc0faba77c9e32164c2679fe 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .text
        .globl  __start
-       .type   __start, @function
        .ent    __start
 __start:
        lui     $2,%hi(__gnu_local_gp)
index abd015689123912f973af9af6cb78eec5babc26f..1eff3093c8b039c16408026ccb28eb5c818e419e 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .set    micromips
        .ent    __start
 __start:
index 2615f24a2242894279f45904d462488e013fb052..5739fef104df32dfb9afbb1cf4315f4685955150 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     f1
index f360b0eb2df9f5dc240862243f0f6e4c552cff62..45a490f945a81fd06545bf0dd98df773da328668 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     foo
index 2a9ad89dee62783e22ee3248fa172bdebf6d2cc4..571c774cdf7d578f2f2e08b8e512a122bfe14b0f 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     foo
@@ -9,7 +8,6 @@ __start:
        .end    __start
 
        .global ext
-       .type   ext, @function
        .ent    ext
 ext:
        lui     $gp,%hi(__gnu_local_gp)
index 863a01b02cc7b73f01ef90c32503b37c4d601f74..7e25bf48bf4a569ce957af1508c622de2592bf4f 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        lui     $2,%hi(obj1)
index e85655fbe1a6b005da0763fd5d064323ba582fc8..7452f5e8e3ae838999337f55994655ae2ed9645c 100644 (file)
@@ -1,7 +1,6 @@
        .abicalls
        .option pic0
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        lui     $2,%hi(foo)
index 3d5660c2ade64af2e1ad98de96ee76de6d967dfe..578626a18caff6369a26edde4e091b0dfda97acc 100644 (file)
@@ -2,7 +2,6 @@
        .option pic0
        .set    noreorder
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     f1
index 3d5660c2ade64af2e1ad98de96ee76de6d967dfe..578626a18caff6369a26edde4e091b0dfda97acc 100644 (file)
@@ -2,7 +2,6 @@
        .option pic0
        .set    noreorder
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     f1
index 3d5660c2ade64af2e1ad98de96ee76de6d967dfe..578626a18caff6369a26edde4e091b0dfda97acc 100644 (file)
@@ -2,7 +2,6 @@
        .option pic0
        .set    noreorder
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jal     f1
index 442de015006b57dfbaf333601609e13b689edb96..c7f2b206b9f7d1a9849aba59d6db938e8d6d63bd 100644 (file)
@@ -1,6 +1,5 @@
        .abicalls
        .global __start
-       .type   __start, @function
        .ent    __start
 __start:
        jr $31
index b8478faef027273e6a96e976232e0e6df30e1dc7..ba7ea1a04ddd2fe4a9bb5237ea7d4702f55565f4 100644 (file)
@@ -1,7 +1,6 @@
- .globl __start
- .type __start, @function
+.globl __start
        .space 8
- .ent __start
+.ent __start
 __start:
 .Lstart:
        .space 16
@@ -10,7 +9,7 @@ __start:
         jal __start
        .space 64
        jal .Lstart
- .end __start
+.end __start
 
 # make objdump print ...
        .space 8
index cf30ab5c55b4b6243b5d24771a6df98503e852ac..9b03b7b397730955e10808463c75c259e711f874 100644 (file)
@@ -192,19 +192,19 @@ set lto_link_tests [list \
    "$plug_opt" "-flto $lto_no_fat" \
    {pr19317.c} {} "libpr19317.a"] \
   [list "Build pr20276a.o" \
-   "" "-fno-lto" \
+   "" "-fno-lto -fcommon" \
    {pr20276a.c}] \
   [list "Build pr20276b.o" \
-   "$plug_opt" "-flto $lto_no_fat" \
+   "$plug_opt" "-flto $lto_no_fat -fcommon" \
    {pr20276b.c}] \
   [list "Build pr20267a.o" \
-   "" "" \
+   "" "-fcommon" \
    {pr20267a.c}] \
   [list "Build libpr20267a.a" \
-   "$plug_opt" "-flto $lto_fat" \
+   "$plug_opt" "-flto $lto_fat -fcommon" \
    {pr20267b.c} {} "libpr20267a.a"] \
   [list "Build libpr20267b.a" \
-   "$plug_opt" "-flto $lto_no_fat" \
+   "$plug_opt" "-flto $lto_no_fat -fcommon" \
    {pr20267b.c} {} "libpr20267b.a"] \
   [list "Build pr20321" \
    "-flto -Wl,-plugin,$plug_so" "-flto" \
@@ -437,14 +437,14 @@ set lto_run_tests [list \
    "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \
    {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \
   [list "Run pr20267a" \
-   "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \
-   {dummy.c} "pr20267a" "pass.out" "-flto -O2" "c"] \
+   "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \
+   {dummy.c} "pr20267a" "pass.out" "-flto -O2 -fcommon" "c"] \
   [list "Run pr20267b" \
-   "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \
-   {dummy.c} "pr20267b" "pass.out" "-flto -O2" "c"] \
+   "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \
+   {dummy.c} "pr20267b" "pass.out" "-flto -O2 -fcommon" "c"] \
   [list "Run pr22502" \
    "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
-   {dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
+   {dummy.c} "pr20267" "pass.out" "-flto -O2 -fcommon" "c"] \
   [list "Run pr22751" \
    "-O2 -flto" "" \
    {dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \
index 5dfb1fceb3295e7c2be7ca42960076ad872a5b52..220b9f4c5f98423b7bbe4b808e91036634d4a33b 100644 (file)
@@ -1,3 +1,25 @@
+2020-01-07  Shahab Vahedi  <shahab@synopsys.com>
+
+       * arc-tbl.h (llock): Use 'LLOCK' as class.
+       (llockd): Likewise.
+       (scond): Use 'SCOND' as class.
+       (scondd): Likewise.
+       (llockd): Set data_size_mode to 'C_ZZ_D' which is 64-bit.
+       (scondd): Likewise.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * m32c-ibld.c: Regenerate.
+
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       PR 25344
+       * z80-dis.c (suffix): Don't use a local struct buffer copy.
+       Peek at next byte to prevent recursion on repeated prefix bytes.
+       Ensure uninitialised "mybuf" is not accessed.
+       (print_insn_z80): Don't zero n_fetch and n_used here,..
+       (print_insn_z80_buf): ..do it here instead.
+
 2020-01-04  Alan Modra  <amodra@gmail.com>
 
        * m32r-ibld.c: Regenerate.
index 17fa97ab909a4e7f97ba17197b6e4fcc04c073d6..10625f1b36ca64954908eafcb197f7fdddb3d3fd 100644 (file)
 { "leave_s", 0x0000C0C0, 0x0000F8E1, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LEAVE, CD1, { UIMM7_11_S }, { 0 }},
 
 /* llock<.di> b,c 00100bbb00101111DBBBCCCCCC010000.  */
-{ "llock", 0x202F0010, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x202F0010, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
 
 /* llock<.di> 0,c 0010011000101111D111CCCCCC010000.  */
-{ "llock", 0x262F7010, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x262F7010, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, RC, BRAKETdup }, { C_DI16 }},
 
 /* llock<.di> b,u6 00100bbb01101111DBBBuuuuuu010000.  */
-{ "llock", 0x206F0010, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x206F0010, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
 
 /* llock<.di> 0,u6 0010011001101111D111uuuuuu010000.  */
-{ "llock", 0x266F7010, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x266F7010, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
 
 /* llock<.di> b,limm 00100bbb00101111DBBB111110010000.  */
-{ "llock", 0x202F0F90, 0xF8FF0FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x202F0F90, 0xF8FF0FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
 
 /* llock<.di> 0,limm 0010011000101111D111111110010000.  */
-{ "llock", 0x262F7F90, 0xFFFF7FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "llock", 0x262F7F90, 0xFFFF7FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
 
 /* llockd<.di> b,c 00100bbb00101111DBBBCCCCCC010010.  */
-{ "llockd", 0x202F0012, 0xF8FF003F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x202F0012, 0xF8FF003F, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* llockd<.di> 0,c 0010011000101111D111CCCCCC010010.  */
-{ "llockd", 0x262F7012, 0xFFFF703F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x262F7012, 0xFFFF703F, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, RC, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* llockd<.di> b,u6 00100bbb01101111DBBBuuuuuu010010.  */
-{ "llockd", 0x206F0012, 0xF8FF003F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x206F0012, 0xF8FF003F, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* llockd<.di> 0,u6 0010011001101111D111uuuuuu010010.  */
-{ "llockd", 0x266F7012, 0xFFFF703F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x266F7012, 0xFFFF703F, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* llockd<.di> b,limm 00100bbb00101111DBBB111110010010.  */
-{ "llockd", 0x202F0F92, 0xF8FF0FFF, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x202F0F92, 0xF8FF0FFF, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* llockd<.di> 0,limm 0010011000101111D111111110010010.  */
-{ "llockd", 0x262F7F92, 0xFFFF7FFF, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { ZA, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "llockd", 0x262F7F92, 0xFFFF7FFF, ARC_OPCODE_ARCv2HS, LLOCK, NONE, { ZA, BRAKET, LIMM, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* lp s13 00100RRR101010000RRRssssssSSSSSS.  */
 { "lp", 0x20A80000, 0xF8FF8000, ARC_OPCODE_ARC600 | ARC_OPCODE_ARC700, LOOP, NONE, { SIMM13_A16_20 }, { 0 }},
 { "sbcs", 0x2EE77F80, 0xFFFF7FE0, ARC_OPCODE_ARC600 | ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, ARITH, NONE, { ZA, LIMM, LIMMdup }, { C_F, C_CC }},
 
 /* scond<.di> b,c 00100bbb00101111DBBBCCCCCC010001.  */
-{ "scond", 0x202F0011, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x202F0011, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
 
 /* scond<.di> b,u6 00100bbb01101111DBBBuuuuuu010001.  */
-{ "scond", 0x206F0011, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x206F0011, 0xF8FF003F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
 
 /* scond<.di> b,limm 00100bbb00101111DBBB111110010001.  */
-{ "scond", 0x202F0F91, 0xF8FF0FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x202F0F91, 0xF8FF0FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
 
 /* scond<.di> limm,c 0010011000101111D111CCCCCC010001.  */
-{ "scond", 0x262F7011, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, MEMORY, NONE, { LIMM, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x262F7011, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, SCOND, NONE, { LIMM, BRAKET, RC, BRAKETdup }, { C_DI16 }},
 
 /* scond<.di> limm,u6 0010011001101111D111uuuuuu010001.  */
-{ "scond", 0x266F7011, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, MEMORY, NONE, { LIMM, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x266F7011, 0xFFFF703F, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, SCOND, NONE, { LIMM, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
 
 /* scond<.di> limm,limm 0010011000101111D111111110010001.  */
-{ "scond", 0x262F7F91, 0xFFFF7FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, MEMORY, NONE, { LIMM, BRAKET, LIMMdup, BRAKETdup }, { C_DI16 }},
+{ "scond", 0x262F7F91, 0xFFFF7FFF, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, SCOND, NONE, { LIMM, BRAKET, LIMMdup, BRAKETdup }, { C_DI16 }},
 
 /* scondd<.di> b,c 00100bbb00101111DBBBCCCCCC010011.  */
-{ "scondd", 0x202F0013, 0xF8FF003F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16 }},
+{ "scondd", 0x202F0013, 0xF8FF003F, ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, RC, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* scondd<.di> b,u6 00100bbb01101111DBBBuuuuuu010011.  */
-{ "scondd", 0x206F0013, 0xF8FF003F, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16 }},
+{ "scondd", 0x206F0013, 0xF8FF003F, ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, UIMM6_20, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* scondd<.di> b,limm 00100bbb00101111DBBB111110010011.  */
-{ "scondd", 0x202F0F93, 0xF8FF0FFF, ARC_OPCODE_ARCv2HS, MEMORY, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16 }},
+{ "scondd", 0x202F0F93, 0xF8FF0FFF, ARC_OPCODE_ARCv2HS, SCOND, NONE, { RB, BRAKET, LIMM, BRAKETdup }, { C_DI16, C_ZZ_D }},
 
 /* setacc a,b,c 00101bbb000011011BBBCCCCCCAAAAAA.  */
 { "setacc", 0x280D8000, 0xF8FF8000, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, DSP, NONE, { RA_CHK, RB, RC }, { 0 }},
index d1b476f4b1afc30f26e886c325f8a1dc0b087dd3..976b70b7a9b8aeafc399b808a72c94ee5211af07 100644 (file)
@@ -626,7 +626,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_BITBASE16_16_U16 :
       {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -672,7 +672,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_16_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -704,7 +704,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -723,7 +723,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -812,7 +812,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_32_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -834,7 +834,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_16_S16 :
       {
         long value = fields->f_dsp_16_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -844,7 +844,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_16_U16 :
       {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -856,7 +856,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -874,7 +874,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -929,7 +929,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_32_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -947,7 +947,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
           break;
         {
         long value = fields->f_dsp_32_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -960,7 +960,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_32_S16 :
       {
         long value = fields->f_dsp_32_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, buffer);
       }
       break;
@@ -970,7 +970,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_32_U16 :
       {
         long value = fields->f_dsp_32_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
       }
       break;
@@ -994,7 +994,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_40_S16 :
       {
         long value = fields->f_dsp_40_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, buffer);
       }
       break;
@@ -1004,7 +1004,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_40_U16 :
       {
         long value = fields->f_dsp_40_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 8, 16, 32, total_length, buffer);
       }
       break;
@@ -1028,7 +1028,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_48_S16 :
       {
         long value = fields->f_dsp_48_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -1038,7 +1038,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_48_U16 :
       {
         long value = fields->f_dsp_48_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -1050,7 +1050,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_48_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -1068,7 +1068,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_48_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -1084,7 +1084,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_8_S24 :
       {
         long value = fields->f_dsp_8_s24;
-        value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((EXTQISI (TRUNCSIQI (((value) & (255))))) << (16))));
+        value = ((((((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 24, 32, total_length, buffer);
       }
       break;
@@ -1094,7 +1094,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_DSP_8_U16 :
       {
         long value = fields->f_dsp_8_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 8, 16, 32, total_length, buffer);
       }
       break;
@@ -1237,7 +1237,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_IMM_16_HI :
       {
         long value = fields->f_dsp_16_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -1252,14 +1252,14 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_16_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
           break;
         {
         long value = fields->f_dsp_32_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -1307,7 +1307,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_IMM_32_HI :
       {
         long value = fields->f_dsp_32_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, buffer);
       }
       break;
@@ -1324,7 +1324,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_IMM_40_HI :
       {
         long value = fields->f_dsp_40_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, buffer);
       }
       break;
@@ -1352,7 +1352,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_IMM_48_HI :
       {
         long value = fields->f_dsp_48_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, buffer);
       }
       break;
@@ -1367,14 +1367,14 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 }
         {
         long value = fields->f_dsp_48_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
       }
         if (errmsg)
           break;
         {
         long value = fields->f_dsp_64_u16;
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         errmsg = insert_normal (cd, value, 0, 64, 0, 16, 32, total_length, buffer);
       }
         if (errmsg)
@@ -1408,7 +1408,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
     case M32C_OPERAND_IMM_8_HI :
       {
         long value = fields->f_dsp_8_s16;
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 16, 32, total_length, buffer);
       }
       break;
@@ -1826,7 +1826,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
       break;
@@ -1862,12 +1862,12 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_16_s16 = value;
       }
         if (length <= 0) break;
 {
-  FLD (f_bitbase32_16_s19_unprefixed) = ((((FLD (f_dsp_16_s16)) << (3))) | (FLD (f_bitno32_unprefixed)));
+  FLD (f_bitbase32_16_s19_unprefixed) = ((((FLD (f_dsp_16_s16)) * (8))) | (FLD (f_bitno32_unprefixed)));
 }
       }
       break;
@@ -1889,7 +1889,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
         if (length <= 0) break;
@@ -1905,7 +1905,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
         if (length <= 0) break;
@@ -1973,7 +1973,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_32_u16 = value;
       }
         if (length <= 0) break;
@@ -1998,7 +1998,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_16_s16 = value;
       }
       break;
@@ -2009,7 +2009,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
       break;
@@ -2018,7 +2018,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
         if (length <= 0) break;
@@ -2034,7 +2034,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
         if (length <= 0) break;
@@ -2080,7 +2080,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_32_u16 = value;
       }
         if (length <= 0) break;
@@ -2096,7 +2096,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_32_u16 = value;
       }
         if (length <= 0) break;
@@ -2112,7 +2112,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_32_s16 = value;
       }
       break;
@@ -2123,7 +2123,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_32_u16 = value;
       }
       break;
@@ -2150,7 +2150,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_40_s16 = value;
       }
       break;
@@ -2161,7 +2161,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_40_u16 = value;
       }
       break;
@@ -2188,7 +2188,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_48_s16 = value;
       }
       break;
@@ -2199,7 +2199,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_48_u16 = value;
       }
       break;
@@ -2208,7 +2208,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_48_u16 = value;
       }
         if (length <= 0) break;
@@ -2224,7 +2224,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_48_u16 = value;
       }
         if (length <= 0) break;
@@ -2242,7 +2242,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 24, 32, total_length, pc, & value);
-        value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((EXTQISI (TRUNCSIQI (((value) & (255))))) << (16))));
+        value = ((((((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608));
         fields->f_dsp_8_s24 = value;
       }
       break;
@@ -2253,7 +2253,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_8_u16 = value;
       }
       break;
@@ -2404,7 +2404,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_16_s16 = value;
       }
       break;
@@ -2416,14 +2416,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_16_u16 = value;
       }
         if (length <= 0) break;
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_32_u16 = value;
       }
         if (length <= 0) break;
@@ -2469,7 +2469,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_32_s16 = value;
       }
       break;
@@ -2488,7 +2488,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_40_s16 = value;
       }
       break;
@@ -2515,7 +2515,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_48_s16 = value;
       }
       break;
@@ -2527,14 +2527,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_48_u16 = value;
       }
         if (length <= 0) break;
         {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 64, 0, 16, 32, total_length, pc, & value);
-        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+        value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
         fields->f_dsp_64_u16 = value;
       }
         if (length <= 0) break;
@@ -2569,7 +2569,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 16, 32, total_length, pc, & value);
-        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+        value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
         fields->f_dsp_8_s16 = value;
       }
       break;
index 99be7f8abcfdcbcaffba2021f6bc24a29f872efe..581d4f4871249aaf883ddf771c775bebfc7acb55 100644 (file)
@@ -713,55 +713,57 @@ static int
 print_insn_z80_buf (struct buffer *buf, disassemble_info *info);
 
 static int
-suffix (struct buffer *buf_in, disassemble_info *info, const char *txt)
+suffix (struct buffer *buf, disassemble_info *info, const char *txt)
 {
-  struct buffer buf;
   char mybuf[TXTSIZ*4];
   fprintf_ftype old_fprintf;
   void *old_stream;
   char *p;
 
-  buf_in->n_used++;
-  buf = *buf_in;
-  buf.n_fetch = 0;
-  buf.n_used = 0;
-  buf.base++;
   switch (txt[2])
     {
     case 'l': /* SIL or LIL */
-      buf.nn_len = 3;
+      buf->nn_len = 3;
       break;
     case 's': /* SIS or LIS */
-      buf.nn_len = 2;
+      buf->nn_len = 2;
       break;
     default:
-      /* unknown suffix */
-      return -1;
+      abort ();
+    }
+  if (!fetch_data (buf, info, 1)
+      || buf->data[1] == 0x40
+      || buf->data[1] == 0x49
+      || buf->data[1] == 0x52
+      || buf->data[1] == 0x5b)
+    {
+      /* Double prefix, or end of data.  */
+      info->fprintf_func (info->stream, "nop ;%s", txt);
+      buf->n_used = 1;
+      return buf->n_used;
     }
+
   old_fprintf = info->fprintf_func;
   old_stream = info->stream;
-  info->fprintf_func = (fprintf_ftype)&sprintf;
+  info->fprintf_func = (fprintf_ftype) &sprintf;
   info->stream = mybuf;
-  print_insn_z80_buf(&buf, info);
+  buf->base++;
+  if (print_insn_z80_buf (buf, info) >= 0)
+    buf->n_used++;
   info->fprintf_func = old_fprintf;
   info->stream = old_stream;
 
-  for (p = &mybuf[0]; *p && *p != ' ' && *p != '.'; ++p)
-    ;
-
-  if (*p == '.') /* suffix already present */
+  for (p = mybuf; *p; ++p)
+    if (*p == ' ')
+      break;
+  if (*p)
     {
-      info->fprintf_func(info->stream, "nop ;%s", txt); /* double prefix */
-      return buf_in->n_used;
+      *p++ = '\0';
+      info->fprintf_func (info->stream, "%s.%s %s", mybuf, txt, p);
     }
-
-  *p++ = '\0';
-  info->fprintf_func(info->stream, *p ? "%s.%s %s" : "%s.%s", mybuf, txt, p);
-
-  memcpy(&buf_in->data[1], buf.data, sizeof(buf.data)-1);
-  buf_in->n_used += buf.n_used;
-  buf_in->n_fetch += buf.n_fetch;
-  return buf_in->n_used;
+  else
+    info->fprintf_func (info->stream, "%s.%s", mybuf, txt);
+  return buf->n_used;
 }
 
 /* Table to disassemble machine codes without prefix.  */
@@ -839,8 +841,6 @@ print_insn_z80 (bfd_vma addr, disassemble_info * info)
   struct buffer buf;
 
   buf.base = addr;
-  buf.n_fetch = 0;
-  buf.n_used = 0;
   buf.inss = 1 << info->mach;
   buf.nn_len = info->mach == bfd_mach_ez80_adl ? 3 : 2;
   info->bytes_per_line = (buf.inss & INSS_EZ80) ? 6 : 4; /* <ss pp oo nn mm MM> OR <pp oo nn mm> */
@@ -853,6 +853,8 @@ print_insn_z80_buf (struct buffer *buf, disassemble_info *info)
 {
   struct tab_elt *p;
 
+  buf->n_fetch = 0;
+  buf->n_used = 0;
   if (! fetch_data (buf, info, 1))
     return -1;
 
This page took 0.095651 seconds and 4 git commands to generate.