From e14994d9805ce899cdaeb010be7a7bc5887dbdaf Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 10 Aug 1995 16:19:34 +0000 Subject: [PATCH] * read.c (potable): Add spc, ttl, xcom, xref. (s_mri_sect): New function. * read.h (s_mri_sect): Declare. * config/obj-coff.c (obj_coff_section) (both versions): In MRI mode, call s_mri_sect. (obj_pseudo_table): Add sect.s and section.s. Move sect outside of ifndef BFD_ASSEMBLER. * config/obj-elf.c (elf_pseudo_table): Add section.s, sect, sect.s. (obj_elf_section): In MRI mode, call s_mri_sect. * config/tc-m68k.c (md_pseudo_table): Add restore, save. (struct save_opts): Define. (save_stack): New static variable. (s_save, s_restore): New static functions. --- gas/ChangeLog | 16 +++++++++ gas/config/tc-m68k.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++ gas/read.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+) diff --git a/gas/ChangeLog b/gas/ChangeLog index 0db30c7..2ed0a61 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,8 +1,24 @@ Thu Aug 10 00:38:11 1995 Ian Lance Taylor + * read.c (potable): Add spc, ttl, xcom, xref. + (s_mri_sect): New function. + * read.h (s_mri_sect): Declare. + * config/obj-coff.c (obj_coff_section) (both versions): In MRI + mode, call s_mri_sect. + (obj_pseudo_table): Add sect.s and section.s. Move sect outside + of ifndef BFD_ASSEMBLER. + * config/obj-elf.c (elf_pseudo_table): Add section.s, sect, + sect.s. + (obj_elf_section): In MRI mode, call s_mri_sect. + * config/tc-m68k.c (md_pseudo_table): Add restore, save. + (struct save_opts): Define. + (save_stack): New static variable. + (s_save, s_restore): New static functions. + * read.c (s_set): Remove unused local ptr. (hex_float): Check target_big_endian. (equals): Remove unused local p. + * config/tc-a29k.h (TARGET_BYTES_BIG_ENDIAN): Define. * config/tc-h8500.h (TARGET_BYTES_BIG_ENDIAN): Define. * config/tc-hppa.h (TARGET_BYTES_BIG_ENDIAN): Define. diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 3832755..55137c5 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -295,6 +295,8 @@ static void s_chip PARAMS ((int)); static void s_fopt PARAMS ((int)); static void s_opt PARAMS ((int)); static void s_reg PARAMS ((int)); +static void s_restore PARAMS ((int)); +static void s_save PARAMS ((int)); static int current_architecture; @@ -427,6 +429,8 @@ CONST pseudo_typeS md_pseudo_table[] = {"mask2", s_ignore, 0}, {"opt", s_opt, 0}, {"reg", s_reg, 0}, + {"restore", s_restore, 0}, + {"save", s_save, 0}, {0, 0, 0} }; @@ -4432,6 +4436,85 @@ s_reg (ignore) demand_empty_rest_of_line (); } + +/* This structure is used for the MRI SAVE and RESTORE pseudo-ops. */ + +struct save_opts +{ + struct save_opts *next; + int abspcadd; + int symbols_case_sensitive; + int keep_locals; + int short_refs; + int architecture; + int quick; + int rel32; + int listing; + int no_warnings; + /* FIXME: We don't save OPT S. */ +}; + +/* This variable holds the stack of saved options. */ + +static struct save_opts *save_stack; + +/* The MRI SAVE pseudo-op. */ + +static void +s_save (ignore) + int ignore; +{ + struct save_opts *s; + + s = (struct save_opts *) xmalloc (sizeof (struct save_opts)); + s->abspcadd = m68k_abspcadd; + s->symbols_case_sensitive = symbols_case_sensitive; + s->keep_locals = flag_keep_locals; + s->short_refs = flag_short_refs; + s->architecture = current_architecture; + s->quick = m68k_quick; + s->rel32 = m68k_rel32; + s->listing = listing; + s->no_warnings = flag_no_warnings; + + s->next = save_stack; + save_stack = s; + + demand_empty_rest_of_line (); +} + +/* The MRI RESTORE pseudo-op. */ + +static void +s_restore (ignore) + int ignore; +{ + struct save_opts *s; + + if (save_stack == NULL) + { + as_bad ("restore without save"); + ignore_rest_of_line (); + return; + } + + s = save_stack; + save_stack = s->next; + + m68k_abspcadd = s->abspcadd; + symbols_case_sensitive = s->symbols_case_sensitive; + flag_keep_locals = s->keep_locals; + flag_short_refs = s->short_refs; + current_architecture = s->architecture; + m68k_quick = s->quick; + m68k_rel32 = s->rel32; + listing = s->listing; + flag_no_warnings = s->no_warnings; + + free (s); + + demand_empty_rest_of_line (); +} /* * md_parse_option diff --git a/gas/read.c b/gas/read.c index e1f1a07..4ae32ec 100644 --- a/gas/read.c +++ b/gas/read.c @@ -327,6 +327,7 @@ static const pseudo_typeS potable[] = {"single", float_cons, 'f'}, /* size */ {"space", s_space, 0}, + {"spc", s_ignore, 0}, {"stabd", s_stab, 'd'}, {"stabn", s_stab, 'n'}, {"stabs", s_stab, 's'}, @@ -346,10 +347,13 @@ static const pseudo_typeS potable[] = {"this_gcc_requires_the_gnu_assembler", s_ignore, 0}, {"title", listing_title, 0}, /* Listing title */ + {"ttl", listing_title, 0}, /* type */ /* use */ /* val */ + {"xcom", s_comm, 0}, {"xdef", s_globl, 0}, + {"xref", s_ignore, 0}, {"xstabs", s_xstab, 's'}, {"word", cons, 2}, {"zero", s_space, 0}, @@ -1643,6 +1647,94 @@ s_org (ignore) demand_empty_rest_of_line (); } /* s_org() */ +/* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be + called by the obj-format routine which handles section changing + when in MRI mode. It will create a new section, and return it. It + will set *TYPE to the section type: one of '\0' (unspecified), 'C' + (code), 'D' (data), 'M' (mixed), or 'R' (romable). If + BFD_ASSEMBLER is defined, the flags will be set in the section. */ + +void +s_mri_sect (type) + char *type; +{ + char *name; + char c; + segT seg; + + SKIP_WHITESPACE (); + + name = input_line_pointer; + if (! isdigit ((unsigned char) *name)) + c = get_symbol_end (); + else + { + do + { + ++input_line_pointer; + } + while (isdigit ((unsigned char) *input_line_pointer)); + c = *input_line_pointer; + *input_line_pointer = '\0'; + } + + name = strdup (name); + if (name == NULL) + as_fatal ("virtual memory exhausted"); + + *input_line_pointer = c; + + seg = subseg_new (name, 0); + + if (*input_line_pointer == ',') + { + int align; + + ++input_line_pointer; + align = get_absolute_expression (); + record_alignment (seg, align); + } + + *type = '\0'; + if (*input_line_pointer == ',') + { + c = *++input_line_pointer; + c = toupper ((unsigned char) c); + if (c == 'C' || c == 'D' || c == 'M' || c == 'R') + *type = c; + else + as_bad ("unrecognized section type"); + ++input_line_pointer; + +#ifdef BFD_ASSEMBLER + { + flagword flags; + + flags = SEC_NO_FLAGS; + if (type == 'C') + flags = SEC_CODE; + else if (type == 'D') + flags = SEC_DATA; + else if (type == 'R') + flags = SEC_ROM; + if (flags != SEC_NO_FLAGS) + { + if (! bfd_set_section_flags (stdoutput, seg, flags)) + as_warn ("error setting flags for \"%s\": %s", + bfd_section_name (stdoutput, sec), + bfd_errmsg (bfd_get_error ())); + } + } +#endif + } + + /* Ignore the HP type. */ + if (*input_line_pointer == ',') + input_line_pointer += 2; + + demand_empty_rest_of_line (); +} + void s_set (ignore) int ignore; -- 2.7.4