gcc lint. See ChangeLog for details. Also:

* config/obj-elf.h (S_SET_SIZE): Actually set the size.
This commit is contained in:
Ian Lance Taylor 1993-09-10 16:01:07 +00:00
parent 941ffd1960
commit 58d4951d00
15 changed files with 917 additions and 837 deletions

View File

@ -1,3 +1,60 @@
Fri Sep 10 11:22:08 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* config/obj-elf.h (S_SET_SIZE): Actually set the size.
Gcc lint.
* app.c (do_scrub_begin), as.c (main), expr.c (integer_constant,
operand, expr), read.c (read_begin, HANDLE_CONDITIONAL_ASSEMBLY,
read_a_source_file, s_align_bytes, demand_empty_rest_of_line,
ignore_rest_of_line, big_cons, is_it_end_of_statement, s_ignore),
read.h (is_name_beginner, is_part_of_name), config/obj-elf.c
(obj_elf_section), config/tc-i386.c (parse_register),
config/tc-sparc.c (isoctal, s_proc): Cast char
array indices to unsigned char.
* as.c: Include output-file.h for prototypes. Comment out unused
function got_sig.
* Makefile.in (as.o): Depend on output-file.h.
* as.h (BAD_CASE): Cast val argument to long, and use %ld.
* cond.c (ignore_input): Removed unused local variable ptr.
* frags.h: Add prototype for frag_init.
* listing.c (list_symbol_table): Cast sprintf argument to unsigned
long and use %lx. Print name of segment rather than address of
structure.
* read.h: Change get_absolute_expression prototype to return
offsetT. Add prototype for next_char_of_string.
* read.c: Remove prototype for next_char_of_string.
(s_comm): Change temp from valueT to offsetT. Cast to long when
printing and use %ld (only for error messages anyhow).
(emit_expr): Use %lx when printing longs.
(get_absolute_expression): Return offsetT, not long.
(get_stab_string_offset): Comment out unless
SEPARATE_STAB_SECTIONS.
(s_stab_generic): Remove unused offset. Define seg_is_new only
if SEPARATE_STAB_SECTIONS. Use toP only in local block.
* symbols.c: Remove nested comment.
(colon): Use %ld and cast to long in error message.
* write.c (cvt_frag_to_fill): Change first argument name depending
on BFD_ASSEMBLER.
(write_relocs): Remove unused offset, frags.
(write_contents): Remove unused i, n, relocs, fixp.
(write_object_file): Define fragP only if not BFD_ASSEMBLER or not
WORKING_DOT_WORD. Remove unused keep. Only declare punt and
punt_it if they will be used.
(fixup_segment): Cast to long and use %ld in error message.
* config/obj-aout.h: Remove nested comment. Add prototype for
obj_aout_frob_symbol.
* config/obj-ecoff.c (add_string): Make len unsigned long.
(obj_ecoff_stab): Use %lu in error message.
* config/obj-elf.c (obj_elf_common): Comment out unused label
allocate_bss.
(obj_elf_frob_symbol): Return 0 (currently broken).
* config/tc-hppa.h: Remove declarations of functions declared in
read.h.
* config/tc-mips.c (mips_ip, md_apply_fix): Cast to long and use
%ld in error messages.
* config/tc-sparc.c (getExpression): Rewrite condition to avoid
empty conditional body.
Thu Sep 9 17:10:00 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) Thu Sep 9 17:10:00 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
Changes from Jeff Law: Changes from Jeff Law:

View File

@ -1,9 +1,5 @@
/* Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
Modified by Allen Wirfs-Brock, Instantiations Inc 2/90
*/
/* This is the Assembler Pre-Processor /* This is the Assembler Pre-Processor
Copyright (C) 1987 Free Software Foundation, Inc. Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -21,6 +17,7 @@
along with GAS; see the file COPYING. If not, write to along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Modified by Allen Wirfs-Brock, Instantiations Inc 2/90 */
/* App, the assembler pre-processor. This pre-processor strips out excess /* App, the assembler pre-processor. This pre-processor strips out excess
spaces, turns single-quoted characters into a decimal constant, and turns spaces, turns single-quoted characters into a decimal constant, and turns
# <number> <filename> <garbage> into a .line <number>\n.file <filename> # <number> <filename> <garbage> into a .line <number>\n.file <filename>
@ -70,7 +67,9 @@ do_scrub_begin ()
lex['\n'] = LEX_IS_NEWLINE; lex['\n'] = LEX_IS_NEWLINE;
lex[';'] = LEX_IS_LINE_SEPARATOR; lex[';'] = LEX_IS_LINE_SEPARATOR;
lex['"'] = LEX_IS_STRINGQUOTE; lex['"'] = LEX_IS_STRINGQUOTE;
#ifndef TC_HPPA
lex['\''] = LEX_IS_ONECHAR_QUOTE; lex['\''] = LEX_IS_ONECHAR_QUOTE;
#endif
lex[':'] = LEX_IS_COLON; lex[':'] = LEX_IS_COLON;
@ -84,22 +83,22 @@ do_scrub_begin ()
is a comment char, then it isn't a line separator. */ is a comment char, then it isn't a line separator. */
for (p = symbol_chars; *p; ++p) for (p = symbol_chars; *p; ++p)
{ {
lex[*p] = LEX_IS_SYMBOL_COMPONENT; lex[(unsigned char) *p] = LEX_IS_SYMBOL_COMPONENT;
} /* declare symbol characters */ } /* declare symbol characters */
for (p = comment_chars; *p; p++) for (p = comment_chars; *p; p++)
{ {
lex[*p] = LEX_IS_COMMENT_START; lex[(unsigned char) *p] = LEX_IS_COMMENT_START;
} /* declare comment chars */ } /* declare comment chars */
for (p = line_comment_chars; *p; p++) for (p = line_comment_chars; *p; p++)
{ {
lex[*p] = LEX_IS_LINE_COMMENT_START; lex[(unsigned char) *p] = LEX_IS_LINE_COMMENT_START;
} /* declare line comment chars */ } /* declare line comment chars */
for (p = line_separator_chars; *p; p++) for (p = line_separator_chars; *p; p++)
{ {
lex[*p] = LEX_IS_LINE_SEPARATOR; lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR;
} /* declare line separators */ } /* declare line separators */
/* Only allow slash-star comments if slash is not in use */ /* Only allow slash-star comments if slash is not in use */
@ -180,7 +179,7 @@ app_push ()
saved->state = state; saved->state = state;
saved->old_state = old_state; saved->old_state = old_state;
saved->out_string = out_string; saved->out_string = out_string;
memcpy (out_buf, saved->out_buf, sizeof (out_buf)); memcpy (saved->out_buf, out_buf, sizeof (out_buf));
saved->add_newlines = add_newlines; saved->add_newlines = add_newlines;
saved->scrub_string = scrub_string; saved->scrub_string = scrub_string;
saved->scrub_last_string = scrub_last_string; saved->scrub_last_string = scrub_last_string;
@ -200,7 +199,7 @@ app_pop (arg)
state = saved->state; state = saved->state;
old_state = saved->old_state; old_state = saved->old_state;
out_string = saved->out_string; out_string = saved->out_string;
memcpy (saved->out_buf, out_buf, sizeof (out_buf)); memcpy (out_buf, saved->out_buf, sizeof (out_buf));
add_newlines = saved->add_newlines; add_newlines = saved->add_newlines;
scrub_string = saved->scrub_string; scrub_string = saved->scrub_string;
scrub_last_string = saved->scrub_last_string; scrub_last_string = saved->scrub_last_string;
@ -317,6 +316,7 @@ do_scrub_next_char (get, unget)
{ {
while (ch != EOF && ch != '\n') while (ch != EOF && ch != '\n')
ch = (*get) (); ch = (*get) ();
state = 0;
return ch; return ch;
} }
} }
@ -359,6 +359,9 @@ do_scrub_next_char (get, unget)
case '"': case '"':
case '\\': case '\\':
#ifdef TC_HPPA
case 'x': /* '\\x' introduces escaped sequences on the PA */
#endif
case 'b': case 'b':
case 'f': case 'f':
case 'n': case 'n':

