/* read.c - read a source file -
- Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
- 2000 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
while (0)
#endif
-/* The NOP_OPCODE is for the alignment fill value.
- Fill it a nop instruction so that the disassembler does not choke
- on it. */
-#ifndef NOP_OPCODE
-#define NOP_OPCODE 0x00
-#endif
-
char *input_line_pointer; /*->next char of source file to parse. */
#if BITS_PER_CHAR != 8
#endif
/* Used by is_... macros. our ctype[]. */
-char lex_type[256] =
-{
+char lex_type[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
/* In: a character.
Out: 1 if this character ends a line. */
-char is_end_of_line[256] =
-{
+char is_end_of_line[256] = {
#ifdef CR_EOL
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
#else
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
};
+#ifdef IGNORE_OPCODE_CASE
+char original_case_string[128];
+#endif
+
/* Functions private to this file. */
static char *buffer; /* 1st char of each buffer of lines is here. */
static struct hash_control *po_hash;
-static const pseudo_typeS potable[] =
-{
+static const pseudo_typeS potable[] = {
{"abort", s_abort, 0},
{"align", s_align_ptwo, 0},
{"ascii", stringer, 0},
symbol in the symbol table. */
if (!mri_line_macro
#ifdef TC_START_LABEL_WITHOUT_COLON
- && TC_START_LABEL_WITHOUT_COLON(c,
- input_line_pointer)
+ && TC_START_LABEL_WITHOUT_COLON(c,
+ input_line_pointer)
#endif
- )
+ )
line_label = colon (line_start);
else
line_label = symbol_create (line_start,
int len;
/* Find the end of the current expanded macro line. */
- for (s = input_line_pointer - 1; *s ; ++s)
+ for (s = input_line_pointer - 1; *s; ++s)
if (is_end_of_line[(unsigned char) *s])
break;
/* Copy it for safe keeping. Also give an indication of
how much macro nesting is involved at this point. */
- len = s - (input_line_pointer-1);
+ len = s - (input_line_pointer - 1);
copy = (char *) xmalloc (len + macro_nest + 2);
memset (copy, '>', macro_nest);
copy[macro_nest] = ' ';
/* Expect pseudo-op or machine instruction. */
pop = NULL;
-#define IGNORE_OPCODE_CASE
#ifdef IGNORE_OPCODE_CASE
{
char *s2 = s;
+
+ strncpy (original_case_string, s2, sizeof (original_case_string));
+ original_case_string[sizeof (original_case_string) - 1] = 0;
+
while (*s2)
{
if (isupper ((unsigned char) *s2))
int len;
int max;
{
- char default_fill;
-
#ifdef md_do_align
md_do_align (n, fill, len, max, just_record_alignment);
#endif
- if (fill == NULL)
- {
- if (subseg_text_p (now_seg))
- default_fill = NOP_OPCODE;
- else
- default_fill = 0;
- fill = &default_fill;
- len = 1;
- }
-
/* Only make a frag if we HAVE to... */
if (n != 0 && !need_pass_2)
{
- if (len <= 1)
+ if (fill == NULL)
+ {
+ if (subseg_text_p (now_seg))
+ frag_align_code (n, max);
+ else
+ frag_align (n, 0, max);
+ }
+ else if (len <= 1)
frag_align (n, *fill, max);
else
frag_align_pattern (n, fill, len, max);
if (align)
frag_align (align, 0, 0);
- /* Detach from old frag. */
+ /* Detach from old frag. */
if (S_GET_SEGMENT (symbolP) == bss_seg)
symbol_get_frag (symbolP)->fr_symbol = NULL;
else
{
char *p;
+ symbolS *sym = exp->X_add_symbol;
+ offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
- exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
+ if (exp->X_op != O_constant && exp->X_op != O_symbol)
+ {
+ /* Handle complex expressions. */
+ sym = make_expr_symbol (exp);
+ off = 0;
+ }
+
+ p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
*p = fill;
}
}
break;
} /* Won't fit. */
- hold = ++input_line_pointer; /* skip ':' */
+ /* Skip ':'. */
+ hold = ++input_line_pointer;
(void) expression (exp);
if (exp->X_op != O_constant)
int sign;
{
operatorT op = exp->X_op;
+ int nbytes;
if (op == O_absent || op == O_illegal)
{
op = O_constant;
}
+ /* Let check_eh_frame know that data is being emitted. nbytes == -1 is
+ a signal that this is leb128 data. It shouldn't optimize this away. */
+ nbytes = -1;
+ if (check_eh_frame (exp, &nbytes))
+ abort ();
+
+ /* Let the backend know that subsequent data may be byte aligned. */
+#ifdef md_cons_align
+ md_cons_align (1);
+#endif
+
if (op == O_constant)
{
/* If we've got a constant, emit the thing directly right now. */
}
else
{
+#ifdef OBJ_COFF
+ int local;
+
+ symbolP = symbol_find (sym_name);
+ local = symbolP == NULL;
+ if (local)
+#endif /* OBJ_COFF */
symbolP = symbol_find_or_make (sym_name);
/* Permit register names to be redefined. */
if (!reassign
&& S_IS_DEFINED (symbolP)
&& S_GET_SEGMENT (symbolP) != reg_section)
as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
+
+#ifdef OBJ_COFF
+ /* "set" symbols are local unless otherwise specified. */
+ if (local)
+ SF_SET_LOCAL (symbolP);
+#endif /* OBJ_COFF */
+
pseudo_set (symbolP);
}
void
generate_lineno_debug ()
{
-#ifdef ECOFF_DEBUGGING
- /* ECOFF assemblers automatically generate debugging information.
- FIXME: This should probably be handled elsewhere. */
- if (debug_type == DEBUG_UNSPECIFIED)
- {
- if (ECOFF_DEBUGGING && ecoff_no_current_file ())
- debug_type = DEBUG_ECOFF;
- else
- debug_type = DEBUG_NONE;
- }
-#endif
-
switch (debug_type)
{
case DEBUG_UNSPECIFIED:
case DEBUG_NONE:
+ case DEBUG_DWARF:
break;
case DEBUG_STABS:
stabs_generate_asm_lineno ();
case DEBUG_ECOFF:
ecoff_generate_asm_lineno ();
break;
- case DEBUG_DWARF:
case DEBUG_DWARF2:
- /* This cannot safely be done in a generic manner. A single
- binary instruction word may span mutliple lines of assembler
- source and may occupy a variable number of bytes. Instead,
- if a port wishes to support DWARF2 line number generation by
- the assembler, it should add a call to dwarf2_generate_asm_lineno
- inside md_assemble() at whatever point is appropriate. Note,
- such a port should also define md_end and make sure that
- dwarf2_finish is called, to emit the accumulated line information. */
+ /* ??? We could here indicate to dwarf2dbg.c that something
+ has changed. However, since there is additional backend
+ support that is required (calling dwarf2_emit_insn), we
+ let dwarf2dbg.c call as_where on its own. */
break;
}
}