diff options
author | David MacKenzie <djm@cygnus> | 1994-06-03 20:59:20 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1994-06-03 20:59:20 +0000 |
commit | def66e248c4dff4e2d5095a9a7739a06adf3fa78 (patch) | |
tree | a9805265c3579ce5aaeba3e7316412b15dbfa314 /gas/config | |
parent | 26997f44ba11f70b8420b8f0da1e64dbaf31edd0 (diff) | |
download | gdb-def66e248c4dff4e2d5095a9a7739a06adf3fa78.zip gdb-def66e248c4dff4e2d5095a9a7739a06adf3fa78.tar.gz gdb-def66e248c4dff4e2d5095a9a7739a06adf3fa78.tar.bz2 |
* 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.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/obj-aout.c | 10 | ||||
-rw-r--r-- | gas/config/obj-aout.h | 100 | ||||
-rw-r--r-- | gas/config/obj-bout.c | 4 | ||||
-rw-r--r-- | gas/config/obj-bout.h | 2 | ||||
-rw-r--r-- | gas/config/obj-coff.c | 6 | ||||
-rw-r--r-- | gas/config/obj-vms.c | 25 | ||||
-rw-r--r-- | gas/config/tc-hppa.c | 4 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 2 | ||||
-rw-r--r-- | gas/config/tc-vax.c | 33 |
9 files changed, 120 insertions, 66 deletions
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 332a65f..944d8e0 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 46ae956..f68dc9e 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 fef8eac..9e8d97b 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 41cff7b..ab47def 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 17633e2..939809f 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 2216ac0..fe0465b 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 18ddeac..593378c 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 ae46edf..e77ef72 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 ecd9216..acb4b99 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. */ |