diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-06-11 20:45:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-06-11 20:45:49 +0000 |
commit | 02d4e9238a798a687ec5ce46a87a7971708c6781 (patch) | |
tree | fd411f2a8bc829e5203c9361c4c4b817a79577c8 /gas/config/obj-aout.c | |
parent | 4298e311fecf31dc42bda5e366600903631775fe (diff) | |
download | gdb-02d4e9238a798a687ec5ce46a87a7971708c6781.zip gdb-02d4e9238a798a687ec5ce46a87a7971708c6781.tar.gz gdb-02d4e9238a798a687ec5ce46a87a7971708c6781.tar.bz2 |
Add weak symbols as an extension to a.out.
* read.c (pseudo_set): Only preserve external bit for OBJ_AOUT and
OBJ_BOUT if not BFD_ASSEMBLER.
* config/aout_gnu.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB):
Define as in ../include/aout/aout64.h.
* config/obj-aout.h (OBJ_SYMFIELD_TYPE): If not BFD_ASSEMBLER,
define as char.
(S_GET_WEAK, S_SET_WEAK): Define if not BFD_ASSEMBLER.
* config/obj-aout.c (obj_pseudo_table): Add "weak".
(obj_emit_symbols): Adjust type of weak symbols.
(obj_aout_weak): New static function.
Diffstat (limited to 'gas/config/obj-aout.c')
-rw-r--r-- | gas/config/obj-aout.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 944d8e0..00e7794 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -62,12 +62,15 @@ const segT N_TYPE_seg[N_TYPE + 2] = #endif static void obj_aout_line PARAMS ((int)); +static void obj_aout_weak PARAMS ((int)); const pseudo_typeS obj_pseudo_table[] = { {"line", obj_aout_line, 0}, /* source code line number */ {"ln", obj_aout_line, 0}, /* coff line number that we use anyway */ + {"weak", obj_aout_weak, 0}, /* mark symbol as weak. */ + /* coff debug pseudos (ignored) */ {"def", s_ignore, 0}, {"dim", s_ignore, 0}, @@ -273,6 +276,20 @@ obj_emit_symbols (where, symbol_rootP) if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP)) S_SET_EXTERNAL (symbolP); + /* Adjust the type of a weak symbol. */ + if (S_GET_WEAK (symbolP)) + { + switch (S_GET_TYPE (symbolP)) + { + case N_UNDF: S_SET_TYPE (symbolP, N_WEAKU); break; + case N_ABS: S_SET_TYPE (symbolP, N_WEAKA); break; + case N_TEXT: S_SET_TYPE (symbolP, N_WEAKT); break; + case N_DATA: S_SET_TYPE (symbolP, N_WEAKD); break; + case N_BSS: S_SET_TYPE (symbolP, N_WEAKB); break; + default: as_bad ("%s: bad type for weak symbol", temp); break; + } + } + obj_symbol_to_chars (where, symbolP); S_SET_NAME (symbolP, temp); } @@ -291,6 +308,36 @@ obj_aout_line (ignore) demand_empty_rest_of_line (); } /* obj_aout_line() */ +/* Handle .weak. This is a GNU extension. */ + +static void +obj_aout_weak (ignore) + int ignore; +{ + 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_SET_WEAK (symbolP); + if (c == ',') + { + input_line_pointer++; + SKIP_WHITESPACE (); + if (*input_line_pointer == '\n') + c = '\n'; + } + } + while (c == ','); + demand_empty_rest_of_line (); +} + void obj_read_begin_hook () { |