2000-08-01 Kazu Hirata <kazu@hxi.com>

* config/obj-som.c: Fix formatting.
	* config/obj-ieee.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-v850.c: Likewise.
This commit is contained in:
Kazu Hirata
2000-08-01 19:02:49 +00:00
parent a570e63968
commit 28e4f854cf
5 changed files with 1957 additions and 1815 deletions

View File

@@ -1,3 +1,10 @@
2000-08-01 Kazu Hirata <kazu@hxi.com>
* config/obj-som.c: Fix formatting.
* config/obj-ieee.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-v850.c: Likewise.
2000-08-01 Nick Clifton <nickc@redhat.com> 2000-08-01 Nick Clifton <nickc@redhat.com>
* doc/c-m68k.texi (section M680x0 Options): Turn into a table * doc/c-m68k.texi (section M680x0 Options): Turn into a table

View File

@@ -1,5 +1,6 @@
/* obj-format for ieee-695 records. /* obj-format for ieee-695 records.
Copyright (C) 1991, 92, 93, 94, 95, 1997, 1998 Free Software Foundation, Inc. Copyright (C) 1991, 92, 93, 94, 95, 97, 98, 2000
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@@ -18,17 +19,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
/* Created by Steve Chamberlain <steve@cygnus.com>. */
/* /* This will hopefully become the port through which bfd and gas talk,
created by for the moment, only ieee is known to work well. */
steve chamberlain steve@cygnus.com
*/
/*
this will hopefully become the port through which bfd and gas talk,
for the moment, only ieee is known to work well.
*/
#include "bfd.h" #include "bfd.h"
#include "as.h" #include "as.h"
@@ -39,10 +33,14 @@
bfd *abfd; bfd *abfd;
/* How many addresses does the .align take? */ /* How many addresses does the .align take? */
static relax_addressT static relax_addressT
relax_align (address, alignment) relax_align (address, alignment)
register relax_addressT address; /* Address now. */ /* Address now. */
register long alignment; /* Alignment (binary). */ register relax_addressT address;
/* Alignment (binary). */
register long alignment;
{ {
relax_addressT mask; relax_addressT mask;
relax_addressT new_address; relax_addressT new_address;
@@ -50,10 +48,11 @@ relax_align (address, alignment)
mask = ~((~0) << alignment); mask = ~((~0) << alignment);
new_address = (address + mask) & (~mask); new_address = (address + mask) & (~mask);
return (new_address - address); return (new_address - address);
} /* relax_align() */ }
/* Calculate the size of the frag chain
and create a bfd section to contain all of it. */
/* calculate the size of the frag chain and create a bfd section
to contain all of it */
static void static void
size_section (abfd, idx) size_section (abfd, idx)
bfd *abfd; bfd *abfd;
@@ -62,6 +61,7 @@ size_section (abfd, idx)
asection *sec; asection *sec;
unsigned int size = 0; unsigned int size = 0;
fragS *frag = segment_info[idx].frag_root; fragS *frag = segment_info[idx].frag_root;
while (frag) while (frag)
{ {
if (frag->fr_address != size) if (frag->fr_address != size)
@@ -92,25 +92,28 @@ size_section (abfd, idx)
if (size) if (size)
{ {
char *name = segment_info[idx].name; char *name = segment_info[idx].name;
if (name == (char *) NULL) if (name == (char *) NULL)
{
name = ".data"; name = ".data";
}
segment_info[idx].user_stuff = (char *) (sec = bfd_make_section (abfd, name)); segment_info[idx].user_stuff =
/* Make it output through itself */ (char *) (sec = bfd_make_section (abfd, name));
/* Make it output through itself. */
sec->output_section = sec; sec->output_section = sec;
sec->flags |= SEC_HAS_CONTENTS; sec->flags |= SEC_HAS_CONTENTS;
bfd_set_section_size (abfd, sec, size); bfd_set_section_size (abfd, sec, size);
} }
} }
/* run through a frag chain and write out the data to go with it */ /* Run through a frag chain and write out the data to go with it. */
static void static void
fill_section (abfd, idx) fill_section (abfd, idx)
bfd *abfd; bfd *abfd;
unsigned int idx; unsigned int idx;
{ {
asection *sec = segment_info[idx].user_stuff; asection *sec = segment_info[idx].user_stuff;
if (sec) if (sec)
{ {
fragS *frag = segment_info[idx].frag_root; fragS *frag = segment_info[idx].frag_root;
@@ -156,7 +159,7 @@ fill_section (abfd, idx)
} }
} }
/* Count the relocations in a chain */ /* Count the relocations in a chain. */
static unsigned int static unsigned int
count_entries_in_chain (idx) count_entries_in_chain (idx)
@@ -165,7 +168,7 @@ count_entries_in_chain (idx)
unsigned int nrelocs; unsigned int nrelocs;
fixS *fixup_ptr; fixS *fixup_ptr;
/* Count the relocations */ /* Count the relocations. */
fixup_ptr = segment_info[idx].fix_root; fixup_ptr = segment_info[idx].fix_root;
nrelocs = 0; nrelocs = 0;
while (fixup_ptr != (fixS *) NULL) while (fixup_ptr != (fixS *) NULL)
@@ -176,7 +179,8 @@ count_entries_in_chain (idx)
return nrelocs; return nrelocs;
} }
/* output all the relocations for a section */ /* Output all the relocations for a section. */
void void
do_relocs_for (idx) do_relocs_for (idx)
unsigned int idx; unsigned int idx;
@@ -188,11 +192,13 @@ do_relocs_for (idx)
asection *section = (asection *) (segment_info[idx].user_stuff); asection *section = (asection *) (segment_info[idx].user_stuff);
unsigned int i; unsigned int i;
fixS *from; fixS *from;
if (section) if (section)
{ {
nrelocs = count_entries_in_chain (idx); nrelocs = count_entries_in_chain (idx);
reloc_ptr_vector = (arelent **) malloc ((nrelocs + 1) * sizeof (arelent *)); reloc_ptr_vector =
(arelent **) malloc ((nrelocs + 1) * sizeof (arelent *));
reloc_vector = (arelent *) malloc (nrelocs * sizeof (arelent)); reloc_vector = (arelent *) malloc (nrelocs * sizeof (arelent));
ptrs = (asymbol **) malloc (nrelocs * sizeof (asymbol *)); ptrs = (asymbol **) malloc (nrelocs * sizeof (asymbol *));
from = segment_info[idx].fix_root; from = segment_info[idx].fix_root;
@@ -203,8 +209,10 @@ do_relocs_for (idx)
reloc_ptr_vector[i] = to; reloc_ptr_vector[i] = to;
to->howto = (reloc_howto_type *) (from->fx_r_type); to->howto = (reloc_howto_type *) (from->fx_r_type);
#if 0 /* We can't represent complicated things in a reloc yet */ #if 0
if (from->fx_addsy == 0 || from->fx_subsy != 0) abort(); /* We can't represent complicated things in a reloc yet. */
if (from->fx_addsy == 0 || from->fx_subsy != 0)
abort ();
#endif #endif
s = &(from->fx_addsy->sy_symbol.sy); s = &(from->fx_addsy->sy_symbol.sy);
@@ -233,11 +241,10 @@ do_relocs_for (idx)
to->sym_ptr_ptr = 0; to->sym_ptr_ptr = 0;
if (to->howto->pcrel_offset) if (to->howto->pcrel_offset)
{ /* This is a pcrel relocation, the addend should
/* This is a pcrel relocation, the addend should be adjusted */ be adjusted. */
to->addend -= to->address + 1; to->addend -= to->address + 1;
} }
}
else else
{ {
to->section = 0; to->section = 0;
@@ -245,30 +252,27 @@ do_relocs_for (idx)
to->sym_ptr_ptr = ptrs; to->sym_ptr_ptr = ptrs;
if (to->howto->pcrel_offset) if (to->howto->pcrel_offset)
{ /* This is a pcrel relocation, the addend should
/* This is a pcrel relocation, the addend should be adjusted */ be adjusted. */
to->addend -= to->address - 1; to->addend -= to->address - 1;
} }
} }
}
else else
{
to->section = 0; to->section = 0;
}
ptrs++; ptrs++;
from = from->fx_next; from = from->fx_next;
} }
/* attatch to the section */ /* Attatch to the section. */
section->orelocation = reloc_ptr_vector; section->orelocation = reloc_ptr_vector;
section->reloc_count = nrelocs; section->reloc_count = nrelocs;
section->flags |= SEC_LOAD; section->flags |= SEC_LOAD;
} }
} }
/* do the symbols.. */ /* Do the symbols. */
static void static void
do_symbols (abfd) do_symbols (abfd)
bfd *abfd; bfd *abfd;
@@ -280,7 +284,6 @@ do_symbols (abfd)
unsigned int count = 0; unsigned int count = 0;
unsigned int index; unsigned int index;
for (ptr = symbol_rootP; for (ptr = symbol_rootP;
ptr != (symbolS *) NULL; ptr != (symbolS *) NULL;
ptr = ptr->sy_next) ptr = ptr->sy_next)
@@ -291,10 +294,8 @@ do_symbols (abfd)
(asection *) (segment_info[ptr->sy_symbol.seg].user_stuff); (asection *) (segment_info[ptr->sy_symbol.seg].user_stuff);
S_SET_VALUE (ptr, S_GET_VALUE (ptr) + ptr->sy_frag->fr_address); S_SET_VALUE (ptr, S_GET_VALUE (ptr) + ptr->sy_frag->fr_address);
if (ptr->sy_symbol.sy.flags == 0) if (ptr->sy_symbol.sy.flags == 0)
{
ptr->sy_symbol.sy.flags = BSF_LOCAL; ptr->sy_symbol.sy.flags = BSF_LOCAL;
} }
}
else else
{ {
switch (ptr->sy_symbol.seg) switch (ptr->sy_symbol.seg)
@@ -330,7 +331,7 @@ do_symbols (abfd)
} }
/* The generic as->bfd converter. Other backends may have special case /* The generic as->bfd converter. Other backends may have special case
code */ code. */
void void
bfd_as_write_hook () bfd_as_write_hook ()
@@ -338,10 +339,7 @@ bfd_as_write_hook ()
int i; int i;
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
size_section (abfd, i); size_section (abfd, i);
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
fill_section (abfd, i); fill_section (abfd, i);
@@ -350,7 +348,6 @@ bfd_as_write_hook ()
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
do_relocs_for (i); do_relocs_for (i);
} }
S_SET_SEGMENT (x, y) S_SET_SEGMENT (x, y)
@@ -437,7 +434,8 @@ obj_ieee_section (ignore)
char *p = input_line_pointer; char *p = input_line_pointer;
char *s = p; char *s = p;
int i; int i;
/* Look up the name, if it doesn't exist, make it */
/* Look up the name, if it doesn't exist, make it. */
while (*p && *p != ' ' && *p != ',' && !is_end_of_line[*p]) while (*p && *p != ' ' && *p != ',' && !is_end_of_line[*p])
{ {
p++; p++;
@@ -447,10 +445,7 @@ obj_ieee_section (ignore)
if (segment_info[i].hadone) if (segment_info[i].hadone)
{ {
if (strncmp (segment_info[i].name, s, p - s) == 0) if (strncmp (segment_info[i].name, s, p - s) == 0)
{
goto ok; goto ok;
}
} }
else else
break; break;
@@ -470,14 +465,11 @@ ok:
while (!is_end_of_line[*p]) while (!is_end_of_line[*p])
p++; p++;
input_line_pointer = p; input_line_pointer = p;
} }
void cons (); void cons ();
void s_ignore (); void s_ignore ();
void s_globl (); void s_globl ();
const pseudo_typeS obj_pseudo_table[] = const pseudo_typeS obj_pseudo_table[] =
{ {
@@ -491,11 +483,8 @@ const pseudo_typeS obj_pseudo_table[] =
{"import" , s_ignore , 0}, {"import" , s_ignore , 0},
{"sdata" , stringer , 0}, {"sdata" , stringer , 0},
0, 0,
}; };
void void
obj_symbol_new_hook (symbolP) obj_symbol_new_hook (symbolP)
symbolS *symbolP; symbolS *symbolP;
@@ -503,10 +492,6 @@ obj_symbol_new_hook (symbolP)
symbolP->sy_symbol.sy.the_bfd = abfd; symbolP->sy_symbol.sy.the_bfd = abfd;
} }
#if 1 #if 1
extern void extern void
write_object_file () write_object_file ()
@@ -531,10 +516,10 @@ write_object_file ()
frchain_ptr != (struct frchain *) NULL; frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next) frchain_ptr = frchain_ptr->frch_next)
{ {
/* Run through all the sub-segments and align them up. Also close any /* Run through all the sub-segments and align them up. Also
open frags. We tack a .fill onto the end of the frag chain so close any open frags. We tack a .fill onto the end of the
that any .align's size can be worked by looking at the next frag chain so that any .align's size can be worked by looking
frag. */ at the next frag. */
subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg); subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#ifndef SUB_SEGMENT_ALIGN #ifndef SUB_SEGMENT_ALIGN
@@ -550,15 +535,16 @@ write_object_file ()
fr_next. */ fr_next. */
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{ {
fragS **prev_frag_ptr_ptr; fragS **prev_frag_ptr_ptr;
struct frchain *next_frchain_ptr; struct frchain *next_frchain_ptr;
/* struct frag **head_ptr = segment_info[i].frag_root;*/ #if 0
struct frag **head_ptr = segment_info[i].frag_root;
#endif
segment_info[i].frag_root = segment_info[i].frchainP->frch_root; segment_info[i].frag_root = segment_info[i].frchainP->frch_root;
#if 0 #if 0
/* Im not sure what this is for */ /* I'm not sure what this is for. */
for (frchain_ptr = segment_info[i].frchainP->frch_root; for (frchain_ptr = segment_info[i].frchainP->frch_root;
frchain_ptr != (struct frchain *) NULL; frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next) frchain_ptr = frchain_ptr->frch_next)
@@ -566,17 +552,13 @@ write_object_file ()
*head_ptr = frchain_ptr; *head_ptr = frchain_ptr;
head_ptr = &frchain_ptr->next; head_ptr = &frchain_ptr->next;
} }
#endif #endif
} }
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
relax_segment (segment_info[i].frag_root, i); relax_segment (segment_info[i].frag_root, i);
}
/* Now the addresses of the frags are correct within the segment */ /* Now the addresses of the frags are correct within the segment. */
bfd_as_write_hook (); bfd_as_write_hook ();
bfd_close (abfd); bfd_close (abfd);
@@ -623,5 +605,3 @@ H_GET_TEXT_RELOCATION_SIZE ()
{ {
abort (); abort ();
} }
/* end of obj-ieee.c */

