diff options
author | Ian Lance Taylor <ian@airs.com> | 1992-12-13 00:56:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1992-12-13 00:56:14 +0000 |
commit | 016e0d420770f2914796927601d536deb31d537a (patch) | |
tree | 57506cbc5d3317ff7f84d56a96cf8321a4ed0a63 /gas/read.c | |
parent | b09b3dabfd0abea97463ebffb36726747377dce1 (diff) | |
download | gdb-016e0d420770f2914796927601d536deb31d537a.zip gdb-016e0d420770f2914796927601d536deb31d537a.tar.gz gdb-016e0d420770f2914796927601d536deb31d537a.tar.bz2 |
Sat Dec 12 15:26:34 1992 Ian Lance Taylor (ian@cygnus.com)
* listing.c: Call xmalloc, not malloc; don't declare malloc.
* Changes to support SCO 3.2v4:
* read.c (s_align_bytes, s_align_ptwo): If not SEG_DATA or
SEG_BSS, fill with NOP_OPCODE.
* config/i386coff.mt: Add opcode/i386.h to TARG_CPU_DEPENDENTS.
* config/obj-coffbfd.c (do_relocs_for): Increment addr even if not
using ZERO_BASED_SEGMENTS.
(fill_section): If ZERO_BASED_SEGMENTS, set segment addresses, but
never set segment address for SEG_E2 (.bss) and don't write out
SEG_E2 contents. Set .init and .fini sections to STYP_TEXT.
(obj_coff_endef): Don't merge labels or symbols awaiting forward
definitions, and don't merge tags with non-tags. Check for .bf
rather than just checking whether the second character is b and
the third character is f.
(obj_coff_val): gcc can generate values which we don't handle
correctly; discard information for now, since it only affects the
debugging information.
(tag_find_or_name): Don't insert tags in the symbol table.
(yank_symbols): Don't merge labels.
(write_object_file): Don't define SUB_SEGMENT_ALIGN if it is
already defined. Fill subsegments with NOP_OPCODE, not 0. Don't
set segment address if ZERO_BASED_SEGMENTS.
(obj_coff_section): Accept and ignore a trailing quoted string, as
used in AT&T i386 syntax.
(fixup_segment): Take segment as argument. On the i386, adjust PC
relative addends by the segment vaddr.
* tc-i386.h: Define SUB_SEGMENT_ALIGN.
* tc-a29k.h: Define ZERO_BASED_SEGMENTS.
* tc-i386.c: (i386_operand): If I386COFF, accept any segment type.
Diffstat (limited to 'gas/read.c')
-rw-r--r-- | gas/read.c | 183 |
1 files changed, 91 insertions, 92 deletions
@@ -17,11 +17,15 @@ You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +#if 0 #define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will change this a bit. But then, GNU isn't spozed to run on your machine anyway. (RMS is so shortsighted sometimes.) */ +#else +#define MASK_CHAR ((int)(unsigned char)-1) +#endif #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16) /* This is the largest known floating point */ @@ -29,8 +33,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* do 4361 style flonums. */ -/* Routines that read assembler source text to build spagetti in memory. */ -/* Another group of these functions is in the as-expr.c module */ +/* Routines that read assembler source text to build spagetti in memory. + Another group of these functions is in the expr.c module. */ #include <ctype.h> @@ -38,8 +42,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "obstack.h" #include "listing.h" -char *input_line_pointer; /*->next char of source file to parse. */ +/* The NOP_OPCODE is for the alignment fill value. + * fill it a nop instruction so that the disassembler does not choke + * on it + */ +#ifndef NOP_OPCODE +#define NOP_OPCODE 0x00 +#endif + +char *input_line_pointer; /*->next char of source file to parse. */ #if BITS_PER_CHAR != 8 /* The following table is indexed by[(char)] and will break if @@ -47,109 +59,96 @@ char *input_line_pointer; /*->next char of source file to parse. */ die horribly; #endif - const char /* used by is_... macros. our ctype[] */ - lex_type[256] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */ - 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */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3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, /* PQRSTUVWXYZ[\]^_ */ + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, /* pqrstuvwxyz{|}~. */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + + +/* * In: a character. * Out: 1 if this character ends a line. */ #define _ (0) - char is_end_of_line[256] = - { +char is_end_of_line[256] = +{ #ifdef CR_EOL - _, _, _, _, _, _, _, _, _, _, 99, _, _, 99, _, _, /* @abcdefghijklmno */ + _, _, _, _, _, _, _, _, _, _, 99, _, _, 99, _, _, /* @abcdefghijklmno */ #else - _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, _, /* @abcdefghijklmno */ + _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, _, /* @abcdefghijklmno */ #endif - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, /* 0123456789:;<=>? */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ /* */ - }; + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, /* 0123456789:;<=>? */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */ +}; #undef _ - /* Functions private to this file. */ +/* Functions private to this file. */ + +static char *buffer; /* 1st char of each buffer of lines is here. */ +static char *buffer_limit; /*->1 + last char in buffer. */ - static char *buffer; /* 1st char of each buffer of lines is here. */ - static char *buffer_limit; /*->1 + last char in buffer. */ +static char *bignum_low; /* Lowest char of bignum. */ +static char *bignum_limit; /* 1st illegal address of bignum. */ +static char *bignum_high; /* Highest char of bignum. */ +/* May point to (bignum_start-1). */ +/* Never >= bignum_limit. */ - static char *bignum_low; /* Lowest char of bignum. */ - static char *bignum_limit; /* 1st illegal address of bignum. */ - static char *bignum_high; /* Highest char of bignum. */ - /* May point to (bignum_start-1). */ - /* Never >= bignum_limit. */ - static char *old_buffer = 0; /* JF a hack */ - static char *old_input; - static char *old_limit; +static char *old_buffer = 0; /* JF a hack */ +static char *old_input; +static char *old_limit; - /* Variables for handling include file directory list. */ +/* Variables for handling include file directory list. */ - char **include_dirs; /* List of pointers to directories to - search for .include's */ - int include_dir_count; /* How many are in the list */ - int include_dir_maxlen = 1;/* Length of longest in list */ +char **include_dirs; /* List of pointers to directories to + search for .include's */ +int include_dir_count; /* How many are in the list */ +int include_dir_maxlen = 1;/* Length of longest in list */ #ifndef WORKING_DOT_WORD - struct broken_word *broken_words; - int new_broken_words = 0; +struct broken_word *broken_words; +int new_broken_words = 0; #endif -#ifdef __STDC__ - - static char *demand_copy_string (int *lenP); - int is_it_end_of_statement (void); - unsigned int next_char_of_string (void); - static segT get_known_segmented_expression (expressionS * expP); - static void grow_bignum (void); - static void pobegin (void); - void stringer (int append_zero); - -#else /* __STDC__ */ - - static char *demand_copy_string (); - int is_it_end_of_statement (); - unsigned int next_char_of_string (); - static segT get_known_segmented_expression (); - static void grow_bignum (); - static void pobegin (); - void stringer (); - -#endif /* __STDC__ */ +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_known_segmented_expression PARAMS ((expressionS * expP)); +static void grow_bignum PARAMS ((void)); +static void pobegin PARAMS ((void)); +void stringer PARAMS ((int append_zero)); - extern int listing; +extern int listing; - void - read_begin () +void +read_begin () { - char *p; + const char *p; pobegin (); obj_read_begin_hook (); @@ -169,16 +168,14 @@ die horribly; /* set up pseudo-op tables */ -struct hash_control * - po_hash = NULL; /* use before set up: NULL->address error */ +struct hash_control *po_hash = NULL; /* use before set up: NULL->address error */ #ifdef DONTDEF void s_gdbline (), s_gdblinetab (); void s_gdbbeg (), s_gdbblock (), s_gdbend (), s_gdbsym (); #endif -static const pseudo_typeS - potable[] = +static const pseudo_typeS potable[] = { {"abort", s_abort, 0}, {"align", s_align_ptwo, 0}, @@ -722,10 +719,10 @@ s_align_bytes (arg) input_line_pointer++; temp_fill = get_absolute_expression (); } + else if (now_seg != SEG_DATA && now_seg != SEG_BSS) + temp_fill = NOP_OPCODE; else - { - temp_fill = 0; - } + temp_fill = 0; /* Only make a frag if we HAVE to. . . */ if (temp && !need_pass_2) frag_align (temp, (int) temp_fill); @@ -754,6 +751,8 @@ s_align_ptwo () input_line_pointer++; temp_fill = get_absolute_expression (); } + else if (now_seg != SEG_DATA && now_seg != SEG_BSS) + temp_fill = NOP_OPCODE; else temp_fill = 0; /* Only make a frag if we HAVE to. . . */ |