+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.
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,
}
/* 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. */
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;
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)
{
goto err_ret;
}
}
- else if (bfd_get_error () != bfd_error_wrong_format)
- goto err_ret;
}
if (best_count == 1)
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;
unsigned int nameoff;
unsigned int namelen;
+ if (command->len < sizeof (raw) + 8)
+ return FALSE;
switch (command->type)
{
case BFD_MACH_O_LC_LOAD_DYLIB:
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);
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;
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;
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;
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);
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));
/* 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;
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;
{
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;
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;
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;
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;
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);
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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)
{
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);
/* 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++;
/* 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++;
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@
/* 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",
{
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. */
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
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
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
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;
/* 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);
/* 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);
/* 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);
/* 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);
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)
/* 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 ();
/* 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);
/* 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);
/* 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);
/* 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))
}
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:
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. */
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;
-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.
(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)))
)
)
+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
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
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);
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++;
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
/* 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);
}
}
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);
+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
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 \
*** 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.
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
/* True if styling is enabled. */
-#if defined (__MSDOS__) || defined (__CYGWIN__)
+#if defined (__MSDOS__)
bool cli_styling = false;
#else
bool cli_styling = true;
}
}
+ if (expptr == 0)
+ {
+ /* no section contains export table rva */
+ return;
+ }
+
export_rva = export_opthdrrva;
export_size = export_opthdrsize;
+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.
$(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 \
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 \
#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>
"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;
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));
--- /dev/null
+/* 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__ */
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
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. */
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)
{
+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'.
--- /dev/null
+/* 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 ();
+}
--- /dev/null
+# 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\]+" ]
#include "gdb_curses.h"
-struct tui_asm_line
+struct tui_asm_line
{
CORE_ADDR addr;
std::string addr_string;
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. */
do
{
CORE_ADDR next_addr;
-
+
pos++;
if (pos >= max_lines)
pos = 0;
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
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
#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
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;
#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
}
}
+/* 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. */
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);
}
+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.
JUMP,
KERNEL,
LEAVE,
+ LLOCK,
LOAD,
LOGICAL,
LOOP,
PMU,
POP,
PUSH,
+ SCOND,
SJLI,
STORE,
SUB,
+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.
"-shared" "-fPIC"
{data2.c} {} "libdata2.so"}
{"Build libcomm1.o"
- "-r -nostdlib" ""
+ "-r -nostdlib" "-fcommon"
{comm1.c} {} "libcomm1.o"}
{"Build libfunc1.so"
"-shared" "-fPIC"
"-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" ""
"-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" "" \
] \
[list \
"Build pr19579a.o" \
- "" "-fPIE" \
+ "" "-fPIE -fcommon" \
{pr19579a.c} \
{} \
"libpr19579a.a" \
[list \
"Build libpr19579.so" \
"-shared" \
- "-fPIC" \
+ "-fPIC -fcommon" \
{pr19579b.c} \
{} \
"libpr19579.so" \
[list \
"Build libpr19579now.so" \
"-shared -Wl,-z,now" \
- "-fPIC" \
+ "-fPIC -fcommon" \
{pr19579b.c} \
{} \
"libpr19579.so" \
.cfi_personality 0x0,local_pers
.cfi_lsda 0x0,LSDA
.ent f1
- .type f1, @function
f1:
nop
.end f1
.cfi_personality 0x0,hidden_pers
.cfi_lsda 0x0,LSDA
.ent f2
- .type f2, @function
f2:
nop
.end f2
.cfi_personality 0x0,global_pers
.cfi_lsda 0x0,LSDA
.ent f3
- .type f3, @function
f3:
nop
.end f3
.cfi_personality 0x0,extern_pers
.cfi_lsda 0x0,LSDA
.ent f4
- .type f4, @function
f4:
nop
.end f4
.cfi_personality 0x80,local_indirect_ptr
.cfi_lsda 0x0,LSDA
.ent f5
- .type f5, @function
f5:
nop
.end f5
.cfi_personality 0x80,hidden_indirect_ptr
.cfi_lsda 0x0,LSDA
.ent f6
- .type f6, @function
f6:
nop
.end f6
.cfi_personality 0x80,global_indirect_ptr
.cfi_lsda 0x0,LSDA
.ent f7
- .type f7, @function
f7:
nop
.end f7
.cfi_personality 0x80,extern_indirect_ptr
.cfi_lsda 0x0,LSDA
.ent f8
- .type f8, @function
f8:
nop
.end f8
.ent local_pers
- .type local_pers, @function
local_pers:
nop
.end 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
.text
.weak __ehdr_start
.globl __start
- .type __start, @function
.ent __start
.frame $29, 0, $31
.mask 0x00000000, 0
.text
.weak __ehdr_start
.globl __start
- .type __start, @function
.ent __start
.frame $29, 0, $31
.mask 0x00000000, 0
.set mips16
.globl __start
- .type __start, @function
.ent __start
.align 4
__start:
.text
.align 2
.globl __start
- .type __start, @function
.set nomips16
.ent __start
__start:
callpic used21,mips16
.globl __start
- .type __start, @function
.ent __start
.set nomips16
__start:
.section .mips16.call.f2, "ax", @progbits
.ent __call
- .type __call, @function
__call:
la $25,f2
jr $25
.section .mips16.call.fp.f3, "ax", @progbits
.ent __call_fp
- .type __call_fp, @function
__call_fp:
la $25,f3
jr $25
.abicalls
.text
.globl __start
- .type __start, @function
.ent __start
__start:
lui $2,%hi(__gnu_local_gp)
.abicalls
.text
.globl __start
- .type __start, @function
.ent __start
__start:
lui $2,%hi(__gnu_local_gp)
.abicalls
.option pic0
.global __start
- .type __start, @function
.set micromips
.ent __start
__start:
.abicalls
.option pic0
.global __start
- .type __start, @function
.ent __start
__start:
jal f1
.abicalls
.option pic0
.global __start
- .type __start, @function
.ent __start
__start:
jal foo
.abicalls
.option pic0
.global __start
- .type __start, @function
.ent __start
__start:
jal foo
.end __start
.global ext
- .type ext, @function
.ent ext
ext:
lui $gp,%hi(__gnu_local_gp)
.abicalls
.option pic0
.global __start
- .type __start, @function
.ent __start
__start:
lui $2,%hi(obj1)
.abicalls
.option pic0
.global __start
- .type __start, @function
.ent __start
__start:
lui $2,%hi(foo)
.option pic0
.set noreorder
.global __start
- .type __start, @function
.ent __start
__start:
jal f1
.option pic0
.set noreorder
.global __start
- .type __start, @function
.ent __start
__start:
jal f1
.option pic0
.set noreorder
.global __start
- .type __start, @function
.ent __start
__start:
jal f1
.abicalls
.global __start
- .type __start, @function
.ent __start
__start:
jr $31
- .globl __start
- .type __start, @function
+.globl __start
.space 8
- .ent __start
+.ent __start
__start:
.Lstart:
.space 16
jal __start
.space 64
jal .Lstart
- .end __start
+.end __start
# make objdump print ...
.space 8
"$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" \
"-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" "" \
+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.
{ "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 }},
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;
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)
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)
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)
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)
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;
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;
}
{
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)
}
{
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)
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)
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;
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;
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;
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;
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;
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;
}
{
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)
}
{
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)
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;
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;
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;
}
{
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)
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;
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;
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;
}
{
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)
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;
{
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;
{
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;
{
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, 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;
{
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;
{
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;
{
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, 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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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, 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|(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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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;
{
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;
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. */
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> */
{
struct tab_elt *p;
+ buf->n_fetch = 0;
+ buf->n_used = 0;
if (! fetch_data (buf, info, 1))
return -1;