View File

@@ -1,5 +1,5 @@
/* SOM object file format. /* SOM object file format.
Copyright (C) 1993, 1998 Free Software Foundation, Inc. Copyright (C) 1993, 1998, 2000 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@@ -39,7 +39,11 @@ static int copyright_seen = 0;
static int compiler_seen = 0; static int compiler_seen = 0;
/* Unused by SOM. */ /* Unused by SOM. */
void obj_read_begin_hook () {}
void
obj_read_begin_hook ()
{
}
/* Handle a .compiler directive. This is intended to create the /* Handle a .compiler directive. This is intended to create the
compilation unit auxiliary header for MPE such that the linkeditor compilation unit auxiliary header for MPE such that the linkeditor
@@ -95,7 +99,8 @@ obj_som_compiler (unused)
*p = '\000'; *p = '\000';
language_name = ++p; language_name = ++p;
while (*p != ' ' && *p != '\000') p++; while (*p != ' ' && *p != '\000')
p++;
if (*p == '\000') if (*p == '\000')
{ {
as_bad (".compiler directive missing version"); as_bad (".compiler directive missing version");
@@ -104,7 +109,8 @@ obj_som_compiler (unused)
*p = '\000'; *p = '\000';
version_id = ++p; version_id = ++p;
while (*p != '\000') p++; while (*p != '\000')
p++;
/* Remove the trailing quote. */ /* Remove the trailing quote. */
*(--p) = '\000'; *(--p) = '\000';
@@ -155,7 +161,8 @@ obj_som_version (unused)
if (bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version) == false) if (bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version) == false)
{ {
bfd_perror (stdoutput->filename); bfd_perror (stdoutput->filename);
as_perror (_("FATAL: Attaching version header %s"), stdoutput->filename); as_perror (_("FATAL: Attaching version header %s"),
stdoutput->filename);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
*input_line_pointer = c; *input_line_pointer = c;
@@ -200,7 +207,8 @@ obj_som_copyright (unused)
if (bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright) == false) if (bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright) == false)
{ {
bfd_perror (stdoutput->filename); bfd_perror (stdoutput->filename);
as_perror (_("FATAL: Attaching copyright header %s"), stdoutput->filename); as_perror (_("FATAL: Attaching copyright header %s"),
stdoutput->filename);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
*input_line_pointer = c; *input_line_pointer = c;
@@ -337,4 +345,3 @@ obj_som_weak (ignore)
while (c == ','); while (c == ',');
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,7 @@
#define AREA_SDA 1 #define AREA_SDA 1
#define AREA_TDA 2 #define AREA_TDA 2
/* sign-extend a 16-bit number */ /* Sign-extend a 16-bit number. */
#define SEXT16(x) ((((x) & 0xffff) ^ (~0x7fff)) + 0x8000) #define SEXT16(x) ((((x) & 0xffff) ^ (~0x7fff)) + 0x8000)
/* Temporarily holds the reloc in a cons expression. */ /* Temporarily holds the reloc in a cons expression. */
@@ -43,7 +43,6 @@ static int machine = -1;
/* Indicates the target processor(s) for the assemble. */ /* Indicates the target processor(s) for the assemble. */
static int processor_mask = -1; static int processor_mask = -1;
/* Structure to hold information about predefined registers. */ /* Structure to hold information about predefined registers. */
struct reg_name struct reg_name
@@ -52,7 +51,8 @@ struct reg_name
int value; int value;
}; };
/* Generic assembler global variables which must be defined by all targets. */ /* Generic assembler global variables which must be defined by all
targets. */
/* Characters which always start a comment. */ /* Characters which always start a comment. */
const char comment_chars[] = "#"; const char comment_chars[] = "#";
@@ -72,7 +72,6 @@ const char EXP_CHARS[] = "eE";
as in 0d1.0. */ as in 0d1.0. */
const char FLT_CHARS[] = "dD"; const char FLT_CHARS[] = "dD";
const relax_typeS md_relax_table[] = const relax_typeS md_relax_table[] =
{ {
/* Conditional branches. */ /* Conditional branches. */
@@ -83,7 +82,6 @@ const relax_typeS md_relax_table[] =
{0x1fffff, -0x200000, 4, 0}, {0x1fffff, -0x200000, 4, 0},
}; };
static segT sdata_section = NULL; static segT sdata_section = NULL;
static segT tdata_section = NULL; static segT tdata_section = NULL;
static segT zdata_section = NULL; static segT zdata_section = NULL;
@@ -98,7 +96,7 @@ static segT zcommon_section = NULL;
static segT call_table_data_section = NULL; static segT call_table_data_section = NULL;
static segT call_table_text_section = NULL; static segT call_table_text_section = NULL;
/* fixups */ /* Fixups. */
#define MAX_INSN_FIXUPS (5) #define MAX_INSN_FIXUPS (5)
struct v850_fixup struct v850_fixup
{ {
@@ -109,7 +107,6 @@ struct v850_fixup
struct v850_fixup fixups[MAX_INSN_FIXUPS]; struct v850_fixup fixups[MAX_INSN_FIXUPS];
static int fc; static int fc;
void void
v850_sdata (int ignore ATTRIBUTE_UNUSED) v850_sdata (int ignore ATTRIBUTE_UNUSED)
@@ -236,7 +233,8 @@ v850_offset (int ignore ATTRIBUTE_UNUSED)
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
/* Copied from obj_elf_common() in gas/config/obj-elf.c */ /* Copied from obj_elf_common() in gas/config/obj-elf.c. */
static void static void
v850_comm (area) v850_comm (area)
int area; int area;
@@ -252,7 +250,7 @@ v850_comm (area)
name = input_line_pointer; name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_end ();
/* just after name is now '\0' */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
@@ -265,7 +263,8 @@ v850_comm (area)
return; return;
} }
input_line_pointer ++; /* skip ',' */ /* Skip ','. */
input_line_pointer++;
if ((temp = get_absolute_expression ()) < 0) if ((temp = get_absolute_expression ()) < 0)
{ {
@@ -376,7 +375,7 @@ v850_comm (area)
if (temp) if (temp)
{ {
/* convert to a power of 2 alignment */ /* Convert to a power of 2 alignment. */
for (align = 0; (temp & 1) == 0; temp >>= 1, ++align) for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
; ;
@@ -478,9 +477,8 @@ v850_comm (area)
case AREA_SDA: case AREA_SDA:
if (scommon_section == NULL) if (scommon_section == NULL)
{ {
flagword applicable; flagword applicable =
bfd_applicable_section_flags (stdoutput);
applicable = bfd_applicable_section_flags (stdoutput);
scommon_section = subseg_new (".scommon", 0); scommon_section = subseg_new (".scommon", 0);
@@ -495,9 +493,8 @@ v850_comm (area)
case AREA_ZDA: case AREA_ZDA:
if (zcommon_section == NULL) if (zcommon_section == NULL)
{ {
flagword applicable; flagword applicable =
bfd_applicable_section_flags (stdoutput);
applicable = bfd_applicable_section_flags (stdoutput);
zcommon_section = subseg_new (".zcommon", 0); zcommon_section = subseg_new (".zcommon", 0);
@@ -512,16 +509,17 @@ v850_comm (area)
case AREA_TDA: case AREA_TDA:
if (tcommon_section == NULL) if (tcommon_section == NULL)
{ {
flagword applicable; flagword applicable =
bfd_applicable_section_flags (stdoutput);
applicable = bfd_applicable_section_flags (stdoutput);
tcommon_section = subseg_new (".tcommon", 0); tcommon_section = subseg_new (".tcommon", 0);
bfd_set_section_flags (stdoutput, tcommon_section, bfd_set_section_flags (stdoutput, tcommon_section,
(applicable ((applicable
& (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA & (SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS)) | SEC_IS_COMMON); | SEC_RELOC | SEC_DATA
| SEC_HAS_CONTENTS))
| SEC_IS_COMMON));
} }
S_SET_SEGMENT (symbolP, tcommon_section); S_SET_SEGMENT (symbolP, tcommon_section);
break; break;
@@ -534,9 +532,11 @@ v850_comm (area)
else else
{ {
input_line_pointer++; input_line_pointer++;
/* @@ Some use the dot, some don't. Can we get some consistency?? */ /* @@ Some use the dot, some don't. Can we get some consistency?? */
if (*input_line_pointer == '.') if (*input_line_pointer == '.')
input_line_pointer++; input_line_pointer++;
/* @@ Some say data, some say bss. */ /* @@ Some say data, some say bss. */
if (strncmp (input_line_pointer, "bss\"", 4) if (strncmp (input_line_pointer, "bss\"", 4)
&& strncmp (input_line_pointer, "data\"", 5)) && strncmp (input_line_pointer, "data\"", 5))
@@ -656,8 +656,9 @@ static const struct reg_name pre_defined_registers[] =
{ "tp", 5 }, /* tp - text ptr */ { "tp", 5 }, /* tp - text ptr */
{ "zero", 0 }, { "zero", 0 },
}; };
#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct reg_name))
#define REG_NAME_CNT \
(sizeof (pre_defined_registers) / sizeof (struct reg_name))
static const struct reg_name system_registers[] = static const struct reg_name system_registers[] =
{ {
@@ -673,14 +674,18 @@ static const struct reg_name system_registers[] =
{ "fepsw", 3 }, { "fepsw", 3 },
{ "psw", 5 }, { "psw", 5 },
}; };
#define SYSREG_NAME_CNT (sizeof (system_registers) / sizeof (struct reg_name))
#define SYSREG_NAME_CNT \
(sizeof (system_registers) / sizeof (struct reg_name))
static const struct reg_name system_list_registers[] = static const struct reg_name system_list_registers[] =
{ {
{"PS", 5 }, {"PS", 5 },
{"SR", 0 + 1} {"SR", 0 + 1}
}; };
#define SYSREGLIST_NAME_CNT (sizeof (system_list_registers) / sizeof (struct reg_name))
#define SYSREGLIST_NAME_CNT \
(sizeof (system_list_registers) / sizeof (struct reg_name))
static const struct reg_name cc_names[] = static const struct reg_name cc_names[] =
{ {
@@ -707,11 +712,13 @@ static const struct reg_name cc_names[] =
{ "v", 0x0 }, { "v", 0x0 },
{ "z", 0x2 }, { "z", 0x2 },
}; };
#define CC_NAME_CNT (sizeof (cc_names) / sizeof (struct reg_name))
/* reg_name_search does a binary search of the given register table #define CC_NAME_CNT \
to see if "name" is a valid regiter name. Returns the register (sizeof (cc_names) / sizeof (struct reg_name))
number from the array on success, or -1 on failure. */
/* Do a binary search of the given register table to see if NAME is a
valid regiter name. Return the register number from the array on
success, or -1 on failure. */
static int static int
reg_name_search (regs, regcount, name, accept_numbers) reg_name_search (regs, regcount, name, accept_numbers)
@@ -731,7 +738,8 @@ reg_name_search (regs, regcount, name, accept_numbers)
If the symbol is an alias for a number, then return the number. */ If the symbol is an alias for a number, then return the number. */
if (symbol_equated_p (symbolP)) if (symbol_equated_p (symbolP))
{ {
name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol); name
= S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
} }
else if (accept_numbers) else if (accept_numbers)
{ {
@@ -762,7 +770,6 @@ reg_name_search (regs, regcount, name, accept_numbers)
return -1; return -1;
} }
/* Summary of register_name(). /* Summary of register_name().
* *
* in: Input_line_pointer points to 1st char of operand. * in: Input_line_pointer points to 1st char of operand.
@@ -771,8 +778,8 @@ reg_name_search (regs, regcount, name, accept_numbers)
* The operand may have been a register: in this case, X_op == O_register, * The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned. * X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in * Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. * its original state. */
*/
static boolean static boolean
register_name (expressionP) register_name (expressionP)
expressionS *expressionP; expressionS *expressionP;
@@ -782,7 +789,7 @@ register_name (expressionP)
char *start; char *start;
char c; char c;
/* Find the spelling of the operand */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_end ();
@@ -790,15 +797,16 @@ register_name (expressionP)
reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
name, FALSE); name, FALSE);
* input_line_pointer = c; /* put back the delimiting char */ /* Put back the delimiting char. */
*input_line_pointer = c;
/* look to see if it's in the register table */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
{ {
expressionP->X_op = O_register; expressionP->X_op = O_register;
expressionP->X_add_number = reg_number; expressionP->X_add_number = reg_number;
/* make the rest nice */ /* Make the rest nice. */
expressionP->X_add_symbol = NULL; expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@@ -806,7 +814,7 @@ register_name (expressionP)
} }
else else
{ {
/* reset the line as if we had not done anything */ /* Reset the line as if we had not done anything. */
input_line_pointer = start; input_line_pointer = start;
return false; return false;
@@ -815,18 +823,18 @@ register_name (expressionP)
/* Summary of system_register_name(). /* Summary of system_register_name().
* *
* in: Input_line_pointer points to 1st char of operand. * in: INPUT_LINE_POINTER points to 1st char of operand.
* expressionP points to an expression structure to be filled in. * EXPRESSIONP points to an expression structure to be filled in.
* accept_numbers is true iff numerical register names may be used. * ACCEPT_NUMBERS is true iff numerical register names may be used.
* accept_list_names is true iff the special names PS and SR may be * ACCEPT_LIST_NAMES is true iff the special names PS and SR may be
* accepted. * accepted.
* *
* out: A expressionS structure in expressionP. * out: A expressionS structure in expressionP.
* The operand may have been a register: in this case, X_op == O_register, * The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned. * X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in * Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. * its original state. */
*/
static boolean static boolean
system_register_name (expressionP, accept_numbers, accept_list_names) system_register_name (expressionP, accept_numbers, accept_list_names)
expressionS *expressionP; expressionS *expressionP;
@@ -838,19 +846,21 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
char *start; char *start;
char c; char c;
/* Find the spelling of the operand */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_end ();
reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name, reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
accept_numbers); accept_numbers);
* input_line_pointer = c; /* put back the delimiting char */ /* Put back the delimiting char. */
*input_line_pointer = c;
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
{ {
input_line_pointer = start; /* reset input_line pointer */ /* Reset input_line pointer. */
input_line_pointer = start;
if (isdigit (*input_line_pointer)) if (isdigit (*input_line_pointer))
{ {
@@ -859,8 +869,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Make sure that the register number is allowable. */ /* Make sure that the register number is allowable. */
if (reg_number < 0 if (reg_number < 0
|| (reg_number > 5 && reg_number < 16) || (reg_number > 5 && reg_number < 16)
|| reg_number > 20 || reg_number > 20)
)
{ {
reg_number = -1; reg_number = -1;
} }
@@ -871,17 +880,18 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
reg_number = reg_name_search (system_list_registers, reg_number = reg_name_search (system_list_registers,
SYSREGLIST_NAME_CNT, name, FALSE); SYSREGLIST_NAME_CNT, name, FALSE);
* input_line_pointer = c; /* put back the delimiting char */ /* Put back the delimiting char. */
*input_line_pointer = c;
} }
} }
/* look to see if it's in the register table */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
{ {
expressionP->X_op = O_register; expressionP->X_op = O_register;
expressionP->X_add_number = reg_number; expressionP->X_add_number = reg_number;
/* make the rest nice */ /* Make the rest nice. */
expressionP->X_add_symbol = NULL; expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@@ -889,7 +899,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
} }
else else
{ {
/* reset the line as if we had not done anything */ /* Reset the line as if we had not done anything. */
input_line_pointer = start; input_line_pointer = start;
return false; return false;
@@ -898,14 +908,14 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Summary of cc_name(). /* Summary of cc_name().
* *
* in: Input_line_pointer points to 1st char of operand. * in: INPUT_LINE_POINTER points to 1st char of operand.
* *
* out: A expressionS. * out: A expressionS.
* The operand may have been a register: in this case, X_op == O_register, * The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned. * X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in * Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. * its original state. */
*/
static boolean static boolean
cc_name (expressionP) cc_name (expressionP)
expressionS *expressionP; expressionS *expressionP;
@@ -915,21 +925,22 @@ cc_name (expressionP)
char *start; char *start;
char c; char c;
/* Find the spelling of the operand */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_end ();
reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, FALSE); reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, FALSE);
* input_line_pointer = c; /* put back the delimiting char */ /* Put back the delimiting char. */
*input_line_pointer = c;
/* look to see if it's in the register table */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
{ {
expressionP->X_op = O_constant; expressionP->X_op = O_constant;
expressionP->X_add_number = reg_number; expressionP->X_add_number = reg_number;
/* make the rest nice */ /* Make the rest nice. */
expressionP->X_add_symbol = NULL; expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@@ -937,7 +948,7 @@ cc_name (expressionP)
} }
else else
{ {
/* reset the line as if we had not done anything */ /* Reset the line as if we had not done anything. */
input_line_pointer = start; input_line_pointer = start;
return false; return false;
@@ -954,9 +965,9 @@ skip_white_space (void)
/* Summary of parse_register_list (). /* Summary of parse_register_list ().
* *
* in: Input_line_pointer points to 1st char of a list of registers. * in: INPUT_LINE_POINTER points to 1st char of a list of registers.
* insn is the partially constructed instruction. * INSN is the partially constructed instruction.
* operand is the operand being inserted. * OPERAND is the operand being inserted.
* *
* out: NULL if the parse completed successfully, otherwise a * out: NULL if the parse completed successfully, otherwise a
* pointer to an error message is returned. If the parse * pointer to an error message is returned. If the parse
@@ -975,23 +986,28 @@ skip_white_space (void)
* registers in the lists. The LSB in the expression refers to * registers in the lists. The LSB in the expression refers to
* the lowest numbered permissable register in the register list, * the lowest numbered permissable register in the register list,
* and so on upwards. System registers are considered to be very * and so on upwards. System registers are considered to be very
* high numbers. * high numbers. */
*
*/
static char * static char *
parse_register_list parse_register_list (insn, operand)
( unsigned long *insn;
unsigned long * insn, const struct v850_operand *operand;
const struct v850_operand * operand
)
{ {
static int type1_regs[ 32 ] = { 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 }; static int type1_regs[32] = {
static int type2_regs[ 32 ] = { 19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 }; 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
static int type3_regs[ 32 ] = { 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8 }; 0, 0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24
};
static int type2_regs[32] = {
19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24
};
static int type3_regs[32] = {
3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 15, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8
};
int *regs; int *regs;
expressionS exp; expressionS exp;
/* Select a register array to parse. */ /* Select a register array to parse. */
switch (operand->shift) switch (operand->shift)
{ {
@@ -1127,7 +1143,7 @@ parse_register_list
} }
else if (*input_line_pointer == '-') else if (*input_line_pointer == '-')
{ {
/* We have encountered a range of registers: rX - rY */ /* We have encountered a range of registers: rX - rY. */
int j; int j;
expressionS exp2; expressionS exp2;
@@ -1178,8 +1194,8 @@ struct option md_longopts[] =
{ {
{NULL, no_argument, NULL, 0} {NULL, no_argument, NULL, 0}
}; };
size_t md_longopts_size = sizeof md_longopts;
size_t md_longopts_size = sizeof (md_longopts);
void void
md_show_usage (stream) md_show_usage (stream)
@@ -1232,8 +1248,11 @@ md_parse_option (c, arg)
} }
else if (strcmp (arg, "v850any") == 0) else if (strcmp (arg, "v850any") == 0)
{ {
machine = 0; /* Tell the world that this is for any v850 chip. */ /* Tell the world that this is for any v850 chip. */
processor_mask = PROCESSOR_V850EA; /* But support instructions for the extended versions. */ machine = 0;
/* But support instructions for the extended versions. */
processor_mask = PROCESSOR_V850EA;
} }
else else
{ {
@@ -1293,8 +1312,8 @@ md_atof (type, litp, sizep)
return NULL; return NULL;
} }
/* Very gross. */ /* Very gross. */
void void
md_convert_frag (abfd, sec, fragP) md_convert_frag (abfd, sec, fragP)
bfd *abfd ATTRIBUTE_UNUSED; bfd *abfd ATTRIBUTE_UNUSED;
@@ -1381,8 +1400,7 @@ md_begin ()
if (processor_mask == -1) if (processor_mask == -1)
processor_mask = PROCESSOR_V850E; processor_mask = PROCESSOR_V850E;
} }
else else if (strncmp (TARGET_CPU, "v850", 4) == 0)
if (strncmp (TARGET_CPU, "v850", 4) == 0)
{ {
if (machine == -1) if (machine == -1)
machine = 0; machine = 0;
@@ -1431,7 +1449,6 @@ md_begin ()
subseg_set (text_section, 0); subseg_set (text_section, 0);
} }
static bfd_reloc_code_real_type static bfd_reloc_code_real_type
handle_ctoff (const struct v850_operand *operand) handle_ctoff (const struct v850_operand *operand)
{ {
@@ -1451,9 +1468,14 @@ handle_ctoff (const struct v850_operand * operand)
static bfd_reloc_code_real_type static bfd_reloc_code_real_type
handle_sdaoff (const struct v850_operand *operand) handle_sdaoff (const struct v850_operand *operand)
{ {
if (operand == NULL) return BFD_RELOC_V850_SDA_16_16_OFFSET; if (operand == NULL)
if (operand->bits == 15 && operand->shift == 17) return BFD_RELOC_V850_SDA_15_16_OFFSET; return BFD_RELOC_V850_SDA_16_16_OFFSET;
if (operand->bits == -1) return BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET;
if (operand->bits == 15 && operand->shift == 17)
return BFD_RELOC_V850_SDA_15_16_OFFSET;
if (operand->bits == -1)
return BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET;
if (operand->bits != 16 if (operand->bits != 16
|| operand->shift != 16) || operand->shift != 16)
@@ -1468,15 +1490,21 @@ handle_sdaoff (const struct v850_operand * operand)
static bfd_reloc_code_real_type static bfd_reloc_code_real_type
handle_zdaoff (const struct v850_operand *operand) handle_zdaoff (const struct v850_operand *operand)
{ {
if (operand == NULL) return BFD_RELOC_V850_ZDA_16_16_OFFSET; if (operand == NULL)
if (operand->bits == 15 && operand->shift == 17) return BFD_RELOC_V850_ZDA_15_16_OFFSET; return BFD_RELOC_V850_ZDA_16_16_OFFSET;
if (operand->bits == -1) return BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET;
if (operand->bits == 15 && operand->shift == 17)
return BFD_RELOC_V850_ZDA_15_16_OFFSET;
if (operand->bits == -1)
return BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET;
if (operand->bits != 16 if (operand->bits != 16
|| operand->shift != 16) || operand->shift != 16)
{ {
as_bad (_("zdaoff() relocation used on an instruction which does not support it")); as_bad (_("zdaoff() relocation used on an instruction which does not support it"));
return BFD_RELOC_64; /* Used to indicate an error condition. */ /* Used to indicate an error condition. */
return BFD_RELOC_64;
} }
return BFD_RELOC_V850_ZDA_16_16_OFFSET; return BFD_RELOC_V850_ZDA_16_16_OFFSET;
@@ -1485,16 +1513,31 @@ handle_zdaoff (const struct v850_operand * operand)
static bfd_reloc_code_real_type static bfd_reloc_code_real_type
handle_tdaoff (const struct v850_operand *operand) handle_tdaoff (const struct v850_operand *operand)
{ {
if (operand == NULL) return BFD_RELOC_V850_TDA_7_7_OFFSET; /* data item, not an instruction. */ if (operand == NULL)
if (operand->bits == 6 && operand->shift == 1) return BFD_RELOC_V850_TDA_6_8_OFFSET; /* sld.w/sst.w, operand: D8_6 */ /* Data item, not an instruction. */
if (operand->bits == 4 && operand->insert != NULL) return BFD_RELOC_V850_TDA_4_5_OFFSET; /* sld.hu, operand: D5-4 */ return BFD_RELOC_V850_TDA_7_7_OFFSET;
if (operand->bits == 4 && operand->insert == NULL) return BFD_RELOC_V850_TDA_4_4_OFFSET; /* sld.bu, operand: D4 */
if (operand->bits == 16 && operand->shift == 16) return BFD_RELOC_V850_TDA_16_16_OFFSET; /* set1 & chums, operands: D16 */ if (operand->bits == 6 && operand->shift == 1)
/* sld.w/sst.w, operand: D8_6 */
return BFD_RELOC_V850_TDA_6_8_OFFSET;
if (operand->bits == 4 && operand->insert != NULL)
/* sld.hu, operand: D5-4 */
return BFD_RELOC_V850_TDA_4_5_OFFSET;
if (operand->bits == 4 && operand->insert == NULL)
/* sld.bu, operand: D4 */
return BFD_RELOC_V850_TDA_4_4_OFFSET;
if (operand->bits == 16 && operand->shift == 16)
/* set1 & chums, operands: D16 */
return BFD_RELOC_V850_TDA_16_16_OFFSET;
if (operand->bits != 7) if (operand->bits != 7)
{ {
as_bad (_("tdaoff() relocation used on an instruction which does not support it")); as_bad (_("tdaoff() relocation used on an instruction which does not support it"));
return BFD_RELOC_64; /* Used to indicate an error condition. */ /* Used to indicate an error condition. */
return BFD_RELOC_64;
} }
return operand->insert != NULL return operand->insert != NULL
@@ -1511,7 +1554,6 @@ v850_reloc_prefix (const struct v850_operand * operand)
{ {
boolean paren_skipped = false; boolean paren_skipped = false;
/* Skip leading opening parenthesis. */ /* Skip leading opening parenthesis. */
if (*input_line_pointer == '(') if (*input_line_pointer == '(')
{ {
@@ -1564,13 +1606,13 @@ v850_insert_operand (insn, operand, val, file, line, str)
&& ! warn_signed_overflows && ! warn_signed_overflows
&& strstr (message, "out of range") != NULL) && strstr (message, "out of range") != NULL)
{ {
/* skip warning... */ /* Skip warning... */
} }
else if ((operand->flags & V850_OPERAND_SIGNED) == 0 else if ((operand->flags & V850_OPERAND_SIGNED) == 0
&& ! warn_unsigned_overflows && ! warn_unsigned_overflows
&& strstr (message, "out of range") != NULL) && strstr (message, "out of range") != NULL)
{ {
/* skip warning... */ /* Skip warning... */
} }
else if (str) else if (str)
{ {
@@ -1616,7 +1658,8 @@ v850_insert_operand (insn, operand, val, file, line, str)
if (val < (offsetT) min || val > (offsetT) max) if (val < (offsetT) min || val > (offsetT) max)
{ {
/* xgettext:c-format */ /* xgettext:c-format */
const char * err = _("operand out of range (%s not between %ld and %ld)"); const char *err =
_("operand out of range (%s not between %ld and %ld)");
char buf[100]; char buf[100];
/* Restore min and mix to expected values for decimal ranges. */ /* Restore min and mix to expected values for decimal ranges. */
@@ -1649,7 +1692,6 @@ v850_insert_operand (insn, operand, val, file, line, str)
return insn; return insn;
} }
static char copy_of_instruction[128]; static char copy_of_instruction[128];
@@ -1674,7 +1716,6 @@ md_assemble (str)
unsigned long extra_data = 0; unsigned long extra_data = 0;
char *saved_input_line_pointer; char *saved_input_line_pointer;
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1); strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */ /* Get the opcode. */
@@ -1684,7 +1725,7 @@ md_assemble (str)
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
/* find the first opcode with the proper name */ /* Find the first opcode with the proper name. */
opcode = (struct v850_opcode *) hash_find (v850_hash, str); opcode = (struct v850_opcode *) hash_find (v850_hash, str);
if (opcode == NULL) if (opcode == NULL)
{ {
@@ -1894,7 +1935,8 @@ md_assemble (str)
str = input_line_pointer; str = input_line_pointer;
input_line_pointer = hold; input_line_pointer = hold;
while (*str == ' ' || *str == ',' || *str == '[' || *str == ']') while (*str == ' ' || *str == ','
|| *str == '[' || *str == ']')
++str; ++str;
continue; continue;
} }
@@ -1978,14 +2020,15 @@ md_assemble (str)
the parsing of the instruction, (because another the parsing of the instruction, (because another
field is missing) then report this. */ field is missing) then report this. */
if (opindex_ptr[1] != 0 if (opindex_ptr[1] != 0
&& (v850_operands [opindex_ptr [1]].flags & V850_OPERAND_REG)) && (v850_operands[opindex_ptr[1]].flags
& V850_OPERAND_REG))
errmsg = _("syntax error: value is missing before the register name"); errmsg = _("syntax error: value is missing before the register name");
else else
errmsg = _("syntax error: register not expected"); errmsg = _("syntax error: register not expected");
/* If we created a symbol in the process of this test then /* If we created a symbol in the process of this
delete it now, so that it will not be output with the real test then delete it now, so that it will not
symbols... */ be output with the real symbols... */
if (exists == 0 if (exists == 0
&& ex.X_op == O_symbol) && ex.X_op == O_symbol)
symbol_remove (ex.X_add_symbol, symbol_remove (ex.X_add_symbol,
@@ -2022,8 +2065,12 @@ md_assemble (str)
if (errmsg) if (errmsg)
goto error; goto error;
/* fprintf (stderr, " insn: %x, operand %d, op: %d, add_number: %d\n", #if 0
insn, opindex_ptr - opcode->operands, ex.X_op, ex.X_add_number); */ fprintf (stderr,
" insn: %x, operand %d, op: %d, add_number: %d\n",
insn, opindex_ptr - opcode->operands,
ex.X_op, ex.X_add_number);
#endif
switch (ex.X_op) switch (ex.X_op)
{ {
@@ -2034,7 +2081,8 @@ md_assemble (str)
errmsg = _("missing operand"); errmsg = _("missing operand");
goto error; goto error;
case O_register: case O_register:
if ((operand->flags & (V850_OPERAND_REG | V850_OPERAND_SRG)) == 0) if ((operand->flags
& (V850_OPERAND_REG | V850_OPERAND_SRG)) == 0)
{ {
errmsg = _("invalid operand"); errmsg = _("invalid operand");
goto error; goto error;
@@ -2144,7 +2192,7 @@ md_assemble (str)
else else
insn_size = 2; insn_size = 2;
/* Special case: 32 bit MOV */ /* Special case: 32 bit MOV. */
if ((insn & 0xffe0) == 0x0620) if ((insn & 0xffe0) == 0x0620)
insn_size = 2; insn_size = 2;
@@ -2179,8 +2227,8 @@ md_assemble (str)
if (reloc != BFD_RELOC_UNUSED) if (reloc != BFD_RELOC_UNUSED)
{ {
reloc_howto_type * reloc_howto = bfd_reloc_type_lookup (stdoutput, reloc_howto_type *reloc_howto =
reloc); bfd_reloc_type_lookup (stdoutput, reloc);
int size; int size;
int address; int address;
fixS *fixP; fixS *fixP;
@@ -2198,9 +2246,7 @@ md_assemble (str)
address = (f - frag_now->fr_literal) + insn_size - size; address = (f - frag_now->fr_literal) + insn_size - size;
if (reloc == BFD_RELOC_32) if (reloc == BFD_RELOC_32)
{
address += 2; address += 2;
}
fixP = fix_new_exp (frag_now, address, size, fixP = fix_new_exp (frag_now, address, size,
&fixups[i].exp, &fixups[i].exp,
@@ -2220,23 +2266,20 @@ md_assemble (str)
} }
else else
{ {
fix_new_exp ( fix_new_exp (frag_now,
frag_now,
f - frag_now->fr_literal, 4, f - frag_now->fr_literal, 4,
& fixups[i].exp, & fixups[i].exp,
1 /* FIXME: V850_OPERAND_RELATIVE ??? */, 1 /* FIXME: V850_OPERAND_RELATIVE ??? */,
(bfd_reloc_code_real_type) (fixups[i].opindex (bfd_reloc_code_real_type) (fixups[i].opindex
+ (int) BFD_RELOC_UNUSED) + (int) BFD_RELOC_UNUSED));
);
} }
} }
input_line_pointer = saved_input_line_pointer; input_line_pointer = saved_input_line_pointer;
} }
/* If while processing a fixup, a reloc really needs to be created
/* If while processing a fixup, a reloc really needs to be created */ then it is done here. */
/* then it is done here. */
arelent * arelent *
tc_gen_reloc (seg, fixp) tc_gen_reloc (seg, fixp)
@@ -2273,6 +2316,7 @@ tc_gen_reloc (seg, fixp)
} }
/* Assume everything will fit in two bytes, then expand as necessary. */ /* Assume everything will fit in two bytes, then expand as necessary. */
int int
md_estimate_size_before_relax (fragp, seg) md_estimate_size_before_relax (fragp, seg)
fragS *fragp; fragS *fragp;
@@ -2379,7 +2423,9 @@ md_apply_fix3 (fixp, valuep, seg)
fixp->fx_r_type = BFD_RELOC_V850_9_PCREL; fixp->fx_r_type = BFD_RELOC_V850_9_PCREL;
else else
{ {
/* fprintf (stderr, "bits: %d, insn: %x\n", operand->bits, insn); */ #if 0
fprintf (stderr, "bits: %d, insn: %x\n", operand->bits, insn);
#endif
as_bad_where (fixp->fx_file, fixp->fx_line, as_bad_where (fixp->fx_file, fixp->fx_line,
_("unresolved expression that must be resolved")); _("unresolved expression that must be resolved"));
@@ -2403,10 +2449,10 @@ md_apply_fix3 (fixp, valuep, seg)
fixp->fx_addnumber = value; fixp->fx_addnumber = value;
return 1; return 1;
} }
/* Parse a cons expression. We have to handle hi(), lo(), etc /* Parse a cons expression. We have to handle hi(), lo(), etc
on the v850. */ on the v850. */
void void
parse_cons_expression_v850 (exp) parse_cons_expression_v850 (exp)
expressionS *exp; expressionS *exp;
@@ -2421,6 +2467,7 @@ parse_cons_expression_v850 (exp)
/* Create a fixup for a cons expression. If parse_cons_expression_v850 /* Create a fixup for a cons expression. If parse_cons_expression_v850
found a reloc prefix, then we use that reloc, else we choose an found a reloc prefix, then we use that reloc, else we choose an
appropriate one based on the size of the expression. */ appropriate one based on the size of the expression. */
void void
cons_fix_new_v850 (frag, where, size, exp) cons_fix_new_v850 (frag, where, size, exp)
fragS *frag; fragS *frag;
@@ -2459,11 +2506,11 @@ v850_fix_adjustable (fixP)
if (S_IS_WEAK (fixP->fx_addsy)) if (S_IS_WEAK (fixP->fx_addsy))
return 0; return 0;
/* Don't adjust function names */ /* Don't adjust function names. */
if (S_IS_FUNCTION (fixP->fx_addsy)) if (S_IS_FUNCTION (fixP->fx_addsy))
return 0; return 0;
/* We need the symbol name for the VTABLE entries */ /* We need the symbol name for the VTABLE entries. */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0; return 0;