From def66e248c4dff4e2d5095a9a7739a06adf3fa78 Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Fri, 3 Jun 1994 20:59:20 +0000 Subject: [PATCH] * as.h: Replace flagseen with separate variables. * as.c (parse_args): Set them. Don't accept -1 option, or -v explicitly (it's a synonym for --version). * as.c, input-scrub.c, messages.c, read.c, symbols.c, write.c, config/obj-aout.c, config/obj-aout.h, config/obj-bout.c, config/obj-bout.h, config/obj-coff.c, config/obj-coff.h, config/obj-vms.c, config/tc-hppa.c, config/tc-i386.c, config/tc-i960.c, config/tc-m68k.c, config/tc-mips.c, config/tc-vax.c: Use the new flag variables instead of flagseen. * config/tc-vax.c [OBJ_VMS]: Recognize -+, -1, -v, and document in usage. --- gas/ChangeLog | 12 +++++ gas/as.c | 42 +++++++++++------- gas/as.h | 10 ++++- gas/config/obj-aout.c | 10 +++-- gas/config/obj-aout.h | 100 +++++++++++++++++++++++++----------------- gas/config/obj-bout.c | 4 +- gas/config/obj-bout.h | 2 +- gas/config/obj-coff.c | 6 +-- gas/config/obj-vms.c | 25 ++++++----- gas/config/tc-hppa.c | 4 +- gas/config/tc-mips.c | 2 +- gas/config/tc-vax.c | 33 ++++++++++++-- gas/read.c | 9 ++-- gas/write.c | 22 ++++++---- 14 files changed, 186 insertions(+), 95 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d5892755dc..3bb916b9f3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,17 @@ Fri Jun 3 12:50:13 1994 David J. MacKenzie (djm@rtl.cygnus.com) + * as.h: Replace flagseen with separate variables. + * as.c (parse_args): Set them. Don't accept -1 option, or -v + explicitly (it's a synonym for --version). + * as.c, input-scrub.c, messages.c, read.c, symbols.c, write.c, + config/obj-aout.c, config/obj-aout.h, config/obj-bout.c, + config/obj-bout.h, config/obj-coff.c, config/obj-coff.h, + config/obj-vms.c, config/tc-hppa.c, config/tc-i386.c, + config/tc-i960.c, config/tc-m68k.c, config/tc-mips.c, + config/tc-vax.c: Use the new flag variables instead of flagseen. + * config/tc-vax.c [OBJ_VMS]: Recognize -+, -1, -v, and document in + usage. + * as.c (show_usage): Remove target specific messages; instead, call md_show_usage. (parse_args): Use getopt_long_only. Take pointers to argc and diff --git a/gas/as.c b/gas/as.c index 323d3639cf..30915062b3 100644 --- a/gas/as.c +++ b/gas/as.c @@ -122,7 +122,6 @@ Options:\n\ -o OBJFILE name the object-file output OBJFILE (default a.out)\n\ -R fold data section into text section\n\ --statistics print maximum bytes and total seconds used\n\ --v print assembler version number\n\ --version print assembler version number and exit\n\ -W suppress warnings\n\ -w ignored\n\ @@ -133,9 +132,6 @@ Options:\n\ } /* - * Parse arguments, but we are only interested in flags. - * When we find a flag, we process it then make it's argv[] NULL. - * This helps any future argv[] scanners avoid what we processed. * Since it is easy to do here we interpret the special arg "-" * to mean "use stdin" and we set that argv[] pointing to "". * After we have munged argv[], the only things left are source file @@ -161,7 +157,9 @@ parse_args (pargc, pargv) char *shortopts; extern CONST char *md_shortopts; - CONST char *std_shortopts = "-1JKLRWZfa::DI:o:vwX"; + /* -v takes an argument on VMS, so we don't make it a generic option. + It gets recognized as an abbreviation of -version, anyway. */ + CONST char *std_shortopts = "-JKLRWZfa::DI:o:wX"; struct option *longopts; extern struct option md_longopts[]; @@ -240,15 +238,28 @@ parse_args (pargc, pargv) print_version_id (); exit (0); - case '1': case 'J': + flag_signed_overflow_ok = 1; + break; + case 'K': + flag_warn_displacement = 1; + break; + case 'L': + flag_keep_locals = 1; + break; + case 'R': + flag_readonly_data_in_text = 1; + break; + case 'W': + flag_no_warnings = 1; + break; + case 'Z': - case 'f': - flagseen[(unsigned char) optc] = 1; + flag_always_generate_output = 1; break; case 'a': @@ -288,6 +299,11 @@ parse_args (pargc, pargv) case 'D': /* DEBUG is implemented: it debugs different */ /* things to other people's assemblers. */ + flag_debug = 1; + break; + + case 'f': + flag_no_comments = 1; break; case 'I': @@ -305,10 +321,6 @@ parse_args (pargc, pargv) as_fatal ("virtual memory exhausted"); break; - case 'v': - print_version_id (); - break; - case 'w': break; @@ -345,7 +357,6 @@ main (argc, argv) #endif myname = argv[0]; - memset (flagseen, '\0', sizeof (flagseen)); /* aint seen nothing yet */ #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out" #endif @@ -371,14 +382,13 @@ main (argc, argv) tc_init_after_args (); #endif - /* Here with flags set up in flagseen[]. */ perform_an_assembly_pass (argc, argv); /* Assemble it. */ #ifdef TC_I960 brtab_emit (); #endif if (seen_at_least_1_file () - && !((had_warnings () && flagseen['Z']) + && !((had_warnings () && flag_always_generate_output) || had_errors () > 0)) keep_it = 1; else @@ -418,7 +428,7 @@ main (argc, argv) myname, (long) (lim - (char *) &environ)); } - if ((had_warnings () && flagseen['Z']) + if ((had_warnings () && flag_always_generate_output) || had_errors () > 0) return EXIT_FAILURE; return EXIT_SUCCESS; diff --git a/gas/as.h b/gas/as.h index 6103e615cd..c34de04830 100644 --- a/gas/as.h +++ b/gas/as.h @@ -341,8 +341,14 @@ COMMON fragS bss_address_frag; /* main program "as.c" (command arguments etc) */ -/* ['x'] TRUE if "-x" seen. */ -COMMON char flagseen[128]; +COMMON unsigned char flag_no_comments; /* -f */ +COMMON unsigned char flag_debug; /* -D */ +COMMON unsigned char flag_signed_overflow_ok; /* -J */ +COMMON unsigned char flag_warn_displacement; /* -K */ +COMMON unsigned char flag_keep_locals; /* -L */ +COMMON unsigned char flag_readonly_data_in_text; /* -R */ +COMMON unsigned char flag_no_warnings; /* -W */ +COMMON unsigned char flag_always_generate_output; /* -Z */ /* name of emitted object file */ COMMON char *out_file_name; diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 332a65f4b5..944d8e057a 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -116,6 +116,10 @@ obj_aout_frob_symbol (sym, punt) sym->bsym->section = sec = &bfd_und_section; if ((type & N_TYPE) != N_INDR + && (type & N_TYPE) != N_SETA + && (type & N_TYPE) != N_SETT + && (type & N_TYPE) != N_SETD + && (type & N_TYPE) != N_SETB && type != N_WARNING && (sec == &bfd_abs_section || sec == &bfd_und_section)) @@ -307,7 +311,7 @@ obj_crawl_symbol_chain (headers) symbolPP = &symbol_rootP; /*->last symbol chain link. */ while ((symbolP = *symbolPP) != NULL) { - if (flagseen['R'] && (S_GET_SEGMENT (symbolP) == SEG_DATA)) + if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA)) { S_SET_SEGMENT (symbolP, SEG_TEXT); } /* if pusing data into text */ @@ -336,7 +340,7 @@ obj_crawl_symbol_chain (headers) || !S_IS_DEFINED (symbolP) || S_IS_EXTERNAL (symbolP) || (S_GET_NAME (symbolP)[0] != '\001' - && (flagseen['L'] || !S_LOCAL_NAME (symbolP))))) + && (flag_keep_locals || !S_LOCAL_NAME (symbolP))))) { symbolP->sy_number = symbol_number++; @@ -457,7 +461,7 @@ DEFUN_VOID (s_sect) if (strcmp (section_name, ".data") == 0) { - if (flagseen['R']) + if (flag_readonly_data_in_text) subseg_set (SEG_TEXT, (subsegT) exp + 1000); else subseg_set (SEG_DATA, (subsegT) exp); diff --git a/gas/config/obj-aout.h b/gas/config/obj-aout.h index 46ae9562d2..f68dc9e96c 100644 --- a/gas/config/obj-aout.h +++ b/gas/config/obj-aout.h @@ -1,18 +1,18 @@ -/* a.out object file format - Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc. - +/* obj-aout.h, a.out object file format for gas, the assembler. + Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + This file is part of GAS, the GNU Assembler. - + GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GAS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + 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. */ @@ -22,8 +22,18 @@ #include "targ-cpu.h" -#ifndef VMS -#include "a.out.gnu.h" /* Needed to define struct nlist. Sigh. */ +#ifdef BFD_ASSEMBLER + +#include "../bfd/libaout.h" + +#ifndef TARGET_FORMAT +/* #define TARGET_FORMAT "a.out" / * There is no "a.out" target. */ +#endif + +#else /* ! BFD_ASSEMBLER */ + +#ifndef VMS +#include "aout_gnu.h" /* Needed to define struct nlist. Sigh. */ #else #include "a_out.h" #endif @@ -33,19 +43,41 @@ #endif /* AOUT_MACHTYPE */ extern const short seg_N_TYPE[]; -extern const segT N_TYPE_seg[]; +extern const segT N_TYPE_seg[]; #ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC) #endif /* DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE */ +#endif /* ! BFD_ASSEMBLER */ + /* SYMBOL TABLE */ /* Symbol table entry data type */ -typedef struct nlist obj_symbol_type; /* Symbol table entry */ +typedef struct nlist obj_symbol_type; /* Symbol table entry */ /* Symbol table macros and constants */ +#ifdef BFD_ASSEMBLER + +#define S_SET_OTHER(S,V) (aout_symbol((S)->bsym)->other = (V)) +#define S_SET_TYPE(S,T) (aout_symbol((S)->bsym)->type = (T)) +#define S_SET_DESC(S,D) (aout_symbol((S)->bsym)->desc = (D)) +#define S_GET_OTHER(S) (aout_symbol((S)->bsym)->other) +#define S_GET_TYPE(S) (aout_symbol((S)->bsym)->type) +#define S_GET_DESC(S) (aout_symbol((S)->bsym)->desc) + +asection *text_section, *data_section, *bss_section; + +#define obj_frob_symbol(S,PUNT) obj_aout_frob_symbol (S, &PUNT) +#define obj_frob_file() obj_aout_frob_file () +extern void obj_aout_frob_symbol PARAMS ((struct symbol *, int *)); +extern void obj_aout_frob_file PARAMS ((void)); + +#define obj_sec_sym_ok_for_reloc(SEC) (1) + +#else + /* * Macros to extract information from a symbol table entry. * This syntaxic indirection allows independence regarding a.out or coff. @@ -68,15 +100,13 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ #define S_IS_LOCAL(s) (S_GET_NAME(s) && \ !S_IS_DEBUG(s) && \ (S_GET_NAME(s)[0] == '\001' || \ - (S_LOCAL_NAME(s) && !flagseen['L']))) + (S_LOCAL_NAME(s) && !flag_keep_locals))) /* True if a symbol is not defined in this file */ #define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) /* True if the symbol has been generated because of a .stabd directive */ #define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0) /* Accessors */ -/* The value of the symbol */ -#define S_GET_VALUE(s) (((s)->sy_symbol.n_value)) /* The name of the symbol */ #define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name) /* The pointer to the string table */ @@ -91,8 +121,6 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ #define S_GET_DESC(s) ((s)->sy_symbol.n_desc) /* Modifiers */ -/* Set the value of the symbol */ -#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v)) /* Assume that a symbol cannot be simultaneously in more than on segment */ /* set segment */ #define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg)) @@ -104,6 +132,8 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ #define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v)) /* Set the offset in the string table */ #define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v)) +/* Set the n_type field */ +#define S_SET_TYPE(s,t) ((s)->sy_symbol.n_type = (t)) /* Set the n_other expression value */ #define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) /* Set the n_desc expression value */ @@ -119,7 +149,7 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ + H_GET_DATA_RELOCATION_SIZE(h) \ + H_GET_STRING_SIZE(h)) -#define H_GET_HEADER_SIZE(h) (sizeof(struct exec)) +#define H_GET_HEADER_SIZE(h) (EXEC_BYTES_SIZE) #define H_GET_TEXT_SIZE(h) ((h)->header.a_text) #define H_GET_DATA_SIZE(h) ((h)->header.a_data) #define H_GET_BSS_SIZE(h) ((h)->header.a_bss) @@ -164,41 +194,29 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ #define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v)) #define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v)) -#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \ - sizeof(struct nlist)) +#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * 12) #define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v)) #define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) -/* - * Current means for getting the name of a segment. - * This will change for infinite-segments support (e.g. COFF). - */ -#define segment_name(seg) ( seg_name[(int)(seg)] ) -extern char *const seg_name[]; +typedef struct + { + struct exec header; /* a.out header */ + long string_table_size; /* names + '\0' + sizeof(int) */ + } -typedef struct { - struct exec header; /* a.out header */ - long string_table_size; /* names + '\0' + sizeof(int) */ -} object_headers; +object_headers; /* line numbering stuff. */ #define OBJ_EMIT_LINENO(a, b, c) {;} -#define obj_symbol_new_hook(s) {;} - -#ifdef __STDC__ struct fix; -void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address); -#else -void tc_aout_fix_to_chars(); -#endif /* __STDC__ */ +void tc_aout_fix_to_chars PARAMS ((char *where, struct fix *fixP, relax_addressT segment_address)); -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ +#endif + +#define obj_symbol_new_hook(s) {;} + +#define EMIT_SECTION_SYMBOLS 0 /* end of obj-aout.h */ diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c index fef8eacc94..9e8d97bc6e 100644 --- a/gas/config/obj-bout.c +++ b/gas/config/obj-bout.c @@ -239,7 +239,7 @@ obj_crawl_symbol_chain (headers) symbolPP = &symbol_rootP; /*->last symbol chain link. */ while ((symbolP = *symbolPP) != NULL) { - if (flagseen['R'] && (S_GET_SEGMENT (symbolP) == SEG_DATA)) + if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA)) { S_SET_SEGMENT (symbolP, SEG_TEXT); } /* if pusing data into text */ @@ -271,7 +271,7 @@ obj_crawl_symbol_chain (headers) || !S_IS_DEFINED (symbolP) || S_IS_EXTERNAL (symbolP) #endif /* TC_I960 */ - || (S_GET_NAME (symbolP)[0] != '\001' && (flagseen['L'] || !S_LOCAL_NAME (symbolP))))) + || (S_GET_NAME (symbolP)[0] != '\001' && (flag_keep_locals || !S_LOCAL_NAME (symbolP))))) { symbolP->sy_number = symbol_number++; diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h index 41cff7b741..ab47deff50 100644 --- a/gas/config/obj-bout.h +++ b/gas/config/obj-bout.h @@ -192,7 +192,7 @@ struct relocation_info #define S_IS_LOCAL(s) (S_GET_NAME(s) && \ !S_IS_DEBUG(s) && \ (S_GET_NAME(s)[0] == '\001' || \ - (S_LOCAL_NAME(s) && !flagseen['L']))) + (S_LOCAL_NAME(s) && !flag_keep_locals))) /* True if a symbol is not defined in this file */ #define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) /* True if the symbol has been generated because of a .stabd directive */ diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 17633e265e..939809f14a 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -2589,7 +2589,7 @@ yank_symbols () symbolP = real_symbolP; } /* if not local but dup'd */ - if (flagseen['R'] && (S_GET_SEGMENT (symbolP) == SEG_E1)) + if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_E1)) { S_SET_SEGMENT (symbolP, SEG_E0); } /* push data into text */ @@ -3272,7 +3272,7 @@ static void obj_coff_data (ignore) int ignore; { - if (flagseen['R']) + if (flag_readonly_data_in_text) subseg_new (".text", get_absolute_expression () + 1000); else subseg_new (".data", get_absolute_expression ()); @@ -3823,7 +3823,7 @@ fixup_segment (segP, this_segment_type) a signed number. We already know it is not too negative. This is to catch over-large switches generated by gcc on the 68k. */ - if (!flagseen['J'] + if (!flag_signed_overflow_ok && size == 2 && add_number > 0x7fff) as_bad ("Signed .word overflow; switch may be too large; %ld at 0x%lx", diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c index 2216ac0910..fe0465be2e 100644 --- a/gas/config/obj-vms.c +++ b/gas/config/obj-vms.c @@ -39,6 +39,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ */ char *compiler_version_string; +extern int flag_hash_long_names; /* -+ */ +extern int flag_one; /* -1 */ +extern int flag_show_after_trunc; /* -H */ +extern int flag_no_hash_mixed_case; /* -h NUM */ + /* Flag that determines how we map names. This takes several values, and * is set with the -h switch. A value of zero implies names should be * upper case, and the presence of the -h switch inhibits the case hack. @@ -779,7 +784,7 @@ VMS_TBT_Module_Begin () *cp1 = 0; if (strlen (Module_Name) > 31) { - if (flagseen['+']) + if (flag_hash_long_names) printf ("%s: Module name truncated: %s\n", myname, Module_Name); Module_Name[31] = 0; } @@ -3015,7 +3020,7 @@ Write_VMS_MHD_Records () *cp1 = 0; if (strlen (Module_Name) > 31) { - if (flagseen['+']) + if (flag_hash_long_names) printf ("%s: Module name truncated: %s\n", myname, Module_Name); Module_Name[31] = 0; } @@ -3196,7 +3201,7 @@ VMS_Case_Hack_Symbol (In, Out) } old_name = In; -/* if (strlen(In) > 31 && flagseen['+']) +/* if (strlen(In) > 31 && flag_hash_long_names) printf("%s: Symbol name truncated: %s\n",myname,In);*/ /* * Do the case conversion @@ -3233,7 +3238,7 @@ VMS_Case_Hack_Symbol (In, Out) /* * If we saw a dollar sign, we don't do case hacking */ - if (flagseen['h'] || Saw_Dollar) + if (flag_no_hash_mixed_case || Saw_Dollar) Case_Hack_Bits = 0; /* @@ -3256,7 +3261,7 @@ VMS_Case_Hack_Symbol (In, Out) * and ensure that they are lowercase */ for (i = 0; (In[i] != 0) && (i < 8); i++) - if (isupper(In[i]) && !Saw_Dollar && !flagseen['h']) + if (isupper(In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case) break; if (In[i] == 0) @@ -3291,7 +3296,7 @@ VMS_Case_Hack_Symbol (In, Out) */ /* Old behavior for regular GNU-C compiler */ - if (!flagseen['+']) + if (!flag_hash_long_names) truncate = 0; if ((Case_Hack_Bits != 0) || (truncate == 1)) { @@ -3324,7 +3329,7 @@ VMS_Case_Hack_Symbol (In, Out) * Done */ *Out = 0; - if (truncate == 1 && flagseen['+'] && flagseen['H']) + if (truncate == 1 && flag_hash_long_names && flag_show_after_trunc) printf ("%s: Symbol %s replaced by %s\n", myname, old_name, new_name); } @@ -4234,7 +4239,7 @@ VMS_Check_For_Main () S_IS_EXTERNAL (symbolP) && (S_GET_TYPE (symbolP) == N_TEXT)) { #ifdef HACK_DEC_C_STARTUP - if (!flagseen['+']) + if (!flag_hash_long_names) { #endif /* @@ -5223,10 +5228,10 @@ VMS_write_object_file (text_siz, data_siz, bss_siz, text_frag_root, if (Current_File->max_line == 0) continue; if ((strncmp (Current_File->name, "GNU_GXX_INCLUDE:", 16) == 0) && - !flagseen['D']) + !flag_debug) continue; if ((strncmp (Current_File->name, "GNU_CC_INCLUDE:", 15) == 0) && - !flagseen['D']) + !flag_debug) continue; /* show a few extra lines at the start of the region selected */ if (Current_File->min_line > 2) diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 18ddeacf7c..593378cab6 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1282,10 +1282,10 @@ md_begin () /* Folding of text and data segments fails miserably on the PA. Warn user and disable "-R" option. */ - if (flagseen['R']) + if (flag_readonly_data_in_text) { as_warn ("-R option not supported on this target."); - flagseen['R'] = 0; + flag_readonly_data_in_text = 0; } pa_spaces_begin (); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index ae46edfc5e..e77ef72c63 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -4928,7 +4928,7 @@ md_parse_option (c, arg) #endif /* FIXME: This breaks -L -EL. */ - flagseen['L'] = 0; + flag_keep_locals = 0; break; case 'O': diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c index ecd92167b9..acb4b99ea7 100644 --- a/gas/config/tc-vax.c +++ b/gas/config/tc-vax.c @@ -55,6 +55,11 @@ static struct vit v; LITTLENUM_TYPE big_operand_bits[VIT_MAX_OPERANDS][SIZE_OF_LARGE_NUMBER]; FLONUM_TYPE float_operand[VIT_MAX_OPERANDS]; /* Above is made to point into big_operand_bits by md_begin(). */ + +int flag_hash_long_names; /* -+ */ +int flag_one; /* -1 */ +int flag_show_after_trunc; /* -H */ +int flag_no_hash_mixed_case; /* -h NUM */ /* * For VAX, relative addresses of "just the right length" are easy. @@ -3099,7 +3104,7 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) } #ifdef OBJ_VMS -CONST char *md_shortopts = "d:STt:V+h:H"; +CONST char *md_shortopts = "d:STt:V+1h:Hv:"; #else CONST char *md_shortopts = "d:STt:V"; #endif @@ -3136,17 +3141,31 @@ md_parse_option (c, arg) break; #ifdef OBJ_VMS - case '+': /* For g++ */ + case '+': /* For g++. Hash any name > 31 chars long. */ + flag_hash_long_names = 1; + break; + + case '1': /* For backward compatibility */ + flag_one = 1; + break; + + case 'H': /* Show new symbol after hash truncation */ + flag_show_after_trunc = 1; break; case 'h': /* No hashing of mixed-case names */ { extern char vms_name_mapping; vms_name_mapping = atoi (arg); + flag_no_hash_mixed_case = 1; } break; - case 'H': /* Show new symbol after hash truncation */ + case 'v': + { + extern char *compiler_version_string; + compiler_version_string = arg; + } break; #endif @@ -3169,6 +3188,14 @@ VAX options:\n\ -t FILE ignored\n\ -T ignored\n\ -V ignored\n"); +#ifdef OBJ_VMS + fprintf (stream, "\ +-+ hash names longer than 31 characters\n\ +-1 ?\n\ +-H show new symbol after hash truncation\n\ +-h do not hash mixed-case names\n\ +-vVERSION compiler version is VERSION\n"); +#endif } /* We have no need to default values of symbols. */ diff --git a/gas/read.c b/gas/read.c index c48a225da2..da2b3a6baa 100644 --- a/gas/read.c +++ b/gas/read.c @@ -888,8 +888,11 @@ s_comm (ignore) S_SET_EXTERNAL (symbolP); } #ifdef OBJ_VMS - if ( (!temp) || !flagseen['1']) - S_GET_OTHER(symbolP) = const_flag; + { + extern int flag_one; + if ( (!temp) || !flag_one) + S_GET_OTHER(symbolP) = const_flag; + } #endif /* not OBJ_VMS */ know (symbolP->sy_frag == &zero_address_frag); demand_empty_rest_of_line (); @@ -903,7 +906,7 @@ s_data (ignore) register int temp; temp = get_absolute_expression (); - if (flagseen['R']) + if (flag_readonly_data_in_text) { section = text_section; temp += 1000; diff --git a/gas/write.c b/gas/write.c index 000e790721..7964934a03 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1042,7 +1042,7 @@ write_object_file () n_errs = had_errors (); /* The -Z flag indicates that an object file should be generated, regardless of warnings and errors. */ - if (flagseen['Z']) + if (flag_always_generate_output) { if (n_warns || n_errs) as_warn ("%d error%s, %d warning%s, generating bad object file.\n", @@ -1128,7 +1128,7 @@ write_object_file () data frags into the text segment. Do this before relaxing so we know to take advantage of -R and make shorter addresses. */ #if !defined (OBJ_AOUT) || defined (BFD_ASSEMBLER) - if (flagseen['R']) + if (flag_readonly_data_in_text) { merge_data_into_text (); } @@ -1485,6 +1485,16 @@ write_object_file () } } + /* Now do any format-specific adjustments to the symbol table, such + as adding file symbols. */ +#ifdef obj_adjust_symtab + obj_adjust_symtab (); +#endif + + /* Now that all the sizes are known, and contents correct, we can + start writing to the file. */ + set_symtab (); + /* If *_frob_file changes the symbol value at this point, it is responsible for moving the changed value into symp->bsym->value as well. Hopefully all symbol value changing can be done in @@ -1496,10 +1506,6 @@ write_object_file () obj_frob_file (); #endif - /* Now that all the sizes are known, and contents correct, we can - start writing to the file. */ - set_symtab (); - bfd_map_over_sections (stdoutput, write_relocs, (char *) 0); bfd_map_over_sections (stdoutput, write_contents, (char *) 0); @@ -1679,7 +1685,7 @@ relax_segment (segment_frag_root, segment) + S_GET_VALUE (lie->sub))); if (offset <= -32768 || offset >= 32767) { - if (flagseen['K']) + if (flag_warn_displacement) { char buf[50]; sprint_value (buf, (addressT) lie->addnum); @@ -2161,7 +2167,7 @@ fixup_segment (fixP, this_segment_type) /* Warn if a .word value is too large when treated as a signed number. We already know it is not too negative. This is to catch over-large switches generated by gcc on the 68k. */ - if (!flagseen['J'] + if (!flag_signed_overflow_ok && size == 2 && add_number > 0x7fff) as_bad_where (fixP->fx_file, fixP->fx_line, -- 2.34.1