View File

@ -84,8 +84,8 @@
#define BAD_CASE(val) \ #define BAD_CASE(val) \
{ \ { \
as_fatal("Case value %d unexpected at line %d of file \"%s\"\n", \ as_fatal("Case value %ld unexpected at line %d of file \"%s\"\n", \
val, __LINE__, __FILE__); \ (long) val, __LINE__, __FILE__); \
} }
@ -140,35 +140,6 @@ typedef addressT valueT;
/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ /* subsegs.c Sub-segments. Also, segment(=expression type)s.*/
#ifndef BFD_ASSEMBLER #ifndef BFD_ASSEMBLER
/*
* This table describes the use of segments as EXPRESSION types.
*
* X_seg X_add_symbol X_subtract_symbol X_add_number
* SEG_ABSENT no (legal) expression
* SEG_PASS1 no (defined) "
* SEG_BIG * > 32 bits const.
* SEG_ABSOLUTE 0
* SEG_DATA * 0
* SEG_TEXT * 0
* SEG_BSS * 0
* SEG_UNKNOWN * 0
* SEG_DIFFERENCE 0 * 0
* SEG_REGISTER *
*
* The blank fields MUST be 0, and are nugatory.
* The '0' fields MAY be 0. The '*' fields MAY NOT be 0.
*
* SEG_BIG: X_add_number is < 0 if the result is in
* generic_floating_point_number. The value is -'c' where c is the
* character that introduced the constant. e.g. "0f6.9" will have -'f'
* as a X_add_number value.
* X_add_number > 0 is a count of how many littlenums it took to
* represent a bignum.
* SEG_DIFFERENCE:
* If segments of both symbols are known, they are the same segment.
* X_add_symbol != X_sub_symbol (then we just cancel them, => SEG_ABSOLUTE).
*/
#ifdef MANY_SEGMENTS #ifdef MANY_SEGMENTS
#include "bfd.h" #include "bfd.h"
@ -189,13 +160,10 @@ typedef enum _segT
SEG_ABSOLUTE = 0, SEG_ABSOLUTE = 0,
SEG_LIST, SEG_LIST,
SEG_UNKNOWN, SEG_UNKNOWN,
SEG_ABSENT, /* Mythical Segment (absent): NO expression seen. */
SEG_PASS1, /* Mythical Segment: Need another pass. */
SEG_GOOF, /* Only happens if AS has a logic error. */ SEG_GOOF, /* Only happens if AS has a logic error. */
/* Invented so we don't crash printing */ /* Invented so we don't crash printing */
/* error message involving weird segment. */ /* error message involving weird segment. */
SEG_BIG, /* Bigger than 32 bits constant. */ SEG_EXPR, /* Intermediate expression values. */
SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
SEG_DEBUG, /* Debug segment */ SEG_DEBUG, /* Debug segment */
SEG_NTV, /* Transfert vector preload segment */ SEG_NTV, /* Transfert vector preload segment */
SEG_PTV, /* Transfert vector postload segment */ SEG_PTV, /* Transfert vector postload segment */
@ -207,11 +175,8 @@ typedef enum _segT
typedef asection *segT; typedef asection *segT;
#define SEG_NORMAL(SEG) ((SEG) != absolute_section \ #define SEG_NORMAL(SEG) ((SEG) != absolute_section \
&& (SEG) != undefined_section \ && (SEG) != undefined_section \
&& (SEG) != big_section \
&& (SEG) != reg_section \ && (SEG) != reg_section \
&& (SEG) != pass1_section \ && (SEG) != expr_section)
&& (SEG) != diff_section \
&& (SEG) != absent_section)
#endif #endif
typedef int subsegT; typedef int subsegT;
@ -233,18 +198,14 @@ extern int section_alignment[];
#endif #endif
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
extern segT big_section, reg_section, pass1_section; extern segT reg_section, expr_section;
extern segT diff_section, absent_section;
/* Shouldn't these be eliminated someday? */ /* Shouldn't these be eliminated someday? */
extern segT text_section, data_section, bss_section; extern segT text_section, data_section, bss_section;
#define absolute_section (&bfd_abs_section) #define absolute_section (&bfd_abs_section)
#define undefined_section (&bfd_und_section) #define undefined_section (&bfd_und_section)
#else #else
#define big_section SEG_BIG
#define reg_section SEG_REGISTER #define reg_section SEG_REGISTER
#define pass1_section SEG_PASS1 #define expr_section SEG_EXPR
#define diff_section SEG_DIFFERENCE
#define absent_section SEG_ABSENT
#define text_section SEG_TEXT #define text_section SEG_TEXT
#define data_section SEG_DATA #define data_section SEG_DATA
#define bss_section SEG_BSS #define bss_section SEG_BSS

View File

