Wed Sep 7 17:21:12 1994 Steve Chamberlain (sac@jonny.cygnus.com)

* config/tc-{h8300,sh}.[ch] (tc_coff_symbol_emit): Function doing nothing
	becomes macro doing nothing.
This commit is contained in:
Steve Chamberlain 1994-09-08 00:38:17 +00:00
parent 1be01033cf
commit 351efc8130
2 changed files with 180 additions and 129 deletions

View file

@ -265,6 +265,21 @@ parse_reg (src, mode, reg)
return 0;
}
static symbolS *dot()
{
const char *fake;
/* JF: '.' is pseudo symbol with value of current location
in current segment. */
fake = FAKE_LABEL_NAME;
return symbol_new (fake,
now_seg,
(valueT) frag_now_fix (),
frag_now);
}
static
char *
parse_exp (s)
@ -272,33 +287,15 @@ parse_exp (s)
{
char *save;
char *new;
segT seg;
save = input_line_pointer;
input_line_pointer = s;
seg = expr (0, &immediate);
expression (&immediate);
if (immediate.X_op == O_absent)
as_bad ("missing operand");
new = input_line_pointer;
input_line_pointer = save;
if (SEG_NORMAL (seg))
return new;
switch (seg)
{
case SEG_ABSOLUTE:
case SEG_UNKNOWN:
case SEG_DIFFERENCE:
case SEG_BIG:
case SEG_REGISTER:
return new;
case SEG_ABSENT:
as_bad ("Missing operand");
return new;
default:
as_bad ("Don't understand operand of type %s", segment_name (seg));
return new;
}
}
@ -393,6 +390,11 @@ parse_at (src, op)
}
else if (mode == A_DISP_PC)
{
/* Turn a plain @(4,pc) into @(.+4,pc) */
if (immediate.X_op == O_constant) {
immediate.X_add_symbol = dot();
immediate.X_op = O_symbol;
}
op->type = A_DISP_PC;
}
else
@ -609,7 +611,7 @@ check (operand, low, high)
int low;
int high;
{
if (operand->X_seg != SEG_ABSOLUTE
if (operand->X_op != O_constant
|| operand->X_add_number < low
|| operand->X_add_number > high)
{
@ -625,12 +627,10 @@ insert (where, how, pcrel)
int how;
int pcrel;
{
fix_new (frag_now,
fix_new_exp (frag_now,
where - frag_now->fr_literal,
4,
immediate.X_add_symbol,
immediate.X_subtract_symbol,
immediate.X_add_number,
&immediate,
pcrel,
how);
@ -723,10 +723,10 @@ build_Mytes (opcode, operand)
insert (output + 1, R_SH_IMM8, 0);
break;
case PCRELIMM_8BY4:
insert (output + 1, R_SH_PCRELIMM8BY4, 0);
insert (output + 1, R_SH_PCRELIMM8BY4, 1);
break;
case PCRELIMM_8BY2:
insert (output + 1, R_SH_PCRELIMM8BY2, 0);
insert (output + 1, R_SH_PCRELIMM8BY2, 1);
break;
default:
printf ("failed for %d\n", i);
@ -750,25 +750,26 @@ md_assemble (str)
unsigned char *op_end;
sh_operand_info operand[2];
sh_opcode_info *opcode;
unsigned char *name;
char name[20];
int nlen = 0;
char *p;
/* Drop leading whitespace */
while (*str == ' ')
str++;
/* find the op code end */
for (name = op_start = op_end = (unsigned char *) (str);
*op_end &&
!is_end_of_line[*op_end] && *op_end != ' ';
for (op_start = op_end = (unsigned char *) (str);
*op_end
&& nlen < 20
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
name[nlen] = op_start[nlen];
nlen++;
}
name[nlen] = 0;
if (op_end == op_start)
if (nlen == 0)
{
as_bad ("can't find opcode ");
}
@ -784,13 +785,15 @@ md_assemble (str)
if (opcode->arg[0] == A_BDISP12
|| opcode->arg[0] == A_BDISP8)
{
input_line_pointer = parse_exp (op_end + 1);
parse_exp (op_end + 1);
build_relax (opcode);
}
else
{
input_line_pointer = get_operands (opcode, op_end, operand);
if (opcode->arg[0] != A_END)
{
get_operands (opcode, op_end, operand);
}
opcode = get_specific (opcode, operand);
if (opcode == 0)
@ -830,11 +833,6 @@ DEFUN (tc_headers_hook, (headers),
printf ("call to tc_headers_hook \n");
}
void
DEFUN_VOID (md_end)
{
}
/* Various routines to kill one day */
/* Equal to MAX_PRECISION in atof-ieee.c */
#define MAX_LITTLENUMS 6
@ -895,24 +893,44 @@ md_atof (type, litP, sizeP)
md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
return ""; /* Someone should teach Dean about null pointers */
return 0;
}
CONST char *md_shortopts = "";
struct option md_longopts[] = {
#define OPTION_RELAX (OPTION_MD_BASE)
{"relax", no_argument, NULL, OPTION_RELAX},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof(md_longopts);
int
md_parse_option (argP, cntP, vecP)
char **argP;
int *cntP;
char ***vecP;
md_parse_option (c, arg)
int c;
char *arg;
{
if (!strcmp (*argP, "relax"))
switch (c)
{
case OPTION_RELAX:
relax = 1;
**argP = 0;
break;
default:
return 0;
}
return 1;
}
void
md_show_usage (stream)
FILE *stream;
{
fprintf(stream, "\
SH options:\n\
-relax alter jump instructions for long displacements\n");
}
int md_short_jump_size;
void
@ -964,7 +982,8 @@ md_convert_frag (headers, fragP)
int disp = targ_addr - next_inst - 2;
disp /= 2;
md_number_to_chars (buffer + 1, disp, 1);
md_number_to_chars (buffer + 1, disp & 0xff, 1);
fragP->fr_fix += 2;
fragP->fr_var = 0;
}
@ -980,7 +999,7 @@ md_convert_frag (headers, fragP)
disp /= 2;
t = buffer[0] & 0xf0;
md_number_to_chars (buffer, disp, 2);
md_number_to_chars (buffer, disp & 0xfff, 2);
buffer[0] = (buffer[0] & 0xf) | t;
fragP->fr_fix += 2;
fragP->fr_var = 0;
@ -1026,7 +1045,6 @@ md_convert_frag (headers, fragP)
fragP->fr_fix + 4,
4,
fragP->fr_symbol,
0,
fragP->fr_offset,
0,
R_SH_IMM32);
@ -1045,7 +1063,7 @@ md_convert_frag (headers, fragP)
int disp = targ_addr - next_inst;
disp /= 2;
md_number_to_chars (buffer + 2, disp, 2);
md_number_to_chars (buffer + 2, disp & 0xfff, 2);
buffer[0] ^= 0x2; /* Toggle T/F bit */
buffer[1] = 1; /* branch over jump and nop */
buffer[2] = (buffer[2] & 0xf) | 0xa0; /* Build jump insn */
@ -1096,7 +1114,6 @@ md_convert_frag (headers, fragP)
fragP->fr_fix + 8,
4,
fragP->fr_symbol,
0,
fragP->fr_offset,
0,
R_SH_IMM32);
@ -1112,8 +1129,9 @@ md_convert_frag (headers, fragP)
if (donerelax && !relax)
{
as_bad ("Offset doesn't fit at 0x%x, trying to get to 0x%x",
as_warn ("Offset doesn't fit at 0x%x, trying to get to %s+0x%x",
fragP->fr_address,
fragP->fr_symbol ? S_GET_NAME(fragP->fr_symbol): "",
targ_addr);
}
@ -1138,6 +1156,9 @@ md_apply_fix (fixP, val)
int addr = fixP->fx_frag->fr_address + fixP->fx_where;
if (fixP->fx_r_type == 0)
{
if (fixP->fx_size == 2)
fixP->fx_r_type = R_SH_IMM16;
else
fixP->fx_r_type = R_SH_IMM32;
}
@ -1170,10 +1191,11 @@ md_apply_fix (fixP, val)
case R_SH_PCRELIMM8BY4:
addr &= ~1;
#if 0
if (val & 0x3)
as_warn ("non aligned displacement at %x\n", addr);
val -= (addr + 4);
#endif
/* val -= (addr + 4); */
val += 3;
val /= 4;
if (val & ~0xff)
@ -1186,7 +1208,7 @@ md_apply_fix (fixP, val)
addr &= ~1;
if (val & 0x1)
as_bad ("odd displacement at %x\n", addr);
val -= (addr + 4);
/* val -= (addr + 4); */
val++;
val /= 2;
if (val & ~0xff)
@ -1201,6 +1223,11 @@ md_apply_fix (fixP, val)
*buf++ = val >> 0;
break;
case R_SH_IMM16:
*buf++ = val >> 8;
*buf++ = val >> 0;
break;
default:
abort ();
}
@ -1283,36 +1310,17 @@ md_number_to_chars (ptr, use, nbytes)
valueT use;
int nbytes;
{
switch (nbytes)
{
case 4:
*ptr++ = (use >> 24) & 0xff;
case 3:
*ptr++ = (use >> 16) & 0xff;
case 2:
*ptr++ = (use >> 8) & 0xff;
case 1:
*ptr++ = (use >> 0) & 0xff;
break;
default:
abort ();
}
number_to_chars_bigendian (ptr, use, nbytes);
}
long
md_pcrel_from (fixP)
fixS *fixP;
{
int gap = fixP->fx_size + fixP->fx_where +
fixP->fx_frag->fr_address;
int gap = fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address - 1 ;
return gap;
}
void
tc_coff_symbol_emit_hook ()
{
}
short
tc_coff_fix2rtype (fix_ptr)
fixS *fix_ptr;
@ -1385,6 +1393,3 @@ tc_coff_sizemachdep (frag)
{
return md_relax_table[frag->fr_subtype].rlx_length;
}
/* end of tc-sh.c */

46
gas/config/tc-sh.h Normal file
View file

@ -0,0 +1,46 @@
/* This file is tc-sh.h
Copyright (C) 1993 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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 2, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TC_SH
/* This macro translates between an internal fix and an coff reloc type */
#define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP)
#define BFD_ARCH bfd_arch_sh
#define COFF_MAGIC 0x0500
/* Write out relocs which haven't been done by gas */
#define TC_COUNT_RELOC(x) (((x)->fx_addsy))
#define IGNORE_NONSTANDARD_ESCAPES
#define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle(a,b,c)
#define tc_coff_symbol_emit_hook(a) ; /* not used */
#define DO_NOT_STRIP 0
#define DO_STRIP 0
#define LISTING_HEADER "Hitachi Super-H GAS "
#define NEED_FX_R_TYPE 1
#define RELOC_32 1234
#define COFF_FLAGS 1
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
/* end of tc-sh.h */