1999-05-03 15:29:11 +08:00
|
|
|
/* obj-aout.h, a.out object file format for gas, the assembler.
|
2018-01-03 13:17:27 +08:00
|
|
|
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
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
|
2007-07-03 19:01:12 +08:00
|
|
|
published by the Free Software Foundation; either version 3,
|
1999-05-03 15:29:11 +08:00
|
|
|
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
|
2005-05-05 17:13:19 +08:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Tag to validate a.out object file format processing */
|
|
|
|
#define OBJ_AOUT 1
|
|
|
|
|
|
|
|
#include "targ-cpu.h"
|
|
|
|
|
|
|
|
#include "bfd/libaout.h"
|
|
|
|
|
|
|
|
#define OUTPUT_FLAVOR bfd_target_aout_flavour
|
|
|
|
|
2000-01-27 06:48:31 +08:00
|
|
|
extern const pseudo_typeS aout_pseudo_table[];
|
|
|
|
|
|
|
|
#ifndef obj_pop_insert
|
|
|
|
#define obj_pop_insert() pop_insert (aout_pseudo_table)
|
|
|
|
#endif
|
|
|
|
|
2005-03-25 04:40:28 +08:00
|
|
|
/* Symbol table entry data type. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-03-25 04:40:28 +08:00
|
|
|
typedef struct nlist obj_symbol_type; /* Symbol table entry. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Symbol table macros and constants */
|
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 08:29:48 +08:00
|
|
|
#define S_SET_OTHER(S,V) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->other = (V))
|
|
|
|
#define S_SET_TYPE(S,T) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->type = (T))
|
|
|
|
#define S_SET_DESC(S,D) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->desc = (D))
|
|
|
|
#define S_GET_OTHER(S) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->other)
|
|
|
|
#define S_GET_TYPE(S) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->type)
|
|
|
|
#define S_GET_DESC(S) \
|
|
|
|
(aout_symbol (symbol_get_bfdsym (S))->desc)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
Update soruces to make alpha, arc and arm targets compile cleanly
with -Wc++-compat:
* config/tc-alpha.c: Add casts.
(extended_bfd_reloc_code_real_type): New type. Used to avoid
enumeration conversion warnings.
(struct alpha_fixup, void assemble_insn, assemble_insn)
(assemble_tokens): Use new type.
* ecoff.c: Add casts. (mark_stabs): Use enumeration names.
* config/obj-elf.c: Add cast
* config/tc-arc.c: Add casts.
* config/obj-aout.h (text_section,data_section,bss_section):
Make extern.
* config/obj-elf.c: Add cast.
* config/tc-arm.c: Add casts.
(X, TxCE, TxCE, TxC3, TxC3w, TxCM_, TxCM, TUE, TUF, CE, CL, cCE)
(cCL, C3E, xCM_, nUF, nCE_tag): Change input format to avoid the
need for keywords as arguments.
* ecoff.c: Add casts.
* ecofflink.c: Add casts.
* elf64-alpha.c: Add casts.
(struct alpha_elf_got_entry, struct alpha_elf_reloc_entry): Move
to top level.
(SKIP_HOWTO): Use enum name.
* elf32-arm.c: Add casts.
(elf32_arm_vxworks_bed): Update code to avoid multiple
declarations.
(struct map_stub): Move to top level.
* arc-dis.c Fix casts.
* arc-ext.c: Add casts.
* arm-dis.c (enum opcode_sentinel_enum): Gave name to anonymous
enum.
* emultempl/armelf.em: Add casts.
2009-09-26 03:13:27 +08:00
|
|
|
extern asection *text_section, *data_section, *bss_section;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define obj_frob_symbol(S,PUNT) obj_aout_frob_symbol (S, &PUNT)
|
2002-09-05 08:01:18 +08:00
|
|
|
#define obj_frob_file_before_fix() obj_aout_frob_file_before_fix ()
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-03-25 04:40:28 +08:00
|
|
|
extern void obj_aout_frob_symbol (symbolS *, int *);
|
|
|
|
extern void obj_aout_frob_file_before_fix (void);
|
|
|
|
|
|
|
|
#define obj_sec_sym_ok_for_reloc(SEC) 1
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-01-27 06:48:31 +08:00
|
|
|
#define obj_read_begin_hook() {;}
|
1999-05-03 15:29:11 +08:00
|
|
|
#define obj_symbol_new_hook(s) {;}
|
|
|
|
|
|
|
|
#define EMIT_SECTION_SYMBOLS 0
|
|
|
|
|
|
|
|
#define AOUT_STABS
|