/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright (C) 1992-2016 Free Software Foundation, Inc.
+ Copyright (C) 1992-2019 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
for (idx = 0; md_pseudo_table[idx].poc_name; idx++)
{
opcode_entry_type *fake_opcode;
- fake_opcode = (opcode_entry_type *) malloc (sizeof (opcode_entry_type));
+ fake_opcode = XNEW (opcode_entry_type);
fake_opcode->name = md_pseudo_table[idx].poc_name;
fake_opcode->func = (void *) (md_pseudo_table + idx);
fake_opcode->opcode = 250;
static char buffer[20];
static void
-newfix (int ptr, int type, int size, expressionS *operand)
+newfix (int ptr, bfd_reloc_code_real_type type, int size, expressionS *operand)
{
- int is_pcrel = 0;
fixS *fixP;
/* Size is in nibbles. */
|| operand->X_op_symbol
|| operand->X_add_number)
{
+ int is_pcrel;
switch(type)
{
case BFD_RELOC_8_PCREL:
case BFD_RELOC_Z8K_CALLR:
case BFD_RELOC_Z8K_DISP7:
is_pcrel = 1;
+ break;
+ default:
+ is_pcrel = 0;
+ break;
}
fixP = fix_new_exp (frag_now, ptr, size / 2,
operand, is_pcrel, type);
}
static char *
-apply_fix (char *ptr, int type, expressionS *operand, int size)
+apply_fix (char *ptr, bfd_reloc_code_real_type type, expressionS *operand,
+ int size)
{
long n = operand->X_add_number;
*ptr++ = n >> 24;
*ptr++ = n >> 20;
*ptr++ = n >> 16;
+ /* Fall through. */
case 4: /* 4 nibbles == 16 bits. */
*ptr++ = n >> 12;
*ptr++ = n >> 8;
+ /* Fall through. */
case 2:
*ptr++ = n >> 4;
+ /* Fall through. */
case 1:
*ptr++ = n >> 0;
break;
case CLASS_REG_WORD:
case CLASS_REG_LONG:
case CLASS_REG_QUAD:
- /* Insert bit mattern of right reg. */
+ /* Insert bit pattern of right reg. */
*output_ptr++ = reg[c & 0xf];
break;
case CLASS_DISP:
/*case ARG_IMMNMINUS1: not used. */
case ARG_IMM4M1:
imm_operand->X_add_number--;
- /* Drop through. */
+ /* Fall through. */
case ARG_IMM4:
if (imm_operand->X_add_number > 15)
as_bad (_("immediate value out of range"));
break;
case ARG_NIM8:
imm_operand->X_add_number = -imm_operand->X_add_number;
- /* Drop through. */
+ /* Fall through. */
case ARG_IMM8:
output_ptr = apply_fix (output_ptr, BFD_RELOC_8, imm_operand, 2);
break;
{
arelent *reloc;
- reloc = xmalloc (sizeof (*reloc));
- reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+ reloc = XNEW (arelent);
+ reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
valueT
md_section_align (segT seg, valueT size)
{
- int align = bfd_get_section_alignment (stdoutput, seg);
+ int align = bfd_section_alignment (seg);
valueT mask = ((valueT) 1 << align) - 1;
return (size + mask) & ~mask;