diff options
author | Ian Lance Taylor <ian@airs.com> | 1993-09-10 16:01:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1993-09-10 16:01:07 +0000 |
commit | 58d4951d00478086d83aa397f03944f9a5233270 (patch) | |
tree | 6c79a9a7f3dab39dba5d1390d0508ff6b6ccdf1b /gas | |
parent | 941ffd19606475d07bf1713d05ff191b87f18883 (diff) | |
download | gdb-58d4951d00478086d83aa397f03944f9a5233270.zip gdb-58d4951d00478086d83aa397f03944f9a5233270.tar.gz gdb-58d4951d00478086d83aa397f03944f9a5233270.tar.bz2 |
gcc lint. See ChangeLog for details. Also:
* config/obj-elf.h (S_SET_SIZE): Actually set the size.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 57 | ||||
-rw-r--r-- | gas/app.c | 25 | ||||
-rw-r--r-- | gas/as.h | 51 | ||||
-rw-r--r-- | gas/config/obj-ecoff.c | 45 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 6 | ||||
-rw-r--r-- | gas/config/obj-elf.h | 3 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 5 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 16 | ||||
-rw-r--r-- | gas/config/tc-sparc.c | 66 | ||||
-rw-r--r-- | gas/expr.c | 71 | ||||
-rw-r--r-- | gas/listing.c | 1211 | ||||
-rw-r--r-- | gas/read.c | 90 | ||||
-rw-r--r-- | gas/read.h | 9 | ||||
-rw-r--r-- | gas/symbols.c | 6 | ||||
-rw-r--r-- | gas/write.c | 53 |
15 files changed, 897 insertions, 817 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 88e1d7c..385672a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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) Changes from Jeff Law: @@ -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 - 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. @@ -21,6 +17,7 @@ along with GAS; see the file COPYING. If not, write to 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 spaces, turns single-quoted characters into a decimal constant, and turns # <number> <filename> <garbage> into a .line <number>\n.file <filename> @@ -70,7 +67,9 @@ do_scrub_begin () lex['\n'] = LEX_IS_NEWLINE; lex[';'] = LEX_IS_LINE_SEPARATOR; lex['"'] = LEX_IS_STRINGQUOTE; +#ifndef TC_HPPA lex['\''] = LEX_IS_ONECHAR_QUOTE; +#endif lex[':'] = LEX_IS_COLON; @@ -84,22 +83,22 @@ do_scrub_begin () is a comment char, then it isn't a line separator. */ for (p = symbol_chars; *p; ++p) { - lex[*p] = LEX_IS_SYMBOL_COMPONENT; + lex[(unsigned char) *p] = LEX_IS_SYMBOL_COMPONENT; } /* declare symbol characters */ for (p = comment_chars; *p; p++) { - lex[*p] = LEX_IS_COMMENT_START; + lex[(unsigned char) *p] = LEX_IS_COMMENT_START; } /* declare comment chars */ 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 */ for (p = line_separator_chars; *p; p++) { - lex[*p] = LEX_IS_LINE_SEPARATOR; + lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR; } /* declare line separators */ /* Only allow slash-star comments if slash is not in use */ @@ -180,7 +179,7 @@ app_push () saved->state = state; saved->old_state = old_state; 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->scrub_string = scrub_string; saved->scrub_last_string = scrub_last_string; @@ -200,7 +199,7 @@ app_pop (arg) state = saved->state; old_state = saved->old_state; 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; scrub_string = saved->scrub_string; scrub_last_string = saved->scrub_last_string; @@ -317,6 +316,7 @@ do_scrub_next_char (get, unget) { while (ch != EOF && ch != '\n') ch = (*get) (); + state = 0; return ch; } } @@ -359,6 +359,9 @@ do_scrub_next_char (get, unget) case '"': case '\\': +#ifdef TC_HPPA + case 'x': /* '\\x' introduces escaped sequences on the PA */ +#endif case 'b': case 'f': case 'n': @@ -84,8 +84,8 @@ #define BAD_CASE(val) \ { \ - as_fatal("Case value %d unexpected at line %d of file \"%s\"\n", \ - val, __LINE__, __FILE__); \ + as_fatal("Case value %ld unexpected at line %d of file \"%s\"\n", \ + (long) val, __LINE__, __FILE__); \ } @@ -140,35 +140,6 @@ typedef addressT valueT; /* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ #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 #include "bfd.h" @@ -189,13 +160,10 @@ typedef enum _segT SEG_ABSOLUTE = 0, SEG_LIST, 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. */ /* Invented so we don't crash printing */ /* error message involving weird segment. */ - SEG_BIG, /* Bigger than 32 bits constant. */ - SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */ + SEG_EXPR, /* Intermediate expression values. */ SEG_DEBUG, /* Debug segment */ SEG_NTV, /* Transfert vector preload segment */ SEG_PTV, /* Transfert vector postload segment */ @@ -207,11 +175,8 @@ typedef enum _segT typedef asection *segT; #define SEG_NORMAL(SEG) ((SEG) != absolute_section \ && (SEG) != undefined_section \ - && (SEG) != big_section \ && (SEG) != reg_section \ - && (SEG) != pass1_section \ - && (SEG) != diff_section \ - && (SEG) != absent_section) + && (SEG) != expr_section) #endif typedef int subsegT; @@ -233,18 +198,14 @@ extern int section_alignment[]; #endif #ifdef BFD_ASSEMBLER -extern segT big_section, reg_section, pass1_section; -extern segT diff_section, absent_section; +extern segT reg_section, expr_section; /* Shouldn't these be eliminated someday? */ extern segT text_section, data_section, bss_section; #define absolute_section (&bfd_abs_section) #define undefined_section (&bfd_und_section) #else -#define big_section SEG_BIG #define reg_section SEG_REGISTER -#define pass1_section SEG_PASS1 -#define diff_section SEG_DIFFERENCE -#define absent_section SEG_ABSENT +#define expr_section SEG_EXPR #define text_section SEG_TEXT #define data_section SEG_DATA #define bss_section SEG_BSS diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c index edee4e4..0006c2d 100644 --- a/gas/config/obj-ecoff.c +++ b/gas/config/obj-ecoff.c @@ -27,6 +27,7 @@ #include "coff/symconst.h" #include "coff/ecoff.h" #include "aout/stab_gnu.h" +#include "../bfd/libcoff.h" #include "../bfd/libecoff.h" #include <ctype.h> @@ -1624,7 +1625,7 @@ add_string (vp, hash_tbl, str, ret_hash) const char *str; /* string */ shash_t **ret_hash; /* return hash pointer */ { - register unsigned int len = strlen (str); + register unsigned long len = strlen (str); register shash_t *hash_ptr; 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. */ if (begin_type != st_File && begin_type != st_Block) { - symint_t type; - varray_t *vp = &cur_file_ptr->aux_syms; + symint_t ty; + varray_t *svp = &cur_file_ptr->aux_syms; pscope->lsym->ecoff_sym.index = add_aux_sym_symint (0); pscope->lsym->index_ptr = - &vp->last->datum->aux[vp->objects_last_page - 1]; - type = add_aux_sym_tir (&last_func_type_info, - hash_no, - &cur_file_ptr->thash_head[0]); + &svp->last->datum->aux[svp->objects_last_page - 1]; + ty = add_aux_sym_tir (&last_func_type_info, + hash_no, + &cur_file_ptr->thash_head[0]); /* if (last_func_sym_value != (symbolS *) NULL) { 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 type_info_t coff_type; static sc_t coff_storage_class; -static st_t coff_symbol_type; +static st_t coff_symbol_typ; static int coff_is_function; static char *coff_tag; static long coff_value; /* FIXME: Might be 64 bits. */ @@ -2556,7 +2557,7 @@ obj_ecoff_def (ignore) strcpy (coff_sym_name, name); coff_type = type_info_init; coff_storage_class = sc_Nil; - coff_symbol_type = st_Nil; + coff_symbol_typ = st_Nil; coff_is_function = 0; coff_tag = (char *) NULL; coff_value = 0; @@ -2638,7 +2639,7 @@ obj_ecoff_scl (ignore) 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]; demand_empty_rest_of_line (); @@ -2855,7 +2856,7 @@ obj_ecoff_endef (ignore) that are not in COFF, such as short data, etc. */ if (coff_sym_value != (symbolS *) NULL) { - coff_symbol_type = st_Nil; + coff_symbol_typ = st_Nil; coff_storage_class = sc_Nil; } @@ -2893,7 +2894,7 @@ obj_ecoff_endef (ignore) / 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) { /* 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 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; else if (coff_inside_enumeration) indx = cur_file_ptr->void_type; @@ -2936,7 +2937,7 @@ obj_ecoff_endef (ignore) } /* Do any last minute adjustments that are necessary. */ - switch (coff_symbol_type) + switch (coff_symbol_typ) { default: break; @@ -2980,14 +2981,14 @@ obj_ecoff_endef (ignore) /* Add the symbol. */ sym = add_ecoff_symbol (name, - coff_symbol_type, + coff_symbol_typ, coff_storage_class, coff_sym_value, coff_value, indx); /* 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. */ tag_t *tag_ptr = get_tag (name, @@ -3432,7 +3433,7 @@ obj_ecoff_stab (type) 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); demand_empty_rest_of_line (); return; @@ -4165,16 +4166,16 @@ ecoff_build_procs (buf, bufend, offset) proc_link != (vlinks_t *) NULL; proc_link = proc_link->next) { - int proc_cnt; + int prc_cnt; proc_t *proc_ptr; proc_t *proc_end; if (proc_link->next == (vlinks_t *) NULL) - proc_cnt = fil_ptr->procs.objects_last_page; + prc_cnt = fil_ptr->procs.objects_last_page; else - proc_cnt = fil_ptr->procs.objects_per_page; + prc_cnt = fil_ptr->procs.objects_per_page; 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++) { symbolS *adr_sym; diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 1f5d66f..5ccf21d 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -156,7 +156,7 @@ obj_elf_common () char *p; int align; - allocate_bss: + /* allocate_bss: */ old_sec = now_seg; old_subsec = now_subseg; align = temp; @@ -358,7 +358,7 @@ obj_elf_section (xxx) #undef CHECK 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 = 0; oldp = *p; @@ -470,6 +470,8 @@ obj_elf_frob_symbol (sym, punt) relevant. */ return obj_elf_write_symbol_p (sym); #endif + /* FIXME: Just return 0 until is fixed. */ + return 0; } static void diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h index 70f8f4e..4775a76 100644 --- a/gas/config/obj-elf.h +++ b/gas/config/obj-elf.h @@ -50,7 +50,8 @@ #define S_GET_TYPE(S) (elf_symbol((S)->bsym)->type) #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; diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index c77d2cb..f1d92ef 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -316,6 +316,9 @@ const pseudo_typeS md_pseudo_table[] = {"value", cons, 2}, {"noopt", s_ignore, 0}, {"optim", s_ignore, 0}, +#ifdef OBJ_ELF + {"zero", s_space, 0}, +#endif {0, 0, 0} }; @@ -2384,7 +2387,7 @@ parse_register (reg_string) s++; /* skip REGISTER_PREFIX */ 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) return (reg_entry *) 0; } diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 2ba8fbb..9bf0dcc 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -2943,8 +2943,8 @@ mips_ip (str, ip) check_absolute_expr (ip, &imm_expr); if ((unsigned long) imm_expr.X_add_number > 31) { - as_warn ("Improper shift amount (%d)", - imm_expr.X_add_number); + as_warn ("Improper shift amount (%ld)", + (long) imm_expr.X_add_number); imm_expr.X_add_number = imm_expr.X_add_number % 32; } ip->insn_opcode |= imm_expr.X_add_number << 6; @@ -2956,7 +2956,8 @@ mips_ip (str, ip) my_getExpression (&imm_expr, s); check_absolute_expr (ip, &imm_expr); 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; imm_expr.X_op = O_absent; s = expr_end; @@ -2966,7 +2967,8 @@ mips_ip (str, ip) my_getExpression (&imm_expr, s); check_absolute_expr (ip, &imm_expr); 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; imm_expr.X_op = O_absent; s = expr_end; @@ -2977,8 +2979,8 @@ mips_ip (str, ip) check_absolute_expr (ip, &imm_expr); if ((unsigned long) imm_expr.X_add_number >= (1<<25)) { - as_warn ("Coproccesor code > 25 bits (%d)", - imm_expr.X_add_number); + as_warn ("Coproccesor code > 25 bits (%ld)", + (long) imm_expr.X_add_number); imm_expr.X_add_number &= ((1<<25) - 1); } ip->insn_opcode |= imm_expr.X_add_number; @@ -3811,7 +3813,7 @@ md_apply_fix (fixP, valueP) * the current segment). */ if (value & 0x3) - as_warn ("Branch to odd address (%x)", value); + as_warn ("Branch to odd address (%lx)", value); value >>= 2; if ((value & ~0xFFFF) && (value & ~0xFFFF) != (-1 & ~0xFFFF)) as_bad ("Relocation overflow"); diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index eb983db..7a29f46 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -95,7 +95,6 @@ const pseudo_typeS md_pseudo_table[] = #endif /* end-sanitize-v9 */ #ifdef OBJ_ELF - {"local", s_local, 0}, /* these are specific to sparc/svr4 */ {"pushsection", obj_elf_section, 0}, {"popsection", obj_elf_previous, 0}, @@ -139,7 +138,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; */ static unsigned char octal[256]; -#define isoctal(c) octal[c] +#define isoctal(c) octal[(unsigned char) (c)] static unsigned char toHex[256]; struct sparc_it @@ -177,7 +176,9 @@ static int special_case; * sort of like s_lcomm * */ +#ifndef OBJ_ELF static int max_alignment = 15; +#endif static void s_reserve () @@ -241,12 +242,14 @@ s_reserve () } align = get_absolute_expression (); +#ifndef OBJ_ELF if (align > max_alignment) { align = max_alignment; as_warn ("Alignment too large: %d. assumed.", align); } - else if (align < 0) +#endif + if (align < 0) { align = 0; as_warn ("Alignment negative. 0 assumed."); @@ -310,37 +313,6 @@ s_reserve () 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 s_common () { @@ -406,12 +378,14 @@ s_common () if (*input_line_pointer != '"') { temp = get_absolute_expression (); +#ifndef OBJ_ELF if (temp > max_alignment) { temp = max_alignment; as_warn ("Common alignment too large: %d. assumed", temp); } - else if (temp < 0) +#endif + if (temp < 0) { temp = 0; as_warn ("Common alignment negative; 0 assumed"); @@ -536,9 +510,7 @@ s_data1 () static void s_proc () { - extern char is_end_of_line[]; - - while (!is_end_of_line[*input_line_pointer]) + while (!is_end_of_line[(unsigned char) *input_line_pointer]) { ++input_line_pointer; } @@ -1793,13 +1765,11 @@ getExpression (str) save_in = input_line_pointer; input_line_pointer = str; seg = expression (&the_insn.exp); - if (seg == absolute_section - || seg == text_section - || seg == data_section - || seg == bss_section - || seg == undefined_section) - /* ok */; - else + if (seg != absolute_section + && seg != text_section + && seg != data_section + && seg != bss_section + && seg != undefined_section) { the_insn.error = "bad segment"; expr_end = input_line_pointer; @@ -1958,6 +1928,11 @@ md_apply_fix (fixP, value) switch (fixP->fx_r_type) { + case BFD_RELOC_16: + buf[0] = val >> 8; + buf[1] = val; + break; + case BFD_RELOC_32: buf[0] = val >> 24; buf[1] = val >> 16; @@ -2172,6 +2147,7 @@ tc_gen_reloc (section, fixp) switch (fixp->fx_r_type) { + case BFD_RELOC_16: case BFD_RELOC_32: case BFD_RELOC_HI22: case BFD_RELOC_LO10: @@ -150,32 +150,41 @@ integer_constant (radix, expressionP) 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 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) { - case 2: maxdig = 2; - too_many_digits = 33; + too_many_digits = valuesize + 1; break; case 8: maxdig = radix = 8; - too_many_digits = 11; + too_many_digits = (valuesize + 2) / 3; break; case 16: - - maxdig = radix = 16; - too_many_digits = 9; + too_many_digits = (valuesize + 3) / 4; break; case 10: maxdig = radix = 10; - too_many_digits = 11; + too_many_digits = (valuesize + 12) / 4; /* very rough */ } +#undef valuesize c = *input_line_pointer; 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; } @@ -197,7 +206,9 @@ integer_constant (radix, expressionP) /* we could just use digit_2, but lets be mnemonic. */ input_line_pointer = --digit_2; /*->1st digit. */ 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; pointer <= leader; @@ -381,7 +392,7 @@ operand (expressionP) char c; symbolS *symbolP; /* points to symbol */ char *name; /* points to name of symbol */ - segT retval = absolute_section; + segT segment; /* digits, assume it is a bignum. */ @@ -517,7 +528,7 @@ operand (expressionP) case '(': /* didn't begin with digit & not a name */ - retval = expression (expressionP); + segment = expression (expressionP); /* Expression() will pass trailing whitespace */ if (*input_line_pointer++ != ')') { @@ -525,7 +536,7 @@ operand (expressionP) input_line_pointer--; } /* here with input_line_pointer->char after "(...)" */ - return retval; + return segment; case '\'': /* Warning: to conform to other people's assemblers NO ESCAPEMENT is @@ -536,15 +547,12 @@ operand (expressionP) break; case '+': - retval = operand (expressionP); + (void) operand (expressionP); break; 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); if (expressionP->X_op == O_constant) { @@ -594,7 +602,6 @@ operand (expressionP) expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; - retval = now_seg; break; } else @@ -612,7 +619,7 @@ operand (expressionP) break; default: - if (is_end_of_line[c]) + if (is_end_of_line[(unsigned char) c]) goto eol; 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 value now. */ - retval = S_GET_SEGMENT (symbolP); - if (retval == absolute_section) + segment = S_GET_SEGMENT (symbolP); + if (segment == absolute_section) { expressionP->X_op = O_constant; 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_add_number = S_GET_VALUE (symbolP); @@ -661,7 +668,16 @@ operand (expressionP) clean_up_expression (expressionP); SKIP_WHITESPACE (); /*->1st char after operand. */ 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() */ /* Internal. Simplify a struct expression for use by expr() */ @@ -820,7 +836,7 @@ expr (rank, resultP) know (*input_line_pointer != ' '); /* Operand() gobbles spaces. */ 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) { segT rightseg; @@ -842,14 +858,19 @@ expr (rank, resultP) 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; else if (SEG_NORMAL (rightseg) && retval != rightseg) as_bad ("operation combines symbols in different segments"); 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 == '>')) ++input_line_pointer; diff --git a/gas/listing.c b/gas/listing.c index ef88c0d..44247e2 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -23,7 +23,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ A listing page looks like: - + LISTING_HEADER sourcefilename pagenumber TITLE LINE SUBTITLE LINE @@ -34,8 +34,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ If not overridden, the listing commands are: - .title "stuff" - Put "stuff" onto the title line + .title "stuff" + Put "stuff" onto the title line .sbttl "stuff" Put stuff onto the subtitle line @@ -53,7 +53,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Set the paper size to X wide and Y high. Setting a psize Y of zero will suppress form feeds except where demanded by .eject - If the counter goes below zero, listing is suppressed. + If the counter goes below zero, listing is suppressed. Listings are a maintained by read calling various listing_<foo> @@ -91,12 +91,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ on a line */ +#include <ctype.h> + #include "as.h" #include <obstack.h> #include "input-file.h" -#include "targ-cpu.h" - -char *malloc(); #ifndef NO_LISTING #ifndef LISTING_HEADER @@ -114,7 +113,7 @@ char *malloc(); #ifndef LISTING_RHS_WIDTH #define LISTING_RHS_WIDTH 100 #endif -#ifndef LISTING_LHS_CONT_LINES +#ifndef LISTING_LHS_CONT_LINES #define LISTING_LHS_CONT_LINES 4 #endif @@ -122,17 +121,19 @@ char *malloc(); /* This structure remembers which .s were used */ -typedef struct file_info_struct +typedef struct file_info_struct { char *filename; int linenum; FILE *file; struct file_info_struct *next; int end_pending; - -} file_info_type ; - +} + +file_info_type; + + /* this structure rememebrs which line from which file goes into which frag */ typedef struct list_info_struct @@ -152,32 +153,34 @@ typedef struct list_info_struct /* Pointer to the file info struct for the high level language source line that belongs here */ file_info_type *hll_file; - + /* High level language source line */ int hll_line; - + /* Pointer to any error message associated with this line */ char *message; - - enum - { - EDICT_NONE, - EDICT_SBTTL, - EDICT_TITLE, - EDICT_NOLIST, - EDICT_LIST, - EDICT_EJECT - } edict; + + enum + { + EDICT_NONE, + EDICT_SBTTL, + EDICT_TITLE, + EDICT_NOLIST, + EDICT_LIST, + EDICT_EJECT + } edict; char *edict_arg; - -} list_info_type; + +} + +list_info_type; static struct list_info_struct *head; struct list_info_struct *listing_tail; extern int listing; -extern unsigned int physical_input_line; +extern unsigned int physical_input_line; extern fragS *frag_now; @@ -194,38 +197,58 @@ static int paper_height = 60; static char data_buffer[100]; static unsigned int data_buffer_size; - + +/* Prototypes. */ +static void listing_message PARAMS ((const char *name, const char *message)); +static file_info_type *file_info PARAMS ((const char *file_name)); +static void new_frag PARAMS ((void)); +static char *buffer_line PARAMS ((file_info_type *file, + char *line, unsigned int size)); +static void listing_page PARAMS ((list_info_type *list)); +static unsigned int calc_hex PARAMS ((list_info_type *list)); +static void print_lines PARAMS ((list_info_type *list, + char *string, + unsigned int address)); +static void list_symbol_table PARAMS ((void)); +static void print_source PARAMS ((file_info_type *current_file, + list_info_type *list, + char *buffer, + unsigned int width)); +static int debugging_pseudo PARAMS ((char *line)); +static void listing_listing PARAMS ((char *name)); + + static void -DEFUN(listing_message,(name, message), - char *name AND - char *message) +listing_message (name, message) + const char *name; + const char *message; { - unsigned int l = strlen(name) + strlen(message)+1; - char *n = (char*)malloc(l); - strcpy(n,name); - strcat(n,message); - if(listing_tail != (list_info_type *)NULL) - { - listing_tail->message = n; - } - + unsigned int l = strlen (name) + strlen (message) + 1; + char *n = (char *) xmalloc (l); + strcpy (n, name); + strcat (n, message); + if (listing_tail != (list_info_type *) NULL) + { + listing_tail->message = n; + } + } -void -DEFUN(listing_warning,(message), - char *message) +void +listing_warning (message) + const char *message; { - listing_message("Warning:", message); + listing_message ("Warning:", message); } -void -DEFUN(listing_error,(message), - char *message) +void +listing_error (message) + const char *message; { - listing_message("Error:", message); + listing_message ("Error:", message); } @@ -234,272 +257,268 @@ DEFUN(listing_error,(message), static file_info_type *file_info_head; static file_info_type * -DEFUN(file_info, (file_name), - char *file_name) +file_info (file_name) + const char *file_name; { /* Find an entry with this file name */ file_info_type *p = file_info_head; - - while (p != (file_info_type *)NULL) - { - if (strcmp(p->filename, file_name) == 0) - return p; - p = p->next; - } + + while (p != (file_info_type *) NULL) + { + if (strcmp (p->filename, file_name) == 0) + return p; + p = p->next; + } /* Make new entry */ - p = (file_info_type *)xmalloc(sizeof(file_info_type)); + p = (file_info_type *) xmalloc (sizeof (file_info_type)); p->next = file_info_head; file_info_head = p; - p->filename = xmalloc(strlen(file_name)+1); - strcpy(p->filename, file_name); + p->filename = xmalloc (strlen (file_name) + 1); + strcpy (p->filename, file_name); p->linenum = 0; p->end_pending = 0; - - p->file = fopen(p->filename,"rb"); -if (p->file) fgetc(p->file); - + p->file = fopen (p->filename, "rb"); + if (p->file) + fgetc (p->file); return p; - } -static void -DEFUN_VOID(new_frag) +static void +new_frag () { - - frag_wane(frag_now); - frag_new(0); + + frag_wane (frag_now); + frag_new (0); } -void -DEFUN(listing_newline,(ps), - char *ps) +void +listing_newline (ps) + char *ps; { - char *s = ps; extern char *file_name; - static unsigned int last_line =0xffff ; + static unsigned int last_line = 0xffff; + - list_info_type *new; - if (physical_input_line != last_line) - { - last_line = physical_input_line; - new_frag(); - - new = (list_info_type *)malloc(sizeof(list_info_type)); - new->frag = frag_now; - new->line = physical_input_line ; - new->file = file_info(file_name); - - if (listing_tail) - { - listing_tail->next = new; - } - else + if (physical_input_line != last_line) { - head = new; + last_line = physical_input_line; + new_frag (); + + new = (list_info_type *) xmalloc (sizeof (list_info_type)); + new->frag = frag_now; + new->line = physical_input_line; + new->file = file_info (file_name); + + if (listing_tail) + { + listing_tail->next = new; + } + else + { + head = new; + } + listing_tail = new; + new->next = (list_info_type *) NULL; + new->message = (char *) NULL; + new->edict = EDICT_NONE; + new->hll_file = (file_info_type *) NULL; + new->hll_line = 0; + new_frag (); } - listing_tail = new; - new->next = (list_info_type *)NULL; - new->message = (char *)NULL; - new->edict = EDICT_NONE; - new->hll_file = (file_info_type*)NULL; - new->hll_line = 0; - new_frag(); - } } -/* +/* This function returns the next source line from the file supplied, truncated to size. It appends a fake line to the end of each input file to make */ static char * -DEFUN(buffer_line,(file, line, size), - file_info_type *file AND - char *line AND - unsigned int size) +buffer_line (file, line, size) + file_info_type * file; + char *line; + unsigned int size; { unsigned int count = 0; int c; - + char *p = line; /* If we couldn't open the file, return an empty line */ - if (file->file == (FILE*)NULL) - { - return ""; - } + if (file->file == (FILE *) NULL) + { + return ""; + } if (file->linenum == 0) - rewind(file->file); + rewind (file->file); - if (file->end_pending == 10) { - *p ++ = '\n'; - fseek(file->file, 0,0 ); + if (file->end_pending == 10) + { + *p++ = '\n'; + fseek (file->file, 0, 0); file->linenum = 0; file->end_pending = 0; - } - c = fgetc(file->file); + } + c = fgetc (file->file); + - size -= 1; /* leave room for null */ - while (c != EOF && c != '\n') - { - if (count < size) - *p++ = c; - count++; - - c= fgetc(file->file); - - } - if (c == EOF) - { - file->end_pending ++; - *p++ = '.'; - *p++ = '.'; - *p++ = '.'; - } - file->linenum++; + while (c != EOF && c != '\n') + { + if (count < size) + *p++ = c; + count++; + + c = fgetc (file->file); + + } + if (c == EOF) + { + file->end_pending++; + *p++ = '.'; + *p++ = '.'; + *p++ = '.'; + } + file->linenum++; *p++ = 0; return line; } -static char *fn; +static const char *fn; static unsigned int eject; /* Eject pending */ -static unsigned int page; /* Current page number */ -static char *title; /* current title */ +static unsigned int page; /* Current page number */ +static char *title; /* current title */ static char *subtitle; /* current subtitle */ -static unsigned int on_page; /* number of lines printed on current page */ +static unsigned int on_page; /* number of lines printed on current page */ static void -DEFUN(listing_page,(list), - list_info_type *list) +listing_page (list) + list_info_type *list; { /* Grope around, see if we can see a title or subtitle edict coming up soon (we look down 10 lines of the page and see if it's there)*/ - if ((eject || (on_page >= paper_height)) && paper_height != 0) - { - unsigned int c = 10; - int had_title = 0; - int had_subtitle = 0; - - page++; - - while (c != 0 && list) + if ((eject || (on_page >= paper_height)) && paper_height != 0) { - if (list->edict == EDICT_SBTTL && !had_subtitle) - { - had_subtitle = 1; - subtitle = list->edict_arg; - } - if (list->edict == EDICT_TITLE && !had_title) - { - had_title = 1; - title = list->edict_arg; - } - list = list->next; - c--; - } - + unsigned int c = 10; + int had_title = 0; + int had_subtitle = 0; - if (page > 1) - { - printf("\f"); + page++; + + while (c != 0 && list) + { + if (list->edict == EDICT_SBTTL && !had_subtitle) + { + had_subtitle = 1; + subtitle = list->edict_arg; + } + if (list->edict == EDICT_TITLE && !had_title) + { + had_title = 1; + title = list->edict_arg; + } + list = list->next; + c--; + } + + + if (page > 1) + { + printf ("\f"); + } + + printf ("%s %s \t\t\tpage %d\n", LISTING_HEADER, fn, page); + printf ("%s\n", title); + printf ("%s\n", subtitle); + on_page = 3; + eject = 0; } - - printf("%s %s \t\t\tpage %d\n", LISTING_HEADER, fn, page); - printf("%s\n", title); - printf("%s\n", subtitle); - on_page = 3; - eject = 0; - } } -static unsigned int -DEFUN(calc_hex,(list), - list_info_type *list) +static unsigned int +calc_hex (list) + list_info_type * list; { list_info_type *first = list; - list_info_type *last = first; unsigned int address = ~0; - + fragS *frag; fragS *frag_ptr; - unsigned int byte_in_frag = 0; - - int anything = 0; + unsigned int byte_in_frag = 0; + /* Find first frag which says it belongs to this line */ - frag = list->frag; - while (frag && frag->line != list) - frag = frag->fr_next; + frag = list->frag; + while (frag && frag->line != list) + frag = frag->fr_next; frag_ptr = frag; data_buffer_size = 0; - + /* Dump all the frags which belong to this line */ - while (frag_ptr != (fragS *)NULL && frag_ptr->line == first) - { - /* Print as many bytes from the fixed part as is sensible */ - while(byte_in_frag < frag_ptr->fr_fix && data_buffer_size < sizeof(data_buffer)-10) - { - if (address == ~0) - { - address = frag_ptr->fr_address; - } - - sprintf(data_buffer + data_buffer_size, - "%02X", - (frag_ptr->fr_literal[byte_in_frag]) & 0xff); - data_buffer_size += 2; - byte_in_frag++; - } - { - unsigned int var_rep_max = byte_in_frag; - unsigned int var_rep_idx = byte_in_frag; - - /* Print as many bytes from the variable part as is sensible */ - while (byte_in_frag < frag_ptr->fr_var * frag_ptr->fr_offset - && data_buffer_size < sizeof(data_buffer)-10) + while (frag_ptr != (fragS *) NULL && frag_ptr->line == first) { - if (address == ~0) + /* Print as many bytes from the fixed part as is sensible */ + while (byte_in_frag < frag_ptr->fr_fix && data_buffer_size < sizeof (data_buffer) - 10) + { + if (address == ~0) + { + address = frag_ptr->fr_address; + } + + sprintf (data_buffer + data_buffer_size, + "%02X", + (frag_ptr->fr_literal[byte_in_frag]) & 0xff); + data_buffer_size += 2; + byte_in_frag++; + } { - address = frag_ptr->fr_address; - } -sprintf(data_buffer + data_buffer_size, - "%02X", - (frag_ptr->fr_literal[var_rep_idx]) & 0xff); -#if 0 - data_buffer[data_buffer_size++] = '*'; - data_buffer[data_buffer_size++] = '*'; + unsigned int var_rep_max = byte_in_frag; + unsigned int var_rep_idx = byte_in_frag; + + /* Print as many bytes from the variable part as is sensible */ + while (byte_in_frag < frag_ptr->fr_var * frag_ptr->fr_offset + && data_buffer_size < sizeof (data_buffer) - 10) + { + if (address == ~0) + { + address = frag_ptr->fr_address; + } + sprintf (data_buffer + data_buffer_size, + "%02X", + (frag_ptr->fr_literal[var_rep_idx]) & 0xff); +#if 0 + data_buffer[data_buffer_size++] = '*'; + data_buffer[data_buffer_size++] = '*'; #endif - data_buffer_size +=2; - - var_rep_idx ++; - byte_in_frag++; - - if (var_rep_idx >= frag_ptr->fr_var) - var_rep_idx = var_rep_max; + data_buffer_size += 2; + + var_rep_idx++; + byte_in_frag++; + + if (var_rep_idx >= frag_ptr->fr_var) + var_rep_idx = var_rep_max; + } + } + + frag_ptr = frag_ptr->fr_next; } - } - - frag_ptr = frag_ptr->fr_next; - } data_buffer[data_buffer_size++] = 0; return address; } @@ -510,512 +529,534 @@ sprintf(data_buffer + data_buffer_size, static void -DEFUN(print_lines,(list, string, address), -list_info_type *list AND -char *string AND -unsigned int address) +print_lines (list, string, address) + list_info_type *list; + char *string; + unsigned int address; { unsigned int idx; unsigned int nchars; unsigned int lines; - unsigned int byte_in_word =0; + unsigned int byte_in_word = 0; char *src = data_buffer; - + /* Print the stuff on the first line */ - listing_page(list); - nchars = (LISTING_WORD_SIZE*2 +1) * LISTING_LHS_WIDTH ; + listing_page (list); + nchars = (LISTING_WORD_SIZE * 2 + 1) * LISTING_LHS_WIDTH; /* Print the hex for the first line */ - if (address == ~0) - { - printf("% 4d ", list->line); - for (idx = 0; idx < nchars; idx++) - printf(" "); - - printf("\t%s\n", string ? string : ""); - on_page++; - listing_page(0); - - } - else - { - if (had_errors()) - { - printf("% 4d ???? ", list->line); - } - else + if (address == ~0) { - printf("% 4d %04x ", list->line, address); - } - - /* And the data to go along with it */ - idx = 0; - - while (*src && idx < nchars) - { - printf("%c%c", src[0], src[1]); - src += 2; - byte_in_word++; - if (byte_in_word == LISTING_WORD_SIZE) - { - printf(" "); - idx++; - byte_in_word = 0; - } - idx+=2; - } - - for (;idx < nchars; idx++) - printf(" "); - - printf("\t%s\n", string ? string : ""); - on_page++; - listing_page(list); - if (list->message) - { - printf("**** %s\n",list->message); - listing_page(list); + printf ("% 4d ", list->line); + for (idx = 0; idx < nchars; idx++) + printf (" "); + + printf ("\t%s\n", string ? string : ""); on_page++; + listing_page (0); + } + else + { + if (had_errors ()) + { + printf ("% 4d ???? ", list->line); + } + else + { + printf ("% 4d %04x ", list->line, address); + } - for (lines = 0; - lines < LISTING_LHS_CONT_LINES - && *src; - lines++) { - nchars = ((LISTING_WORD_SIZE*2) +1) * LISTING_LHS_WIDTH_SECOND -1; - idx = 0; - /* Print any more lines of data, but more compactly */ - printf("% 4d ", list->line); - - while (*src && idx < nchars) + /* And the data to go along with it */ + idx = 0; + + while (*src && idx < nchars) { - printf("%c%c", src[0], src[1]); - src+=2; - idx+=2; + printf ("%c%c", src[0], src[1]); + src += 2; byte_in_word++; - if (byte_in_word == LISTING_WORD_SIZE) - { - printf(" "); - idx++; - byte_in_word = 0; - } + if (byte_in_word == LISTING_WORD_SIZE) + { + printf (" "); + idx++; + byte_in_word = 0; + } + idx += 2; } - - printf("\n"); - on_page++; - listing_page(list); - - } - - } -} + for (; idx < nchars; idx++) + printf (" "); + + printf ("\t%s\n", string ? string : ""); + on_page++; + listing_page (list); + if (list->message) + { + printf ("**** %s\n", list->message); + listing_page (list); + on_page++; + } - - - + for (lines = 0; + lines < LISTING_LHS_CONT_LINES + && *src; + lines++) + { + nchars = ((LISTING_WORD_SIZE * 2) + 1) * LISTING_LHS_WIDTH_SECOND - 1; + idx = 0; + /* Print any more lines of data, but more compactly */ + printf ("% 4d ", list->line); + + while (*src && idx < nchars) + { + printf ("%c%c", src[0], src[1]); + src += 2; + idx += 2; + byte_in_word++; + if (byte_in_word == LISTING_WORD_SIZE) + { + printf (" "); + idx++; + byte_in_word = 0; + } + } + + printf ("\n"); + on_page++; + listing_page (list); + + } + + + } +} static void -DEFUN_VOID(list_symbol_table) +list_symbol_table () { extern symbolS *symbol_rootP; - - symbolS *ptr ; + + symbolS *ptr; eject = 1; - listing_page(0); - printf("DEFINED SYMBOLS\n"); + listing_page (0); + printf ("DEFINED SYMBOLS\n"); on_page++; - - for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) - { - if (ptr->sy_frag->line) + + for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { - if (S_GET_NAME(ptr)) - { - - if (strlen(S_GET_NAME(ptr))) - { - printf("%20s:%-5d %2d:%08x %s \n", - ptr->sy_frag->line->file->filename, - ptr->sy_frag->line->line, - S_GET_SEGMENT(ptr), - S_GET_VALUE(ptr), - S_GET_NAME(ptr)); - } - - else - { - printf("%20s:%-5d %2d:%08x\n", - ptr->sy_frag->line->file->filename, - ptr->sy_frag->line->line, - S_GET_SEGMENT(ptr), - S_GET_VALUE(ptr)); - + if (ptr->sy_frag->line) + { + if (S_GET_NAME (ptr)) + { + char buf[30]; + valueT val = S_GET_VALUE (ptr); + + /* @@ Note that this is dependent on the compilation options, + not solely on the target characteristics. */ + if (sizeof (val) == 4 && sizeof (int) == 4) + sprintf (buf, "%08lx", (unsigned long) val); +#if defined (BFD_ASSEMBLER) && defined (BFD64) + else if (sizeof (val) > 4) + { + char buf1[30]; + sprintf_vma (buf1, val); + strcpy (buf, "00000000"); + strcpy (buf + 8 - strlen (buf1), buf1); + } +#endif + else + abort (); + + printf ("%20s:%-5d %s:%s %s\n", + ptr->sy_frag->line->file->filename, + ptr->sy_frag->line->line, + segment_name (S_GET_SEGMENT (ptr)), + buf, S_GET_NAME (ptr)); + + on_page++; + listing_page (0); + } + } - } - - on_page++; - listing_page(0); - } } - - } - printf("\n"); + printf ("\n"); on_page++; - listing_page(0); - printf("UNDEFINED SYMBOLS\n"); + listing_page (0); + printf ("UNDEFINED SYMBOLS\n"); on_page++; - listing_page(0); - - for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) - { - if (S_GET_NAME(ptr) && strlen(S_GET_NAME(ptr)) != 0) + listing_page (0); + + for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { - if (ptr->sy_frag->line == 0) - { - printf("%s\n", S_GET_NAME(ptr)); - on_page++; - listing_page(0); - } + if (S_GET_NAME (ptr) && strlen (S_GET_NAME (ptr)) != 0) + { + if (ptr->sy_frag->line == 0) + { + printf ("%s\n", S_GET_NAME (ptr)); + on_page++; + listing_page (0); + } + } } - } } -void -DEFUN(print_source,(current_file, list, buffer, width), - file_info_type *current_file AND - list_info_type *list AND - char *buffer AND - unsigned int width) +static void +print_source (current_file, list, buffer, width) + file_info_type *current_file; + list_info_type *list; + char *buffer; + unsigned int width; { - if (current_file->file) { + if (current_file->file) + { while (current_file->linenum < list->hll_line) - { - char * p = buffer_line(current_file, buffer, width); - printf("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p); - on_page++; - listing_page(list); - } + { + char *p = buffer_line (current_file, buffer, width); + printf ("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p); + on_page++; + listing_page (list); + } } } /* Sometimes the user doesn't want to be bothered by the debugging - records inserted by the compiler, see if the line is suspicioous */ + records inserted by the compiler, see if the line is suspicious */ static int -DEFUN(debugging_pseudo,(line), - char *line) +debugging_pseudo (line) + char *line; { - while (isspace(*line)) - line++; + while (isspace (*line)) + line++; + + if (*line != '.') + return 0; - if(*line != '.') return 0; - line++; - if (strncmp(line, "def",3) == 0) return 1; - if (strncmp(line, "val",3) == 0) return 1; - if (strncmp(line, "scl",3) == 0) return 1; - if (strncmp(line, "line",4) == 0) return 1; - if (strncmp(line, "endef",5) == 0) return 1; - if (strncmp(line, "ln",2) ==0) return 1; - if (strncmp(line, "type",4) ==0) return 1; - if (strncmp(line, "size",4) == 0) return 1; - if (strncmp(line, "dim",3) ==0) return 1; - if (strncmp(line, "tag",3) == 0) return 1; - + if (strncmp (line, "def", 3) == 0) + return 1; + if (strncmp (line, "val", 3) == 0) + return 1; + if (strncmp (line, "scl", 3) == 0) + return 1; + if (strncmp (line, "line", 4) == 0) + return 1; + if (strncmp (line, "endef", 5) == 0) + return 1; + if (strncmp (line, "ln", 2) == 0) + return 1; + if (strncmp (line, "type", 4) == 0) + return 1; + if (strncmp (line, "size", 4) == 0) + return 1; + if (strncmp (line, "dim", 3) == 0) + return 1; + if (strncmp (line, "tag", 3) == 0) + return 1; + + if (strncmp (line, "stabs", 5) == 0) + return 1; + if (strncmp (line, "stabn", 5) == 0) + return 1; + return 0; } -void -DEFUN(listing_listing,(name), - char *name) +static void +listing_listing (name) + char *name; { list_info_type *list = head; - file_info_type *current_hll_file = (file_info_type *)NULL; - - unsigned int page= 1; - unsigned int prev = 0; + file_info_type *current_hll_file = (file_info_type *) NULL; char *message; char *buffer; char *p; - unsigned int addr = 0; - int on_page = 0; int show_listing = 1; unsigned int width; - - buffer = malloc(LISTING_RHS_WIDTH); + + buffer = xmalloc (LISTING_RHS_WIDTH); eject = 1; list = head; - while (list != (list_info_type *)NULL && 0) - { - if (list->next) - list->frag = list->next->frag; - list = list->next; + while (list != (list_info_type *) NULL && 0) + { + if (list->next) + list->frag = list->next->frag; + list = list->next; + + } - } - list = head->next; - while ( list) - { - width = LISTING_RHS_WIDTH > paper_width ? paper_width : - LISTING_RHS_WIDTH; - - switch (list->edict) { - case EDICT_LIST: - show_listing++; - break; - case EDICT_NOLIST: - show_listing--; - break; - case EDICT_EJECT: - break; - case EDICT_NONE: - break; - case EDICT_TITLE: - title = list->edict_arg; - break; - case EDICT_SBTTL: - subtitle = list->edict_arg; - break; - default: - abort(); - } - - if (show_listing > 0) + while (list) { - /* Scan down the list and print all the stuff which can be done - with this line (or lines) */ - message = 0; + width = LISTING_RHS_WIDTH > paper_width ? paper_width : + LISTING_RHS_WIDTH; - if (list->hll_file) - { - current_hll_file = list->hll_file; - } + switch (list->edict) + { + case EDICT_LIST: + show_listing++; + break; + case EDICT_NOLIST: + show_listing--; + break; + case EDICT_EJECT: + break; + case EDICT_NONE: + break; + case EDICT_TITLE: + title = list->edict_arg; + break; + case EDICT_SBTTL: + subtitle = list->edict_arg; + break; + default: + abort (); + } - if (current_hll_file && list->hll_line && listing & LISTING_HLL) - { - print_source(current_hll_file, list, buffer, width); - } - - p = buffer_line(list->file, buffer, width); + if (show_listing > 0) + { + /* Scan down the list and print all the stuff which can be done + with this line (or lines). */ + message = 0; + + if (list->hll_file) + { + current_hll_file = list->hll_file; + } + + if (current_hll_file && list->hll_line && listing & LISTING_HLL) + { + print_source (current_hll_file, list, buffer, width); + } + + p = buffer_line (list->file, buffer, width); + + if (!((listing & LISTING_NODEBUG) && debugging_pseudo (p))) + { + print_lines (list, p, calc_hex (list)); + } + + if (list->edict == EDICT_EJECT) + { + eject = 1; + } + } + else + { - if (! ((listing & LISTING_NODEBUG) && debugging_pseudo(p))) - { - print_lines(list, p, calc_hex(list)); - } + p = buffer_line (list->file, buffer, width); + } - if (list->edict == EDICT_EJECT) - { - eject = 1; - } - } - else - { - - p = buffer_line(list->file, buffer, width); + list = list->next; } - - list = list->next; - } - free(buffer); + free (buffer); } -void -DEFUN(listing_print,(name), - char *name) +void +listing_print (name) + char *name; { title = ""; - subtitle = ""; - - if (listing & LISTING_NOFORM) - { - paper_height = 0; - } - - if (listing & LISTING_LISTING) - { - listing_listing(name); - - } - if (listing & LISTING_SYMBOLS) - { - list_symbol_table(); - } -} + subtitle = ""; + + if (listing & LISTING_NOFORM) + { + paper_height = 0; + } + + if (listing & LISTING_LISTING) + { + listing_listing (name); + + } + if (listing & LISTING_SYMBOLS) + { + list_symbol_table (); + } +} void -DEFUN(listing_file,(name), -char *name) +listing_file (name) + const char *name; { - fn = name; + fn = name; } -void -DEFUN_VOID(listing_eject) +void +listing_eject () { - listing_tail->edict = EDICT_EJECT; + listing_tail->edict = EDICT_EJECT; } void -DEFUN_VOID(listing_flags) +listing_flags () { - while ( (*input_line_pointer++) && (*input_line_pointer != '\n') ) - input_line_pointer++; - + while ((*input_line_pointer++) && (*input_line_pointer != '\n')) + input_line_pointer++; + } + void -DEFUN(listing_list,(on), - unsigned int on) +listing_list (on) + unsigned int on; { listing_tail->edict = on ? EDICT_LIST : EDICT_NOLIST; } void -DEFUN_VOID(listing_psize) +listing_psize () { - paper_height = get_absolute_expression(); + paper_height = get_absolute_expression (); - if (paper_height < 0 || paper_height > 1000) - { - paper_height = 0; - as_warn("strange paper height, set to no form"); - } - if (*input_line_pointer == ',') - { - input_line_pointer++; - paper_width = get_absolute_expression(); - } + if (paper_height < 0 || paper_height > 1000) + { + paper_height = 0; + as_warn ("strange paper height, set to no form"); + } + if (*input_line_pointer == ',') + { + input_line_pointer++; + paper_width = get_absolute_expression (); + } } void -DEFUN(listing_title,(depth), - unsigned int depth) +listing_title (depth) + unsigned int depth; { char *start; char *title; unsigned int length; - - SKIP_WHITESPACE(); - if (*input_line_pointer=='\"') { + + SKIP_WHITESPACE (); + if (*input_line_pointer == '\"') + { input_line_pointer++; start = input_line_pointer; - - while (*input_line_pointer) - { - if (*input_line_pointer == '\"') - { - length = input_line_pointer - start; - title = malloc(length + 1); - memcpy(title, start, length); - title[length] = 0; - listing_tail->edict = depth ? EDICT_SBTTL : EDICT_TITLE; - listing_tail->edict_arg = title; - input_line_pointer++; - demand_empty_rest_of_line(); - return; - } - else if (*input_line_pointer == '\n') - { - as_bad("New line in title"); - demand_empty_rest_of_line(); - return; - } - else + + while (*input_line_pointer) { - input_line_pointer++; + if (*input_line_pointer == '\"') + { + length = input_line_pointer - start; + title = xmalloc (length + 1); + memcpy (title, start, length); + title[length] = 0; + listing_tail->edict = depth ? EDICT_SBTTL : EDICT_TITLE; + listing_tail->edict_arg = title; + input_line_pointer++; + demand_empty_rest_of_line (); + return; + } + else if (*input_line_pointer == '\n') + { + as_bad ("New line in title"); + demand_empty_rest_of_line (); + return; + } + else + { + input_line_pointer++; + } } - } } - else - { - as_bad("expecting title in quotes"); - } + else + { + as_bad ("expecting title in quotes"); + } } void -DEFUN(listing_source_line,(line), - unsigned int line) +listing_source_line (line) + unsigned int line; { - new_frag(); + new_frag (); listing_tail->hll_line = line; - new_frag(); - + new_frag (); + } void -DEFUN(listing_source_file,(file), - char *file) +listing_source_file (file) + const char *file; { - listing_tail->hll_file = file_info(file); + listing_tail->hll_file = file_info (file); } - + #else /* Dummy functions for when compiled without listing enabled */ -void -DEFUN_VOID(listing_flags) +void +listing_flags () { - s_ignore(); + s_ignore (0); } -void DEFUN_VOID(listing_list) +void +listing_list (on) + unsigned int on; { - s_ignore(); + s_ignore (0); } -void DEFUN_VOID(listing_eject) +void +listing_eject () { - s_ignore(); + s_ignore (0); } -void DEFUN_VOID(listing_psize) + +void +listing_psize () { - s_ignore(); + s_ignore (0); } -void DEFUN(listing_title, (depth), -unsigned int depth) +void +listing_title (depth) + unsigned int depth; { - s_ignore(); + s_ignore (0); } + void -DEFUN(listing_file,(name), -char *name) +listing_file (name) + const char *name; { } -void DEFUN(listing_newline,(name), -char *name) +void +listing_newline (name) + char *name; { - + } -void DEFUN(listing_source_line,(n), -unsigned int n) +void +listing_source_line (n) + unsigned int n; { - + } -void DEFUN(listing_source_file, (n), -char *n) +void +listing_source_file (n) + const char *n; { - -} - +} #endif - @@ -159,7 +159,6 @@ int new_broken_words; static char *demand_copy_string PARAMS ((int *lenP)); 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_known_segmented_expression PARAMS ((expressionS * expP)); static void grow_bignum PARAMS ((void)); @@ -187,7 +186,7 @@ read_begin () /* Use machine dependent syntax */ 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. */ } @@ -329,13 +328,13 @@ pobegin () return; } /* pobegin() */ -#define HANDLE_CONDITIONAL_ASSEMBLY() \ - if (ignore_input ()) \ - { \ - while (! is_end_of_line[*input_line_pointer++]) \ - if (input_line_pointer == buffer_limit) \ - break; \ - continue; \ +#define HANDLE_CONDITIONAL_ASSEMBLY() \ + if (ignore_input ()) \ + { \ + while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \ + if (input_line_pointer == buffer_limit) \ + break; \ + continue; \ } @@ -520,7 +519,7 @@ read_a_source_file (name) /* WARNING: c has char, which may be end-of-line. */ /* Also: input_line_pointer->`\0` where c was. */ *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 || TC_EOL_IN_INSN (input_line_pointer) #endif @@ -544,7 +543,7 @@ read_a_source_file (name) } /* if (is_name_beginner(c) */ - if (is_end_of_line[c]) + if (is_end_of_line[(unsigned char) c]) { continue; } /* empty statement */ @@ -726,7 +725,7 @@ s_align_bytes (arg) unsigned int i = 0; 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 */ else temp = get_absolute_expression (); @@ -808,7 +807,7 @@ s_comm () register char *name; register char c; register char *p; - valueT temp; + offsetT temp; register symbolS *symbolP; name = input_line_pointer; @@ -826,7 +825,7 @@ s_comm () input_line_pointer++; /* skip ',' */ 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 (); return; } @@ -841,15 +840,15 @@ s_comm () } if (S_GET_VALUE (symbolP)) { - if (S_GET_VALUE (symbolP) != temp) - as_bad ("Length of .comm \"%s\" is already %d. Not changed to %d.", + if (S_GET_VALUE (symbolP) != (valueT) temp) + as_bad ("Length of .comm \"%s\" is already %ld. Not changed to %ld.", S_GET_NAME (symbolP), - S_GET_VALUE (symbolP), - temp); + (long) S_GET_VALUE (symbolP), + (long) temp); } else { - S_SET_VALUE (symbolP, temp); + S_SET_VALUE (symbolP, (valueT) temp); S_SET_EXTERNAL (symbolP); } #ifdef OBJ_VMS @@ -1410,7 +1409,7 @@ void demand_empty_rest_of_line () { SKIP_WHITESPACE (); - if (is_end_of_line[*input_line_pointer]) + if (is_end_of_line[(unsigned char) *input_line_pointer]) { input_line_pointer++; } @@ -1424,7 +1423,7 @@ demand_empty_rest_of_line () void 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)) 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.", *input_line_pointer); 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++; /* 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; if ((get & mask) != 0 && (get & mask) != mask) { /* 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. */ } @@ -2047,12 +2046,14 @@ big_cons (nbytes) * mysterious zero constants: which is what they get when * they completely omit digits. */ - if (hex_value[c] >= radix) + if (hex_value[(unsigned char) c] >= radix) { as_bad ("Missing digits. 0 assumed."); } 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. */ carry = digit; @@ -2428,7 +2429,7 @@ get_known_segmented_expression (expP) return (retval); } /* 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 () { expressionS exp; @@ -2447,7 +2448,8 @@ char /* return terminator */ get_absolute_expression_and_terminator (val_pointer) 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++); } @@ -2536,7 +2538,7 @@ int is_it_end_of_statement () { 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() */ void @@ -2643,7 +2645,7 @@ void s_ignore (arg) int arg; { - while (!is_end_of_line[*input_line_pointer]) + while (!is_end_of_line[(unsigned char) *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. */ +#ifdef SEPARATE_STAB_SECTIONS + static unsigned int get_stab_string_offset (string, secname) char *string, *secname; @@ -2777,6 +2781,8 @@ get_stab_string_offset (string, secname) return old_gdb_string_index; } +#endif /* SEPARATE_STAB_SECTIONS */ + /* This can handle different kinds of stabs (s,n,d) and different kinds of stab sections. */ @@ -2792,15 +2798,15 @@ s_stab_generic (what, secname) int saved_type = 0; int length; int goof = 0; - int seg_is_new = 0; long longint; segT saved_seg = now_seg; segT seg; subsegT saved_subseg = now_subseg; subsegT subseg; - int offset; int valu; - char *toP; +#ifdef SEPARATE_STAB_SECTIONS + int seg_is_new = 0; +#endif valu = ((char *) obstack_next_free (&frags)) - frag_now->fr_literal; @@ -2947,13 +2953,17 @@ s_stab_generic (what, secname) #endif #ifdef SEPARATE_STAB_SECTIONS - change_to_section(secname, strlen(secname), 0); - toP = frag_more (8); - /* the string index portion of the stab */ - 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); + { + char *toP; + + change_to_section(secname, strlen(secname), 0); + toP = frag_more (8); + /* the string index portion of the stab */ + 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 #ifdef SEPARATE_STAB_SECTIONS @@ -36,8 +36,10 @@ extern char *input_line_pointer;/* -> char we are parsing now. */ #define LEX_NAME (1) /* may continue a name */ #define LEX_BEGIN_NAME (2) /* may begin a name */ -#define is_name_beginner(c) ( lex_type[c] & LEX_BEGIN_NAME ) -#define is_part_of_name(c) ( lex_type[c] & LEX_NAME ) +#define is_name_beginner(c) \ + ( 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 #define CHAR_MASK (0xff) @@ -55,7 +57,8 @@ extern const char line_separator_chars[]; char *demand_copy_C_string PARAMS ((int *len_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 big_cons PARAMS ((int nbytes)); void cons PARAMS ((unsigned int nbytes)); diff --git a/gas/symbols.c b/gas/symbols.c index c66f48b..0a57994 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -17,7 +17,7 @@ along with GAS; see the file COPYING. If not, write to 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> @@ -281,10 +281,10 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */ S_GET_OTHER (symbolP), S_GET_DESC (symbolP), (long) S_GET_VALUE (symbolP)); #else - as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%d.", + as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%ld.", sym_name, segment_name (S_GET_SEGMENT (symbolP)), - S_GET_VALUE (symbolP)); + (long) S_GET_VALUE (symbolP)); #endif } } /* if the undefined symbol has no value */ diff --git a/gas/write.c b/gas/write.c index 2e7ae83..913146e 100644 --- a/gas/write.c +++ b/gas/write.c @@ -318,21 +318,18 @@ remove_subsegs (head, seg, root, last) #endif /* BFD */ -static void -cvt_frag_to_fill (x, fragP) #ifdef BFD_ASSEMBLER - segT x; -#else - object_headers *x; -#endif +static void +cvt_frag_to_fill (sec, fragP) + segT sec; fragS *fragP; -{ -#ifdef BFD_ASSEMBLER - segT sec = x; #else - object_headers *headers = x; +static void +cvt_frag_to_fill (headers, fragP) + object_headers *headers; + fragS *fragP; #endif - +{ switch (fragP->fr_type) { case rs_align: @@ -560,8 +557,6 @@ write_relocs (abfd, sec, xxx) char *xxx; { segment_info_type *seginfo = seg_info (sec); - unsigned long offset = 0; - fragS *frags; int i, n; arelent **relocs; fixS *fixp; @@ -703,9 +698,6 @@ write_contents (abfd, sec, xxx) segment_info_type *seginfo = seg_info (sec); unsigned long offset = 0; fragS *frags; - int i, n; - arelent **relocs; - fixS *fixp; /* Write out the frags. */ if (! (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) @@ -875,7 +867,9 @@ void write_object_file () { register struct frchain *frchainP; /* Track along all frchains. */ +#if ! defined (BFD_ASSEMBLER) || ! defined (WORKING_DOT_WORD) register fragS *fragP; /* Track along all frags. */ +#endif #if !defined (BFD_ASSEMBLER) && !defined (OBJ_VMS) long object_file_size; #endif @@ -1270,8 +1264,6 @@ write_object_file () for (symp = symbol_rootP; symp; symp = symbol_next (symp)) { - int keep = 0; - if (! symp->sy_resolved) { if (symp->sy_value.X_op == O_constant) @@ -1299,16 +1291,21 @@ write_object_file () segment_name (symp->bsym->section)); #endif { - int punt = 0; #ifdef obj_frob_symbol - obj_frob_symbol (symp, punt); - if (punt) - goto punt_it; + { + int punt = 0; + obj_frob_symbol (symp, punt); + if (punt) + goto punt_it; + } #endif #ifdef tc_frob_symbol - tc_frob_symbol (symp, punt); - if (punt) - goto punt_it; + { + int punt = 0; + tc_frob_symbol (symp, punt); + if (punt) + goto punt_it; + } #endif } /* 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)) { symbolS *prev, *next; +#if defined (obj_frob_symbol) || defined (tc_frob_symbol) punt_it: +#endif prev = symbol_previous (symp); next = symbol_next (symp); #ifdef DEBUG_SYMS @@ -1952,8 +1951,8 @@ fixup_segment (fixP, this_segment_type) { char buf[50]; sprint_value (buf, fragP->fr_address + where); - as_bad ("Value of %d too large for field of %d bytes at %s", - add_number, size, buf); + as_bad ("Value of %ld too large for field of %d bytes at %s", + (long) add_number, size, buf); } /* generic error checking */ #ifdef WARN_SIGNED_OVERFLOW_WORD /* Warn if a .word value is too large when treated as a signed |