@ -27,6 +27,7 @@
#include "coff/symconst.h" #include "coff/symconst.h"
#include "coff/ecoff.h" #include "coff/ecoff.h"
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
#include "../bfd/libcoff.h"
#include "../bfd/libecoff.h" #include "../bfd/libecoff.h"
#include <ctype.h> #include <ctype.h>
@ -1624,7 +1625,7 @@ add_string (vp, hash_tbl, str, ret_hash)
const char *str; /* string */ const char *str; /* string */
shash_t **ret_hash; /* return hash pointer */ shash_t **ret_hash; /* return hash pointer */
{ {
register unsigned int len = strlen (str); register unsigned long len = strlen (str);
register shash_t *hash_ptr; register shash_t *hash_ptr;
if (len >= PAGE_USIZE) if (len >= PAGE_USIZE)
@ -1813,20 +1814,20 @@ add_ecoff_symbol (str, type, storage, sym_value, value, indx)
Also, tie the external pointer back to the function begin symbol. */ Also, tie the external pointer back to the function begin symbol. */
if (begin_type != st_File && begin_type != st_Block) if (begin_type != st_File && begin_type != st_Block)
{ {
symint_t type; symint_t ty;
varray_t *vp = &cur_file_ptr->aux_syms; varray_t *svp = &cur_file_ptr->aux_syms;
pscope->lsym->ecoff_sym.index = add_aux_sym_symint (0); pscope->lsym->ecoff_sym.index = add_aux_sym_symint (0);
pscope->lsym->index_ptr = pscope->lsym->index_ptr =
&vp->last->datum->aux[vp->objects_last_page - 1]; &svp->last->datum->aux[svp->objects_last_page - 1];
type = add_aux_sym_tir (&last_func_type_info, ty = add_aux_sym_tir (&last_func_type_info,
hash_no, hash_no,
&cur_file_ptr->thash_head[0]); &cur_file_ptr->thash_head[0]);
/* /*
if (last_func_sym_value != (symbolS *) NULL) if (last_func_sym_value != (symbolS *) NULL)
{ {
last_func_sym_value->ifd = cur_file_ptr->file_index; last_func_sym_value->ifd = cur_file_ptr->file_index;
last_func_sym_value->index = type; last_func_sym_value->index = ty;
} }
*/ */
} }
@ -2521,7 +2522,7 @@ obj_ecoff_bend (ignore)
static char *coff_sym_name; static char *coff_sym_name;
static type_info_t coff_type; static type_info_t coff_type;
static sc_t coff_storage_class; static sc_t coff_storage_class;
static st_t coff_symbol_type; static st_t coff_symbol_typ;
static int coff_is_function; static int coff_is_function;
static char *coff_tag; static char *coff_tag;
static long coff_value; /* FIXME: Might be 64 bits. */ static long coff_value; /* FIXME: Might be 64 bits. */
@ -2556,7 +2557,7 @@ obj_ecoff_def (ignore)
strcpy (coff_sym_name, name); strcpy (coff_sym_name, name);
coff_type = type_info_init; coff_type = type_info_init;
coff_storage_class = sc_Nil; coff_storage_class = sc_Nil;
coff_symbol_type = st_Nil; coff_symbol_typ = st_Nil;
coff_is_function = 0; coff_is_function = 0;
coff_tag = (char *) NULL; coff_tag = (char *) NULL;
coff_value = 0; coff_value = 0;
@ -2638,7 +2639,7 @@ obj_ecoff_scl (ignore)
val = get_absolute_expression (); val = get_absolute_expression ();
coff_symbol_type = map_coff_sym_type[val]; coff_symbol_typ = map_coff_sym_type[val];
coff_storage_class = map_coff_storage[val]; coff_storage_class = map_coff_storage[val];
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -2855,7 +2856,7 @@ obj_ecoff_endef (ignore)
that are not in COFF, such as short data, etc. */ that are not in COFF, such as short data, etc. */
if (coff_sym_value != (symbolS *) NULL) if (coff_sym_value != (symbolS *) NULL)
{ {
coff_symbol_type = st_Nil; coff_symbol_typ = st_Nil;
coff_storage_class = sc_Nil; coff_storage_class = sc_Nil;
} }
@ -2893,7 +2894,7 @@ obj_ecoff_endef (ignore)
/ coff_type.dimensions[i + 1]); / coff_type.dimensions[i + 1]);
} }
} }
else if (coff_symbol_type == st_Member else if (coff_symbol_typ == st_Member
&& coff_type.num_sizes - coff_type.extra_sizes == 1) && coff_type.num_sizes - coff_type.extra_sizes == 1)
{ {
/* Is this a bitfield? This is indicated by a structure memeber /* Is this a bitfield? This is indicated by a structure memeber
@ -2903,7 +2904,7 @@ obj_ecoff_endef (ignore)
/* Except for enumeration members & begin/ending of scopes, put the /* Except for enumeration members & begin/ending of scopes, put the
type word in the aux. symbol table. */ type word in the aux. symbol table. */
if (coff_symbol_type == st_Block || coff_symbol_type == st_End) if (coff_symbol_typ == st_Block || coff_symbol_typ == st_End)
indx = 0; indx = 0;
else if (coff_inside_enumeration) else if (coff_inside_enumeration)
indx = cur_file_ptr->void_type; indx = cur_file_ptr->void_type;
@ -2936,7 +2937,7 @@ obj_ecoff_endef (ignore)
} }
/* Do any last minute adjustments that are necessary. */ /* Do any last minute adjustments that are necessary. */
switch (coff_symbol_type) switch (coff_symbol_typ)
{ {
default: default:
break; break;
@ -2980,14 +2981,14 @@ obj_ecoff_endef (ignore)
/* Add the symbol. */ /* Add the symbol. */
sym = add_ecoff_symbol (name, sym = add_ecoff_symbol (name,
coff_symbol_type, coff_symbol_typ,
coff_storage_class, coff_storage_class,
coff_sym_value, coff_sym_value,
coff_value, coff_value,
indx); indx);
/* deal with struct, union, and enum tags. */ /* deal with struct, union, and enum tags. */
if (coff_symbol_type == st_Block) if (coff_symbol_typ == st_Block)
{ {
/* Create or update the tag information. */ /* Create or update the tag information. */
tag_t *tag_ptr = get_tag (name, tag_t *tag_ptr = get_tag (name,
@ -3432,7 +3433,7 @@ obj_ecoff_stab (type)
dummy_symr.index = code; dummy_symr.index = code;
if (dummy_symr.index != code) if (dummy_symr.index != code)
{ {
as_warn ("Line number (%d) for .stab%c directive cannot fit in index field (20 bits)", as_warn ("Line number (%lu) for .stab%c directive cannot fit in index field (20 bits)",
code, type); code, type);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
return; return;
@ -4165,16 +4166,16 @@ ecoff_build_procs (buf, bufend, offset)
proc_link != (vlinks_t *) NULL; proc_link != (vlinks_t *) NULL;
proc_link = proc_link->next) proc_link = proc_link->next)
{ {
int proc_cnt; int prc_cnt;
proc_t *proc_ptr; proc_t *proc_ptr;
proc_t *proc_end; proc_t *proc_end;
if (proc_link->next == (vlinks_t *) NULL) if (proc_link->next == (vlinks_t *) NULL)
proc_cnt = fil_ptr->procs.objects_last_page; prc_cnt = fil_ptr->procs.objects_last_page;
else else
proc_cnt = fil_ptr->procs.objects_per_page; prc_cnt = fil_ptr->procs.objects_per_page;
proc_ptr = proc_link->datum->proc; proc_ptr = proc_link->datum->proc;
proc_end = proc_ptr + proc_cnt; proc_end = proc_ptr + prc_cnt;
for (; proc_ptr < proc_end; proc_ptr++) for (; proc_ptr < proc_end; proc_ptr++)
{ {
symbolS *adr_sym; symbolS *adr_sym;

View File

@ -156,7 +156,7 @@ obj_elf_common ()
char *p; char *p;
int align; int align;
allocate_bss: /* allocate_bss: */
old_sec = now_seg; old_sec = now_seg;
old_subsec = now_subseg; old_subsec = now_subseg;
align = temp; align = temp;
@ -358,7 +358,7 @@ obj_elf_section (xxx)
#undef CHECK #undef CHECK
p = input_line_pointer; p = input_line_pointer;
while (!is_end_of_line[*p] && *p != 0 && *p != ',') while (!is_end_of_line[(unsigned char) *p] && *p != 0 && *p != ',')
p++; p++;
*p = 0; *p = 0;
oldp = *p; oldp = *p;
@ -470,6 +470,8 @@ obj_elf_frob_symbol (sym, punt)
relevant. */ relevant. */
return obj_elf_write_symbol_p (sym); return obj_elf_write_symbol_p (sym);
#endif #endif
/* FIXME: Just return 0 until is fixed. */
return 0;
} }
static void static void

View File

@ -50,7 +50,8 @@
#define S_GET_TYPE(S) (elf_symbol((S)->bsym)->type) #define S_GET_TYPE(S) (elf_symbol((S)->bsym)->type)
#define S_GET_DESC(S) (elf_symbol((S)->bsym)->desc) #define S_GET_DESC(S) (elf_symbol((S)->bsym)->desc)
#define S_SET_SIZE(S,V) (elf_symbol((S)->bsym)->internal_elf_sym.st_size) #define S_SET_SIZE(S,V) \
(elf_symbol((S)->bsym)->internal_elf_sym.st_size = (V))
extern asection *gdb_section; extern asection *gdb_section;

View File

@ -316,6 +316,9 @@ const pseudo_typeS md_pseudo_table[] =
{"value", cons, 2}, {"value", cons, 2},
{"noopt", s_ignore, 0}, {"noopt", s_ignore, 0},
{"optim", s_ignore, 0}, {"optim", s_ignore, 0},
#ifdef OBJ_ELF
{"zero", s_space, 0},
#endif
{0, 0, 0} {0, 0, 0}
}; };
@ -2384,7 +2387,7 @@ parse_register (reg_string)
s++; /* skip REGISTER_PREFIX */ s++; /* skip REGISTER_PREFIX */
for (p = reg_name_given; is_register_char (*s); p++, s++) for (p = reg_name_given; is_register_char (*s); p++, s++)
{ {
*p = register_chars[*s]; *p = register_chars[(unsigned char) *s];
if (p >= reg_name_given + MAX_REG_NAME_SIZE) if (p >= reg_name_given + MAX_REG_NAME_SIZE)
return (reg_entry *) 0; return (reg_entry *) 0;
} }

View File

@ -2943,8 +2943,8 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 31) if ((unsigned long) imm_expr.X_add_number > 31)
{ {
as_warn ("Improper shift amount (%d)", as_warn ("Improper shift amount (%ld)",
imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number = imm_expr.X_add_number % 32; imm_expr.X_add_number = imm_expr.X_add_number % 32;
} }
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << 6;
@ -2956,7 +2956,8 @@ mips_ip (str, ip)
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned) imm_expr.X_add_number > 1023) if ((unsigned) imm_expr.X_add_number > 1023)
as_warn ("Illegal break code (%d)", imm_expr.X_add_number); as_warn ("Illegal break code (%ld)",
(long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << 16; ip->insn_opcode |= imm_expr.X_add_number << 16;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
@ -2966,7 +2967,8 @@ mips_ip (str, ip)
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned) imm_expr.X_add_number > 0xfffff) if ((unsigned) imm_expr.X_add_number > 0xfffff)
as_warn ("Illegal syscall code (%d)", imm_expr.X_add_number); as_warn ("Illegal syscall code (%ld)",
(long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << 6;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
@ -2977,8 +2979,8 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number >= (1<<25)) if ((unsigned long) imm_expr.X_add_number >= (1<<25))
{ {
as_warn ("Coproccesor code > 25 bits (%d)", as_warn ("Coproccesor code > 25 bits (%ld)",
imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= ((1<<25) - 1); imm_expr.X_add_number &= ((1<<25) - 1);
} }
ip->insn_opcode |= imm_expr.X_add_number; ip->insn_opcode |= imm_expr.X_add_number;
@ -3811,7 +3813,7 @@ md_apply_fix (fixP, valueP)
* the current segment). * the current segment).
*/ */
if (value & 0x3) if (value & 0x3)
as_warn ("Branch to odd address (%x)", value); as_warn ("Branch to odd address (%lx)", value);
value >>= 2; value >>= 2;
if ((value & ~0xFFFF) && (value & ~0xFFFF) != (-1 & ~0xFFFF)) if ((value & ~0xFFFF) && (value & ~0xFFFF) != (-1 & ~0xFFFF))
as_bad ("Relocation overflow"); as_bad ("Relocation overflow");

View File

@ -95,7 +95,6 @@ const pseudo_typeS md_pseudo_table[] =
#endif #endif
/* end-sanitize-v9 */ /* end-sanitize-v9 */
#ifdef OBJ_ELF #ifdef OBJ_ELF
{"local", s_local, 0},
/* these are specific to sparc/svr4 */ /* these are specific to sparc/svr4 */
{"pushsection", obj_elf_section, 0}, {"pushsection", obj_elf_section, 0},
{"popsection", obj_elf_previous, 0}, {"popsection", obj_elf_previous, 0},
@ -139,7 +138,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
*/ */
static unsigned char octal[256]; static unsigned char octal[256];
#define isoctal(c) octal[c] #define isoctal(c) octal[(unsigned char) (c)]
static unsigned char toHex[256]; static unsigned char toHex[256];
struct sparc_it struct sparc_it
@ -177,7 +176,9 @@ static int special_case;
* sort of like s_lcomm * sort of like s_lcomm
* *
*/ */
#ifndef OBJ_ELF
static int max_alignment = 15; static int max_alignment = 15;
#endif
static void static void
s_reserve () s_reserve ()
@ -241,12 +242,14 @@ s_reserve ()
} }
align = get_absolute_expression (); align = get_absolute_expression ();
#ifndef OBJ_ELF
if (align > max_alignment) if (align > max_alignment)
{ {
align = max_alignment; align = max_alignment;
as_warn ("Alignment too large: %d. assumed.", align); as_warn ("Alignment too large: %d. assumed.", align);
} }
else if (align < 0) #endif
if (align < 0)
{ {
align = 0; align = 0;
as_warn ("Alignment negative. 0 assumed."); as_warn ("Alignment negative. 0 assumed.");
@ -310,37 +313,6 @@ s_reserve ()
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
#ifdef OBJ_ELF
/* Currently used only by Solaris 2. */
void
s_local ()
{
char *name;
int c;
symbolS *symbolP;
do
{
name = input_line_pointer;
c = get_symbol_end ();
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE ();
S_CLEAR_EXTERNAL (symbolP);
symbolP->local = 1;
if (c == ',')
{
input_line_pointer++;
SKIP_WHITESPACE ();
if (*input_line_pointer == '\n')
c = '\n';
}
}
while (c == ',');
demand_empty_rest_of_line ();
}
#endif
static void static void
s_common () s_common ()
{ {
@ -406,12 +378,14 @@ s_common ()
if (*input_line_pointer != '"') if (*input_line_pointer != '"')
{ {
temp = get_absolute_expression (); temp = get_absolute_expression ();
#ifndef OBJ_ELF
if (temp > max_alignment) if (temp > max_alignment)
{ {
temp = max_alignment; temp = max_alignment;
as_warn ("Common alignment too large: %d. assumed", temp); as_warn ("Common alignment too large: %d. assumed", temp);
} }
else if (temp < 0) #endif
if (temp < 0)
{ {
temp = 0; temp = 0;
as_warn ("Common alignment negative; 0 assumed"); as_warn ("Common alignment negative; 0 assumed");
@ -536,9 +510,7 @@ s_data1 ()
static void static void
s_proc () s_proc ()
{ {
extern char is_end_of_line[]; while (!is_end_of_line[(unsigned char) *input_line_pointer])
while (!is_end_of_line[*input_line_pointer])
{ {
++input_line_pointer; ++input_line_pointer;
} }
@ -1793,13 +1765,11 @@ getExpression (str)
save_in = input_line_pointer; save_in = input_line_pointer;
input_line_pointer = str; input_line_pointer = str;
seg = expression (&the_insn.exp); seg = expression (&the_insn.exp);
if (seg == absolute_section if (seg != absolute_section
|| seg == text_section && seg != text_section
|| seg == data_section && seg != data_section
|| seg == bss_section && seg != bss_section
|| seg == undefined_section) && seg != undefined_section)
/* ok */;
else
{ {
the_insn.error = "bad segment"; the_insn.error = "bad segment";
expr_end = input_line_pointer; expr_end = input_line_pointer;
@ -1958,6 +1928,11 @@ md_apply_fix (fixP, value)
switch (fixP->fx_r_type) switch (fixP->fx_r_type)
{ {
case BFD_RELOC_16:
buf[0] = val >> 8;
buf[1] = val;
break;
case BFD_RELOC_32: case BFD_RELOC_32:
buf[0] = val >> 24; buf[0] = val >> 24;
buf[1] = val >> 16; buf[1] = val >> 16;
@ -2172,6 +2147,7 @@ tc_gen_reloc (section, fixp)
switch (fixp->fx_r_type) switch (fixp->fx_r_type)
{ {
case BFD_RELOC_16:
case BFD_RELOC_32: case BFD_RELOC_32:
case BFD_RELOC_HI22: case BFD_RELOC_HI22:
case BFD_RELOC_LO10: case BFD_RELOC_LO10:

View File

@ -150,32 +150,41 @@ integer_constant (radix, expressionP)
number we are looking for is expected to be positive, but if it number we are looking for is expected to be positive, but if it
fits into 32 bits as an unsigned number, we let it be a 32-bit fits into 32 bits as an unsigned number, we let it be a 32-bit
number. The cavalier approach is for speed in ordinary cases. */ number. The cavalier approach is for speed in ordinary cases. */
/* This has been extended for 64 bits. We blindly assume that if
you're compiling in 64-bit mode, the target is a 64-bit machine.
This should be cleaned up. */
#ifdef BFD64
#define valuesize 64
#else /* includes non-bfd case, mostly */
#define valuesize 32
#endif
switch (radix) switch (radix)
{ {
case 2: case 2:
maxdig = 2; maxdig = 2;
too_many_digits = 33; too_many_digits = valuesize + 1;
break; break;
case 8: case 8:
maxdig = radix = 8; maxdig = radix = 8;
too_many_digits = 11; too_many_digits = (valuesize + 2) / 3;
break; break;
case 16: case 16:
maxdig = radix = 16; maxdig = radix = 16;
too_many_digits = 9; too_many_digits = (valuesize + 3) / 4;
break; break;
case 10: case 10:
maxdig = radix = 10; maxdig = radix = 10;
too_many_digits = 11; too_many_digits = (valuesize + 12) / 4; /* very rough */
} }
#undef valuesize
c = *input_line_pointer; c = *input_line_pointer;
input_line_pointer++; input_line_pointer++;
digit_2 = input_line_pointer; digit_2 = input_line_pointer;
for (number = 0; (digit = hex_value[c]) < maxdig; c = *input_line_pointer++) for (number = 0;
(digit = hex_value[(unsigned char) c]) < maxdig;
c = *input_line_pointer++)
{ {
number = number * radix + digit; number = number * radix + digit;
} }
@ -197,7 +206,9 @@ integer_constant (radix, expressionP)
/* we could just use digit_2, but lets be mnemonic. */ /* we could just use digit_2, but lets be mnemonic. */
input_line_pointer = --digit_2; /*->1st digit. */ input_line_pointer = --digit_2; /*->1st digit. */
c = *input_line_pointer++; c = *input_line_pointer++;
for (; (carry = hex_value[c]) < maxdig; c = *input_line_pointer++) for (;
(carry = hex_value[(unsigned char) c]) < maxdig;
c = *input_line_pointer++)
{ {
for (pointer = generic_bignum; for (pointer = generic_bignum;
pointer <= leader; pointer <= leader;
@ -381,7 +392,7 @@ operand (expressionP)
char c; char c;
symbolS *symbolP; /* points to symbol */ symbolS *symbolP; /* points to symbol */
char *name; /* points to name of symbol */ char *name; /* points to name of symbol */
segT retval = absolute_section; segT segment;
/* digits, assume it is a bignum. */ /* digits, assume it is a bignum. */
@ -517,7 +528,7 @@ operand (expressionP)
case '(': case '(':
/* didn't begin with digit & not a name */ /* didn't begin with digit & not a name */
retval = expression (expressionP); segment = expression (expressionP);
/* Expression() will pass trailing whitespace */ /* Expression() will pass trailing whitespace */
if (*input_line_pointer++ != ')') if (*input_line_pointer++ != ')')
{ {
@ -525,7 +536,7 @@ operand (expressionP)
input_line_pointer--; input_line_pointer--;
} }
/* here with input_line_pointer->char after "(...)" */ /* here with input_line_pointer->char after "(...)" */
return retval; return segment;
case '\'': case '\'':
/* Warning: to conform to other people's assemblers NO ESCAPEMENT is /* Warning: to conform to other people's assemblers NO ESCAPEMENT is
@ -536,15 +547,12 @@ operand (expressionP)
break; break;
case '+': case '+':
retval = operand (expressionP); (void) operand (expressionP);
break; break;
case '~': case '~':
case '-': case '-':
{ {
/* When computing - foo, ignore the segment of foo. It has
nothing to do with the segment of the result, which is
ill-defined. */
operand (expressionP); operand (expressionP);
if (expressionP->X_op == O_constant) if (expressionP->X_op == O_constant)
{ {
@ -594,7 +602,6 @@ operand (expressionP)
expressionP->X_op = O_symbol; expressionP->X_op = O_symbol;
expressionP->X_add_symbol = symbolP; expressionP->X_add_symbol = symbolP;
expressionP->X_add_number = 0; expressionP->X_add_number = 0;
retval = now_seg;
break; break;
} }
else else
@ -612,7 +619,7 @@ operand (expressionP)
break; break;
default: default:
if (is_end_of_line[c]) if (is_end_of_line[(unsigned char) c])
goto eol; goto eol;
if (is_name_beginner (c)) /* here if did not begin with a digit */ if (is_name_beginner (c)) /* here if did not begin with a digit */
{ {
@ -627,13 +634,13 @@ operand (expressionP)
/* If we have an absolute symbol or a reg, then we know its /* If we have an absolute symbol or a reg, then we know its
value now. */ value now. */
retval = S_GET_SEGMENT (symbolP); segment = S_GET_SEGMENT (symbolP);
if (retval == absolute_section) if (segment == absolute_section)
{ {
expressionP->X_op = O_constant; expressionP->X_op = O_constant;
expressionP->X_add_number = S_GET_VALUE (symbolP); expressionP->X_add_number = S_GET_VALUE (symbolP);
} }
else if (retval == reg_section) else if (segment == reg_section)
{ {
expressionP->X_op = O_register; expressionP->X_op = O_register;
expressionP->X_add_number = S_GET_VALUE (symbolP); expressionP->X_add_number = S_GET_VALUE (symbolP);
@ -661,7 +668,16 @@ operand (expressionP)
clean_up_expression (expressionP); clean_up_expression (expressionP);
SKIP_WHITESPACE (); /*->1st char after operand. */ SKIP_WHITESPACE (); /*->1st char after operand. */
know (*input_line_pointer != ' '); know (*input_line_pointer != ' ');
return expressionP->X_op == O_constant ? absolute_section : retval;
switch (expressionP->X_op)
{
default:
return absolute_section;
case O_symbol:
return S_GET_SEGMENT (expressionP->X_add_symbol);
case O_register:
return reg_section;
}
} /* operand() */ } /* operand() */
/* Internal. Simplify a struct expression for use by expr() */ /* Internal. Simplify a struct expression for use by expr() */
@ -820,7 +836,7 @@ expr (rank, resultP)
know (*input_line_pointer != ' '); /* Operand() gobbles spaces. */ know (*input_line_pointer != ' '); /* Operand() gobbles spaces. */
c_left = *input_line_pointer; /* Potential operator character. */ c_left = *input_line_pointer; /* Potential operator character. */
op_left = op_encoding[c_left]; op_left = op_encoding[(unsigned char) c_left];
while (op_left != O_illegal && op_rank[(int) op_left] > rank) while (op_left != O_illegal && op_rank[(int) op_left] > rank)
{ {
segT rightseg; segT rightseg;
@ -842,14 +858,19 @@ expr (rank, resultP)
know (*input_line_pointer != ' '); know (*input_line_pointer != ' ');
if (! SEG_NORMAL (retval)) if (retval == undefined_section)
{
if (SEG_NORMAL (rightseg))
retval = rightseg;
}
else if (! SEG_NORMAL (retval))
retval = rightseg; retval = rightseg;
else if (SEG_NORMAL (rightseg) else if (SEG_NORMAL (rightseg)
&& retval != rightseg) && retval != rightseg)
as_bad ("operation combines symbols in different segments"); as_bad ("operation combines symbols in different segments");
c_right = *input_line_pointer; c_right = *input_line_pointer;
op_right = op_encoding[c_right]; op_right = op_encoding[(unsigned char) c_right];
if (*input_line_pointer == c_right && (c_right == '<' || c_right == '>')) if (*input_line_pointer == c_right && (c_right == '<' || c_right == '>'))
++input_line_pointer; ++input_line_pointer;

File diff suppressed because it is too large Load Diff

View File

@ -159,7 +159,6 @@ int new_broken_words;
static char *demand_copy_string PARAMS ((int *lenP)); static char *demand_copy_string PARAMS ((int *lenP));
int is_it_end_of_statement PARAMS ((void)); int is_it_end_of_statement PARAMS ((void));
unsigned int next_char_of_string PARAMS ((void));
static segT get_segmented_expression PARAMS ((expressionS *expP)); static segT get_segmented_expression PARAMS ((expressionS *expP));
static segT get_known_segmented_expression PARAMS ((expressionS * expP)); static segT get_known_segmented_expression PARAMS ((expressionS * expP));
static void grow_bignum PARAMS ((void)); static void grow_bignum PARAMS ((void));
@ -187,7 +186,7 @@ read_begin ()
/* Use machine dependent syntax */ /* Use machine dependent syntax */
for (p = line_separator_chars; *p; p++) for (p = line_separator_chars; *p; p++)
is_end_of_line[*p] = 1; is_end_of_line[(unsigned char) *p] = 1;
/* Use more. FIXME-SOMEDAY. */ /* Use more. FIXME-SOMEDAY. */
} }
@ -329,13 +328,13 @@ pobegin ()
return; return;
} /* pobegin() */ } /* pobegin() */
#define HANDLE_CONDITIONAL_ASSEMBLY() \ #define HANDLE_CONDITIONAL_ASSEMBLY() \
if (ignore_input ()) \ if (ignore_input ()) \
{ \ { \
while (! is_end_of_line[*input_line_pointer++]) \ while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
if (input_line_pointer == buffer_limit) \ if (input_line_pointer == buffer_limit) \
break; \ break; \
continue; \ continue; \
} }
@ -520,7 +519,7 @@ read_a_source_file (name)
/* WARNING: c has char, which may be end-of-line. */ /* WARNING: c has char, which may be end-of-line. */
/* Also: input_line_pointer->`\0` where c was. */ /* Also: input_line_pointer->`\0` where c was. */
*input_line_pointer = c; *input_line_pointer = c;
while (!is_end_of_line[*input_line_pointer] while (!is_end_of_line[(unsigned char) *input_line_pointer]
#ifdef TC_EOL_IN_INSN #ifdef TC_EOL_IN_INSN
|| TC_EOL_IN_INSN (input_line_pointer) || TC_EOL_IN_INSN (input_line_pointer)
#endif #endif
@ -544,7 +543,7 @@ read_a_source_file (name)
} /* if (is_name_beginner(c) */ } /* if (is_name_beginner(c) */
if (is_end_of_line[c]) if (is_end_of_line[(unsigned char) c])
{ {
continue; continue;
} /* empty statement */ } /* empty statement */
@ -726,7 +725,7 @@ s_align_bytes (arg)
unsigned int i = 0; unsigned int i = 0;
unsigned long max_alignment = 1 << 15; unsigned long max_alignment = 1 << 15;
if (is_end_of_line[*input_line_pointer]) if (is_end_of_line[(unsigned char) *input_line_pointer])
temp = arg; /* Default value from pseudo-op table */ temp = arg; /* Default value from pseudo-op table */
else else
temp = get_absolute_expression (); temp = get_absolute_expression ();
@ -808,7 +807,7 @@ s_comm ()
register char *name; register char *name;
register char c; register char c;
register char *p; register char *p;
valueT temp; offsetT temp;
register symbolS *symbolP; register symbolS *symbolP;
name = input_line_pointer; name = input_line_pointer;
@ -826,7 +825,7 @@ s_comm ()
input_line_pointer++; /* skip ',' */ input_line_pointer++; /* skip ',' */
if ((temp = get_absolute_expression ()) < 0) if ((temp = get_absolute_expression ()) < 0)
{ {
as_warn (".COMMon length (%d.) <0! Ignored.", temp); as_warn (".COMMon length (%ld.) <0! Ignored.", (long) temp);
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
@ -841,15 +840,15 @@ s_comm ()
} }
if (S_GET_VALUE (symbolP)) if (S_GET_VALUE (symbolP))
{ {
if (S_GET_VALUE (symbolP) != temp) if (S_GET_VALUE (symbolP) != (valueT) temp)
as_bad ("Length of .comm \"%s\" is already %d. Not changed to %d.", as_bad ("Length of .comm \"%s\" is already %ld. Not changed to %ld.",
S_GET_NAME (symbolP), S_GET_NAME (symbolP),
S_GET_VALUE (symbolP), (long) S_GET_VALUE (symbolP),
temp); (long) temp);
} }
else else
{ {
S_SET_VALUE (symbolP, temp); S_SET_VALUE (symbolP, (valueT) temp);
S_SET_EXTERNAL (symbolP); S_SET_EXTERNAL (symbolP);
} }
#ifdef OBJ_VMS #ifdef OBJ_VMS
@ -1410,7 +1409,7 @@ void
demand_empty_rest_of_line () demand_empty_rest_of_line ()
{ {
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (is_end_of_line[*input_line_pointer]) if (is_end_of_line[(unsigned char) *input_line_pointer])
{ {
input_line_pointer++; input_line_pointer++;
} }
@ -1424,7 +1423,7 @@ demand_empty_rest_of_line ()
void void
ignore_rest_of_line () /* For suspect lines: gives warning. */ ignore_rest_of_line () /* For suspect lines: gives warning. */
{ {
if (!is_end_of_line[*input_line_pointer]) if (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
if (isprint (*input_line_pointer)) if (isprint (*input_line_pointer))
as_bad ("Rest of line ignored. First ignored character is `%c'.", as_bad ("Rest of line ignored. First ignored character is `%c'.",
@ -1433,13 +1432,13 @@ ignore_rest_of_line () /* For suspect lines: gives warning. */
as_bad ("Rest of line ignored. First ignored character valued 0x%x.", as_bad ("Rest of line ignored. First ignored character valued 0x%x.",
*input_line_pointer); *input_line_pointer);
while (input_line_pointer < buffer_limit while (input_line_pointer < buffer_limit
&& !is_end_of_line[*input_line_pointer]) && !is_end_of_line[(unsigned char) *input_line_pointer])
{ {
input_line_pointer++; input_line_pointer++;
} }
} }
input_line_pointer++; /* Return pointing just after end-of-line. */ input_line_pointer++; /* Return pointing just after end-of-line. */
know (is_end_of_line[input_line_pointer[-1]]); know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
} }
/* /*
@ -1699,7 +1698,7 @@ emit_expr (exp, nbytes)
use = get & unmask; use = get & unmask;
if ((get & mask) != 0 && (get & mask) != mask) if ((get & mask) != 0 && (get & mask) != mask)
{ /* Leading bits contain both 0s & 1s. */ { /* Leading bits contain both 0s & 1s. */
as_warn ("Value 0x%x truncated to 0x%x.", get, use); as_warn ("Value 0x%lx truncated to 0x%lx.", get, use);
} }
md_number_to_chars (p, use, nbytes); /* put bytes in right order. */ md_number_to_chars (p, use, nbytes); /* put bytes in right order. */
} }
@ -2047,12 +2046,14 @@ big_cons (nbytes)
* mysterious zero constants: which is what they get when * mysterious zero constants: which is what they get when
* they completely omit digits. * they completely omit digits.
*/ */
if (hex_value[c] >= radix) if (hex_value[(unsigned char) c] >= radix)
{ {
as_bad ("Missing digits. 0 assumed."); as_bad ("Missing digits. 0 assumed.");
} }
bignum_high = bignum_low - 1; /* Start constant with 0 chars. */ bignum_high = bignum_low - 1; /* Start constant with 0 chars. */
for (; (digit = hex_value[c]) < radix; c = *++input_line_pointer) for (;
(digit = hex_value[(unsigned char) c]) < radix;
c = *++input_line_pointer)
{ {
/* Multiply existing number by radix, then add digit. */ /* Multiply existing number by radix, then add digit. */
carry = digit; carry = digit;
@ -2428,7 +2429,7 @@ get_known_segmented_expression (expP)
return (retval); return (retval);
} /* get_known_segmented_expression() */ } /* get_known_segmented_expression() */
/* static */ long /* JF was static, but can't be if the MD pseudos are to use it */ offsetT
get_absolute_expression () get_absolute_expression ()
{ {
expressionS exp; expressionS exp;
@ -2447,7 +2448,8 @@ char /* return terminator */
get_absolute_expression_and_terminator (val_pointer) get_absolute_expression_and_terminator (val_pointer)
long *val_pointer; /* return value of expression */ long *val_pointer; /* return value of expression */
{ {
*val_pointer = get_absolute_expression (); /* FIXME: val_pointer should probably be offsetT *. */
*val_pointer = (long) get_absolute_expression ();
return (*input_line_pointer++); return (*input_line_pointer++);
} }
@ -2536,7 +2538,7 @@ int
is_it_end_of_statement () is_it_end_of_statement ()
{ {
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
return (is_end_of_line[*input_line_pointer]); return (is_end_of_line[(unsigned char) *input_line_pointer]);
} /* is_it_end_of_statement() */ } /* is_it_end_of_statement() */
void void
@ -2643,7 +2645,7 @@ void
s_ignore (arg) s_ignore (arg)
int arg; int arg;
{ {
while (!is_end_of_line[*input_line_pointer]) while (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
++input_line_pointer; ++input_line_pointer;
} }
@ -2700,6 +2702,8 @@ change_to_section (name, len, exp)
* The symbol is added to the .<secname>str section. * The symbol is added to the .<secname>str section.
*/ */
#ifdef SEPARATE_STAB_SECTIONS
static unsigned int static unsigned int
get_stab_string_offset (string, secname) get_stab_string_offset (string, secname)
char *string, *secname; char *string, *secname;
@ -2777,6 +2781,8 @@ get_stab_string_offset (string, secname)
return old_gdb_string_index; return old_gdb_string_index;
} }
#endif /* SEPARATE_STAB_SECTIONS */
/* This can handle different kinds of stabs (s,n,d) and different /* This can handle different kinds of stabs (s,n,d) and different
kinds of stab sections. */ kinds of stab sections. */
@ -2792,15 +2798,15 @@ s_stab_generic (what, secname)
int saved_type = 0; int saved_type = 0;
int length; int length;
int goof = 0; int goof = 0;
int seg_is_new = 0;
long longint; long longint;
segT saved_seg = now_seg; segT saved_seg = now_seg;
segT seg; segT seg;
subsegT saved_subseg = now_subseg; subsegT saved_subseg = now_subseg;
subsegT subseg; subsegT subseg;
int offset;
int valu; int valu;
char *toP; #ifdef SEPARATE_STAB_SECTIONS
int seg_is_new = 0;
#endif
valu = ((char *) obstack_next_free (&frags)) - frag_now->fr_literal; valu = ((char *) obstack_next_free (&frags)) - frag_now->fr_literal;
@ -2947,13 +2953,17 @@ s_stab_generic (what, secname)
#endif #endif
#ifdef SEPARATE_STAB_SECTIONS #ifdef SEPARATE_STAB_SECTIONS
change_to_section(secname, strlen(secname), 0); {
toP = frag_more (8); char *toP;
/* the string index portion of the stab */
md_number_to_chars (toP, (valueT) S_GET_OFFSET_2(symbol), 4); change_to_section(secname, strlen(secname), 0);
md_number_to_chars (toP + 4, (valueT) S_GET_TYPE(symbol), 1); toP = frag_more (8);
md_number_to_chars (toP + 5, (valueT) S_GET_OTHER(symbol), 1); /* the string index portion of the stab */
md_number_to_chars (toP + 6, (valueT) S_GET_DESC(symbol), 2); md_number_to_chars (toP, (valueT) S_GET_OFFSET_2(symbol), 4);
md_number_to_chars (toP + 4, (valueT) S_GET_TYPE(symbol), 1);
md_number_to_chars (toP + 5, (valueT) S_GET_OTHER(symbol), 1);
md_number_to_chars (toP + 6, (valueT) S_GET_DESC(symbol), 2);
}
#endif #endif
#ifdef SEPARATE_STAB_SECTIONS #ifdef SEPARATE_STAB_SECTIONS

View File

@ -36,8 +36,10 @@ extern char *input_line_pointer;/* -> char we are parsing now. */
#define LEX_NAME (1) /* may continue a name */ #define LEX_NAME (1) /* may continue a name */
#define LEX_BEGIN_NAME (2) /* may begin a name */ #define LEX_BEGIN_NAME (2) /* may begin a name */
#define is_name_beginner(c) ( lex_type[c] & LEX_BEGIN_NAME ) #define is_name_beginner(c) \
#define is_part_of_name(c) ( lex_type[c] & LEX_NAME ) ( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME )
#define is_part_of_name(c) \
( lex_type[(unsigned char) (c)] & LEX_NAME )
#ifndef is_a_char #ifndef is_a_char
#define CHAR_MASK (0xff) #define CHAR_MASK (0xff)
@ -55,7 +57,8 @@ extern const char line_separator_chars[];
char *demand_copy_C_string PARAMS ((int *len_pointer)); char *demand_copy_C_string PARAMS ((int *len_pointer));
char get_absolute_expression_and_terminator PARAMS ((long *val_pointer)); char get_absolute_expression_and_terminator PARAMS ((long *val_pointer));
long get_absolute_expression PARAMS ((void)); offsetT get_absolute_expression PARAMS ((void));
unsigned int next_char_of_string PARAMS ((void));
void add_include_dir PARAMS ((char *path)); void add_include_dir PARAMS ((char *path));
void big_cons PARAMS ((int nbytes)); void big_cons PARAMS ((int nbytes));
void cons PARAMS ((unsigned int nbytes)); void cons PARAMS ((unsigned int nbytes));

View File

@ -17,7 +17,7 @@
along with GAS; see the file COPYING. If not, write to along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* #define DEBUG_SYMS /* to debug symbol list maintenance */ /* #define DEBUG_SYMS / * to debug symbol list maintenance */
#include <ctype.h> #include <ctype.h>
@ -281,10 +281,10 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */
S_GET_OTHER (symbolP), S_GET_DESC (symbolP), S_GET_OTHER (symbolP), S_GET_DESC (symbolP),
(long) S_GET_VALUE (symbolP)); (long) S_GET_VALUE (symbolP));
#else #else
as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%d.", as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%ld.",
sym_name, sym_name,
segment_name (S_GET_SEGMENT (symbolP)), segment_name (S_GET_SEGMENT (symbolP)),
S_GET_VALUE (symbolP)); (long) S_GET_VALUE (symbolP));
#endif #endif
} }
} /* if the undefined symbol has no value */ } /* if the undefined symbol has no value */

View File

@ -318,21 +318,18 @@ remove_subsegs (head, seg, root, last)
#endif /* BFD */ #endif /* BFD */
#ifdef BFD_ASSEMBLER
static void static void
cvt_frag_to_fill (x, fragP) cvt_frag_to_fill (sec, fragP)
#ifdef BFD_ASSEMBLER segT sec;
segT x;
#else
object_headers *x;
#endif
fragS *fragP; fragS *fragP;
{
#ifdef BFD_ASSEMBLER
segT sec = x;
#else #else
object_headers *headers = x; static void
cvt_frag_to_fill (headers, fragP)
object_headers *headers;
fragS *fragP;
#endif #endif
{
switch (fragP->fr_type) switch (fragP->fr_type)
{ {
case rs_align: case rs_align:
@ -560,8 +557,6 @@ write_relocs (abfd, sec, xxx)
char *xxx; char *xxx;
{ {
segment_info_type *seginfo = seg_info (sec); segment_info_type *seginfo = seg_info (sec);
unsigned long offset = 0;
fragS *frags;
int i, n; int i, n;
arelent **relocs; arelent **relocs;
fixS *fixp; fixS *fixp;
@ -703,9 +698,6 @@ write_contents (abfd, sec, xxx)
segment_info_type *seginfo = seg_info (sec); segment_info_type *seginfo = seg_info (sec);
unsigned long offset = 0; unsigned long offset = 0;
fragS *frags; fragS *frags;
int i, n;
arelent **relocs;
fixS *fixp;
/* Write out the frags. */ /* Write out the frags. */
if (! (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) if (! (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS))
@ -875,7 +867,9 @@ void
write_object_file () write_object_file ()
{ {
register struct frchain *frchainP; /* Track along all frchains. */ register struct frchain *frchainP; /* Track along all frchains. */
#if ! defined (BFD_ASSEMBLER) || ! defined (WORKING_DOT_WORD)
register fragS *fragP; /* Track along all frags. */ register fragS *fragP; /* Track along all frags. */
#endif
#if !defined (BFD_ASSEMBLER) && !defined (OBJ_VMS) #if !defined (BFD_ASSEMBLER) && !defined (OBJ_VMS)
long object_file_size; long object_file_size;
#endif #endif
@ -1270,8 +1264,6 @@ write_object_file ()
for (symp = symbol_rootP; symp; symp = symbol_next (symp)) for (symp = symbol_rootP; symp; symp = symbol_next (symp))
{ {
int keep = 0;
if (! symp->sy_resolved) if (! symp->sy_resolved)
{ {
if (symp->sy_value.X_op == O_constant) if (symp->sy_value.X_op == O_constant)
@ -1299,16 +1291,21 @@ write_object_file ()
segment_name (symp->bsym->section)); segment_name (symp->bsym->section));
#endif #endif
{ {
int punt = 0;
#ifdef obj_frob_symbol #ifdef obj_frob_symbol
obj_frob_symbol (symp, punt); {
if (punt) int punt = 0;
goto punt_it; obj_frob_symbol (symp, punt);
if (punt)
goto punt_it;
}
#endif #endif
#ifdef tc_frob_symbol #ifdef tc_frob_symbol
tc_frob_symbol (symp, punt); {
if (punt) int punt = 0;
goto punt_it; tc_frob_symbol (symp, punt);
if (punt)
goto punt_it;
}
#endif #endif
} }
/* If we don't want to keep this symbol, splice it out of the /* If we don't want to keep this symbol, splice it out of the
@ -1316,7 +1313,9 @@ write_object_file ()
if (S_IS_LOCAL (symp)) if (S_IS_LOCAL (symp))
{ {
symbolS *prev, *next; symbolS *prev, *next;
#if defined (obj_frob_symbol) || defined (tc_frob_symbol)
punt_it: punt_it:
#endif
prev = symbol_previous (symp); prev = symbol_previous (symp);
next = symbol_next (symp); next = symbol_next (symp);
#ifdef DEBUG_SYMS #ifdef DEBUG_SYMS
@ -1952,8 +1951,8 @@ fixup_segment (fixP, this_segment_type)
{ {
char buf[50]; char buf[50];
sprint_value (buf, fragP->fr_address + where); sprint_value (buf, fragP->fr_address + where);
as_bad ("Value of %d too large for field of %d bytes at %s", as_bad ("Value of %ld too large for field of %d bytes at %s",
add_number, size, buf); (long) add_number, size, buf);
} /* generic error checking */ } /* generic error checking */
#ifdef WARN_SIGNED_OVERFLOW_WORD #ifdef WARN_SIGNED_OVERFLOW_WORD
/* Warn if a .word value is too large when treated as a signed /* Warn if a .word value is too large when treated as a signed