1999-05-03 15:29:11 +08:00
|
|
|
/* coff object file format
|
2019-01-01 18:31:27 +08:00
|
|
|
Copyright (C) 1989-2019 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
This file is part of GAS.
|
|
|
|
|
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 19:01:12 +08:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 15:29:11 +08:00
|
|
|
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
|
|
|
|
|
|
|
#ifndef OBJ_FORMAT_H
|
|
|
|
#define OBJ_FORMAT_H
|
|
|
|
|
|
|
|
#define OBJ_COFF 1
|
|
|
|
|
|
|
|
#include "targ-cpu.h"
|
|
|
|
|
|
|
|
/* This internal_lineno crap is to stop namespace pollution from the
|
2000-09-13 05:49:09 +08:00
|
|
|
bfd internal coff headerfile. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define internal_lineno bfd_internal_lineno
|
|
|
|
#include "coff/internal.h"
|
|
|
|
#undef internal_lineno
|
|
|
|
|
|
|
|
/* CPU-specific setup: */
|
|
|
|
|
|
|
|
#ifdef TC_ARM
|
|
|
|
#include "coff/arm.h"
|
|
|
|
#ifndef TARGET_FORMAT
|
|
|
|
#define TARGET_FORMAT "coff-arm"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_PPC
|
|
|
|
#ifdef TE_PE
|
|
|
|
#include "coff/powerpc.h"
|
|
|
|
#else
|
|
|
|
#include "coff/rs6000.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_I386
|
2009-05-20 21:48:16 +08:00
|
|
|
#ifdef TE_PEP
|
2006-09-20 19:35:11 +08:00
|
|
|
#include "coff/x86_64.h"
|
|
|
|
#else
|
1999-05-03 15:29:11 +08:00
|
|
|
#include "coff/i386.h"
|
2006-09-20 19:35:11 +08:00
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifndef TARGET_FORMAT
|
2006-09-20 19:35:11 +08:00
|
|
|
#ifdef TE_PEP
|
|
|
|
#define TARGET_FORMAT "coff-x86-64"
|
|
|
|
#else
|
1999-05-03 15:29:11 +08:00
|
|
|
#define TARGET_FORMAT "coff-i386"
|
|
|
|
#endif
|
|
|
|
#endif
|
2006-09-20 19:35:11 +08:00
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef TC_M68K
|
|
|
|
#include "coff/m68k.h"
|
|
|
|
#ifndef TARGET_FORMAT
|
|
|
|
#define TARGET_FORMAT "coff-m68k"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-10-26 01:40:19 +08:00
|
|
|
#ifdef TC_Z80
|
|
|
|
#include "coff/z80.h"
|
|
|
|
#define TARGET_FORMAT "coff-z80"
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifdef TC_Z8K
|
|
|
|
#include "coff/z8k.h"
|
|
|
|
#define TARGET_FORMAT "coff-z8k"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_SH
|
2000-02-25 03:49:18 +08:00
|
|
|
|
|
|
|
#ifdef TE_PE
|
|
|
|
#define COFF_WITH_PE
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#include "coff/sh.h"
|
2000-02-25 03:49:18 +08:00
|
|
|
|
|
|
|
#ifdef TE_PE
|
|
|
|
#define TARGET_FORMAT "pe-shl"
|
|
|
|
#else
|
2001-11-16 05:29:00 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define TARGET_FORMAT \
|
2002-02-19 07:57:10 +08:00
|
|
|
(!target_big_endian \
|
1999-05-03 15:29:11 +08:00
|
|
|
? (sh_small ? "coff-shl-small" : "coff-shl") \
|
|
|
|
: (sh_small ? "coff-sh-small" : "coff-sh"))
|
2001-11-16 05:29:00 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
2000-02-25 03:49:18 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_MIPS
|
|
|
|
#define COFF_WITH_PE
|
|
|
|
#include "coff/mipspe.h"
|
|
|
|
#undef TARGET_FORMAT
|
|
|
|
#define TARGET_FORMAT "pe-mips"
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef TC_TIC30
|
|
|
|
#include "coff/tic30.h"
|
|
|
|
#define TARGET_FORMAT "coff-tic30"
|
|
|
|
#endif
|
|
|
|
|
2002-08-28 18:38:51 +08:00
|
|
|
#ifdef TC_TIC4X
|
|
|
|
#include "coff/tic4x.h"
|
2003-04-04 16:15:15 +08:00
|
|
|
#define TARGET_FORMAT "coff2-tic4x"
|
2002-08-28 18:38:51 +08:00
|
|
|
#endif
|
|
|
|
|
2000-06-20 21:52:32 +08:00
|
|
|
#ifdef TC_TIC54X
|
|
|
|
#include "coff/tic54x.h"
|
|
|
|
#define TARGET_FORMAT "coff1-c54x"
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifdef TC_MCORE
|
|
|
|
#include "coff/mcore.h"
|
|
|
|
#ifndef TARGET_FORMAT
|
|
|
|
#define TARGET_FORMAT "pe-mcore"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-11-08 16:12:53 +08:00
|
|
|
#ifdef TE_PE
|
gas/ChangeLog:
* read.c (potable): Add weakref.
(s_weakref): New.
* read.h (s_weakref): Declare.
* struc-symbol.h (struct symbol): Add sy_weakrefr and sy_weakrefd.
* symbols.c (colon): Clear weakrefr.
(symbol_find_exact): Rename to, and reimplement in terms of...
(symbol_find_exact_noref): ... new function.
(symbol_find): Likewise...
(symbol_find_noref): ... ditto.
(resolve_symbol_value): Resolve weakrefr without setting their
values.
(S_SET_WEAK): Call hook.
(S_GET_VALUE): Follow weakref link.
(S_SET_VALUE): Clear weakrefr.
(S_IS_WEAK): Follow weakref link.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): New.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): New.
(symbol_set_value_expression, symbol_set_frag): Clear weakrefr.
(symbol_mark_used): Follow weakref link.
(print_symbol_value_1): Print weak, weakrefr and weakrefd.
* symbols.h (symbol_find_noref, symbol_find_exact_noref): Declare.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): Declare.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): Declare.
* write.c (adust_reloc_syms): Follow weakref link. Do not
complain if target is undefined.
(write_object_file): Likewise. Remove weakrefr symbols. Drop
unreferenced weakrefd symbols.
* config/obj-coff.c (obj_frob_symbol): Do not force WEAKREFD
symbols EXTERNAL.
(pecoff_obj_set_weak_hook, pecoff_obj_clear_weak_hook): New.
* config/obj-coff.h (obj_set_weak_hook, obj_clear_weak_hook): Define.
* doc/as.texinfo: Document weakref.
* doc/internals.texi: Document new struct members, internal
functions and hooks.
gas/testsuite/ChangeLog:
* gas/all/weakref1.s, gas/all/weakref1.d: New test.
* gas/all/weakref1g.d, gas/all/weakref1l.d: New tests.
* gas/all/weakref1u.d, gas/all/weakref1w.d: New tests.
* gas/all/weakref2.s, gas/all/weakref3.s: New tests.
* gas/all/gas.exp: Run new tests.
2005-10-25 01:51:42 +08:00
|
|
|
#define obj_set_weak_hook pecoff_obj_set_weak_hook
|
|
|
|
#define obj_clear_weak_hook pecoff_obj_clear_weak_hook
|
2004-11-08 16:12:53 +08:00
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifndef OBJ_COFF_MAX_AUXENTRIES
|
|
|
|
#define OBJ_COFF_MAX_AUXENTRIES 1
|
2004-11-08 16:12:53 +08:00
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define obj_symbol_new_hook coff_obj_symbol_new_hook
|
2005-10-27 15:40:07 +08:00
|
|
|
#define obj_symbol_clone_hook coff_obj_symbol_clone_hook
|
1999-05-03 15:29:11 +08:00
|
|
|
#define obj_read_begin_hook coff_obj_read_begin_hook
|
|
|
|
|
|
|
|
#include "bfd/libcoff.h"
|
|
|
|
|
|
|
|
#define OUTPUT_FLAVOR bfd_target_coff_flavour
|
|
|
|
|
|
|
|
/* Alter the field names, for now, until we've fixed up the other
|
|
|
|
references to use the new name. */
|
|
|
|
#define OBJ_SYMFIELD_TYPE unsigned long
|
2012-01-12 16:53:34 +08:00
|
|
|
#define sy_obj sy_obj_flags
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-09-05 08:01:18 +08:00
|
|
|
/* We can't use the predefined section symbols in bfd/section.c, as
|
|
|
|
COFF symbols have extra fields. See bfd/libcoff.h:coff_symbol_type. */
|
|
|
|
#ifndef obj_sec_sym_ok_for_reloc
|
|
|
|
#define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
|
|
|
|
#endif
|
|
|
|
|
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 SYM_AUXENT(S) \
|
|
|
|
(&coffsymbol (symbol_get_bfdsym (S))->native[1].u.auxent)
|
|
|
|
#define SYM_AUXINFO(S) \
|
|
|
|
(&coffsymbol (symbol_get_bfdsym (S))->native[1])
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* The number of auxiliary entries. */
|
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_GET_NUMBER_AUXILIARY(s) \
|
|
|
|
(coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux)
|
2002-02-01 01:33:08 +08:00
|
|
|
/* The number of auxiliary entries. */
|
2005-03-16 22:57:00 +08:00
|
|
|
#define S_SET_NUMBER_AUXILIARY(s, v) (S_GET_NUMBER_AUXILIARY (s) = (v))
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-09-13 05:49:09 +08:00
|
|
|
/* True if a symbol name is in the string table, i.e. its length is > 8. */
|
2005-03-16 22:57:00 +08:00
|
|
|
#define S_IS_STRING(s) (strlen (S_GET_NAME (s)) > 8 ? 1 : 0)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* Auxiliary entry macros. SA_ stands for symbol auxiliary. */
|
|
|
|
/* Omit the tv related fields. */
|
|
|
|
/* Accessors. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
|
|
|
|
#define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno)
|
|
|
|
#define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size)
|
|
|
|
#define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize)
|
|
|
|
#define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr)
|
|
|
|
#define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx)
|
|
|
|
#define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)])
|
|
|
|
#define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname)
|
|
|
|
#define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen)
|
|
|
|
#define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc)
|
|
|
|
#define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno)
|
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno = (v))
|
|
|
|
#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size = (v))
|
|
|
|
#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize = (v))
|
|
|
|
#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr = (v))
|
|
|
|
#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)] = (v))
|
|
|
|
#define SA_SET_FILE_FNAME(s,v) strncpy (SYM_AUXENT (s)->x_file.x_fname, (v), FILNMLEN)
|
|
|
|
#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen = (v))
|
|
|
|
#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc = (v))
|
|
|
|
#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno = (v))
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* Internal use only definitions. SF_ stands for symbol flags.
|
2002-05-11 17:53:52 +08:00
|
|
|
|
Remove i860, i960, bout and aout-adobe targets
Plus remove a few leftovers from the 29k support.
include/
* aout/adobe.h: Delete.
* aout/reloc.h: Delete.
* coff/i860.h: Delete.
* coff/i960.h: Delete.
* elf/i860.h: Delete.
* elf/i960.h: Delete.
* opcode/i860.h: Delete.
* opcode/i960.h: Delete.
* aout/aout64.h (enum reloc_type): Trim off 29k and other unused values.
* aout/ar.h (ARMAGB): Remove.
* coff/internal.h (struct internal_aouthdr, struct internal_scnhdr,
union internal_auxent): Remove i960 support.
bfd/
* aout-adobe.c: Delete.
* bout.c: Delete.
* coff-i860.c: Delete.
* coff-i960.c: Delete.
* cpu-i860.c: Delete.
* cpu-i960.c: Delete.
* elf32-i860.c: Delete.
* elf32-i960.c: Delete.
* hosts/i860mach3.h: Delete.
* Makefile.am: Remove i860, i960, bout, and adobe support.
* archures.c: Remove i860 and i960 support.
* coffcode.h: Likewise.
* reloc.c: Likewise.
* aoutx.h: Comment updates.
* archive.c: Remove BOUT and i960 support.
* bfd.c: Remove BOUT support.
* coffswap.h: Remove i960 support.
* config.bfd: Remove i860, i960 and adobe targets.
* configure.ac: Remove adode, bout, i860, i960, icoff targets.
* targets.c: Likewise.
* ieee.c: Remove i960 support.
* mach-o.c: Remove i860 support.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* opcodes/i860-dis.c: Delete.
* opcodes/i960-dis.c: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* ieee.c: Remove i960 support.
* od-macho.c: Remove i860 support.
* readelf.c: Remove i860 and i960 support.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/binutils-all/objdump.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* config/aout_gnu.h: Delete.
* config/tc-i860.c: Delete.
* config/tc-i860.h: Delete.
* config/tc-i960.c: Delete.
* config/tc-i960.h: Delete.
* doc/c-i860.texi: Delete.
* doc/c-i960.texi: Delete.
* testsuite/gas/i860/README.i860: Delete.
* testsuite/gas/i860/bitwise.d: Delete.
* testsuite/gas/i860/bitwise.s: Delete.
* testsuite/gas/i860/branch.d: Delete.
* testsuite/gas/i860/branch.s: Delete.
* testsuite/gas/i860/bte.d: Delete.
* testsuite/gas/i860/bte.s: Delete.
* testsuite/gas/i860/dir-align01.d: Delete.
* testsuite/gas/i860/dir-align01.s: Delete.
* testsuite/gas/i860/dir-intel01.d: Delete.
* testsuite/gas/i860/dir-intel01.s: Delete.
* testsuite/gas/i860/dir-intel02.d: Delete.
* testsuite/gas/i860/dir-intel02.s: Delete.
* testsuite/gas/i860/dir-intel03-err.l: Delete.
* testsuite/gas/i860/dir-intel03-err.s: Delete.
* testsuite/gas/i860/dual01.d: Delete.
* testsuite/gas/i860/dual01.s: Delete.
* testsuite/gas/i860/dual02-err.l: Delete.
* testsuite/gas/i860/dual02-err.s: Delete.
* testsuite/gas/i860/dual03.d: Delete.
* testsuite/gas/i860/dual03.s: Delete.
* testsuite/gas/i860/fldst01.d: Delete.
* testsuite/gas/i860/fldst01.s: Delete.
* testsuite/gas/i860/fldst02.d: Delete.
* testsuite/gas/i860/fldst02.s: Delete.
* testsuite/gas/i860/fldst03.d: Delete.
* testsuite/gas/i860/fldst03.s: Delete.
* testsuite/gas/i860/fldst04.d: Delete.
* testsuite/gas/i860/fldst04.s: Delete.
* testsuite/gas/i860/fldst05.d: Delete.
* testsuite/gas/i860/fldst05.s: Delete.
* testsuite/gas/i860/fldst06.d: Delete.
* testsuite/gas/i860/fldst06.s: Delete.
* testsuite/gas/i860/fldst07.d: Delete.
* testsuite/gas/i860/fldst07.s: Delete.
* testsuite/gas/i860/fldst08.d: Delete.
* testsuite/gas/i860/fldst08.s: Delete.
* testsuite/gas/i860/float01.d: Delete.
* testsuite/gas/i860/float01.s: Delete.
* testsuite/gas/i860/float02.d: Delete.
* testsuite/gas/i860/float02.s: Delete.
* testsuite/gas/i860/float03.d: Delete.
* testsuite/gas/i860/float03.s: Delete.
* testsuite/gas/i860/float04.d: Delete.
* testsuite/gas/i860/float04.s: Delete.
* testsuite/gas/i860/form.d: Delete.
* testsuite/gas/i860/form.s: Delete.
* testsuite/gas/i860/i860.exp: Delete.
* testsuite/gas/i860/iarith.d: Delete.
* testsuite/gas/i860/iarith.s: Delete.
* testsuite/gas/i860/ldst01.d: Delete.
* testsuite/gas/i860/ldst01.s: Delete.
* testsuite/gas/i860/ldst02.d: Delete.
* testsuite/gas/i860/ldst02.s: Delete.
* testsuite/gas/i860/ldst03.d: Delete.
* testsuite/gas/i860/ldst03.s: Delete.
* testsuite/gas/i860/ldst04.d: Delete.
* testsuite/gas/i860/ldst04.s: Delete.
* testsuite/gas/i860/ldst05.d: Delete.
* testsuite/gas/i860/ldst05.s: Delete.
* testsuite/gas/i860/ldst06.d: Delete.
* testsuite/gas/i860/ldst06.s: Delete.
* testsuite/gas/i860/pfam.d: Delete.
* testsuite/gas/i860/pfam.s: Delete.
* testsuite/gas/i860/pfmam.d: Delete.
* testsuite/gas/i860/pfmam.s: Delete.
* testsuite/gas/i860/pfmsm.d: Delete.
* testsuite/gas/i860/pfmsm.s: Delete.
* testsuite/gas/i860/pfsm.d: Delete.
* testsuite/gas/i860/pfsm.s: Delete.
* testsuite/gas/i860/pseudo-ops01.d: Delete.
* testsuite/gas/i860/pseudo-ops01.s: Delete.
* testsuite/gas/i860/regress01.d: Delete.
* testsuite/gas/i860/regress01.s: Delete.
* testsuite/gas/i860/shift.d: Delete.
* testsuite/gas/i860/shift.s: Delete.
* testsuite/gas/i860/simd.d: Delete.
* testsuite/gas/i860/simd.s: Delete.
* testsuite/gas/i860/system.d: Delete.
* testsuite/gas/i860/system.s: Delete.
* testsuite/gas/i860/xp.d: Delete.
* testsuite/gas/i860/xp.s: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/all.texi: Likewise.
* testsuite/gas/all/gas.exp
* config/obj-coff.h: Remove i960 support.
* doc/internals.texi: Likewise.
* expr.c: Likewise.
* read.c: Likewise.
* write.c: Likewise.
* write.h: Likewise.
* testsuite/gas/lns/lns.exp: Likewise.
* testsuite/gas/symver/symver.exp: Likewise.
* config/tc-m68k.c: Remove BOUT support.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* symbols.c: Likewise.
* doc/h8.texi: Likewise.
* configure.ac: Remove BOUT and i860 support.
* doc/as.texinfo: Remove BOUT, i860 and i960 support
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* emulparams/coff_i860.sh: Delete.
* emulparams/elf32_i860.sh: Delete.
* emulparams/elf32_i960.sh: Delete.
* emulparams/gld960.sh: Delete.
* emulparams/gld960coff.sh: Delete.
* emulparams/lnk960.sh: Delete.
* emultempl/gld960.em: Delete.
* emultempl/gld960c.em: Delete.
* emultempl/lnk960.em: Delete.
* scripttempl/i860coff.sc: Delete.
* scripttempl/i960.sc: Delete.
* ld.texinfo: Remove i960 support.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* testsuite/ld-discard/extern.d: Likewise.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Likewise.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
2018-04-11 17:16:05 +08:00
|
|
|
These values can be assigned to sy_symbol.ost_flags field of a symbolS. */
|
2015-08-12 19:40:42 +08:00
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_NORMAL_MASK 0x0000ffff /* bits 12-15 are general purpose. */
|
2015-08-12 19:40:42 +08:00
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_STATICS 0x00001000 /* Mark the .text & all symbols. */
|
|
|
|
#define SF_DEFINED 0x00002000 /* Symbol is defined in this file. */
|
|
|
|
#define SF_STRING 0x00004000 /* Symbol name length > 8. */
|
|
|
|
#define SF_LOCAL 0x00008000 /* Symbol must not be emitted. */
|
2015-08-12 19:40:42 +08:00
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_DEBUG_MASK 0xffff0000 /* bits 16-31 are debug info. */
|
2015-08-12 19:40:42 +08:00
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_FUNCTION 0x00010000 /* The symbol is a function. */
|
|
|
|
#define SF_PROCESS 0x00020000 /* Process symbol before write. */
|
|
|
|
#define SF_TAGGED 0x00040000 /* Is associated with a tag. */
|
|
|
|
#define SF_TAG 0x00080000 /* Is a tag. */
|
|
|
|
#define SF_DEBUG 0x00100000 /* Is in debug or abs section. */
|
|
|
|
#define SF_GET_SEGMENT 0x00200000 /* Get the section of the forward symbol. */
|
2000-09-13 05:49:09 +08:00
|
|
|
/* All other bits are unused. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* Accessors. */
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_GET(s) (* symbol_get_obj (s))
|
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 SF_GET_DEBUG(s) (symbol_get_bfdsym (s)->flags & BSF_DEBUGGING)
|
|
|
|
#define SF_SET_DEBUG(s) (symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING)
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK)
|
|
|
|
#define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK)
|
|
|
|
#define SF_GET_FILE(s) (SF_GET (s) & SF_FILE)
|
|
|
|
#define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS)
|
|
|
|
#define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED)
|
|
|
|
#define SF_GET_STRING(s) (SF_GET (s) & SF_STRING)
|
|
|
|
#define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL)
|
|
|
|
#define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION)
|
|
|
|
#define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS)
|
|
|
|
#define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED)
|
|
|
|
#define SF_GET_TAG(s) (SF_GET (s) & SF_TAG)
|
|
|
|
#define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT)
|
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* Modifiers. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SF_SET(s,v) (SF_GET (s) = (v))
|
2005-03-16 22:57:00 +08:00
|
|
|
#define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK))
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
|
|
|
|
#define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE)
|
|
|
|
#define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS)
|
|
|
|
#define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED)
|
|
|
|
#define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING)
|
|
|
|
#define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL)
|
|
|
|
#define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL)
|
|
|
|
#define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION)
|
|
|
|
#define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS)
|
|
|
|
#define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED)
|
|
|
|
#define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG)
|
|
|
|
#define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT)
|
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
|
|
|
|
/* Line number handling. */
|
1999-05-03 15:29:11 +08:00
|
|
|
extern int text_lineno_number;
|
|
|
|
extern int coff_line_base;
|
|
|
|
extern int coff_n_line_nos;
|
2005-03-16 22:57:00 +08:00
|
|
|
extern symbolS *coff_last_function;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define obj_emit_lineno(WHERE, LINE, FILE_START) abort ()
|
|
|
|
#define obj_app_file(name, app) c_dot_file_symbol (name, app)
|
|
|
|
#define obj_frob_symbol(S,P) coff_frob_symbol (S, & P)
|
|
|
|
#define obj_frob_section(S) coff_frob_section (S)
|
|
|
|
#define obj_frob_file_after_relocs() coff_frob_file_after_relocs ()
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifndef obj_adjust_symtab
|
2005-03-16 22:57:00 +08:00
|
|
|
#define obj_adjust_symtab() coff_adjust_symtab ()
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Forward the segment of a forwarded symbol, handle assignments that
|
|
|
|
just copy symbol values, etc. */
|
2000-02-01 03:13:47 +08:00
|
|
|
#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifndef TE_I386AIX
|
2005-03-16 22:57:00 +08:00
|
|
|
#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \
|
1999-05-03 15:29:11 +08:00
|
|
|
(SF_GET_GET_SEGMENT (dest) \
|
|
|
|
? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \
|
|
|
|
: 0)
|
|
|
|
#else
|
2005-03-16 22:57:00 +08:00
|
|
|
#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \
|
1999-05-03 15:29:11 +08:00
|
|
|
(SF_GET_GET_SEGMENT (dest) && S_GET_SEGMENT (dest) == SEG_UNKNOWN \
|
|
|
|
? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \
|
|
|
|
: 0)
|
|
|
|
#endif
|
2000-02-01 03:13:47 +08:00
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-02-01 01:33:08 +08:00
|
|
|
/* Sanity check. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-01-27 06:48:31 +08:00
|
|
|
extern const pseudo_typeS coff_pseudo_table[];
|
|
|
|
|
|
|
|
#ifndef obj_pop_insert
|
|
|
|
#define obj_pop_insert() pop_insert (coff_pseudo_table)
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* In COFF, if a symbol is defined using .def/.val SYM/.endef, it's OK
|
|
|
|
to redefine the symbol later on. This can happen if C symbols use
|
|
|
|
a prefix, and a symbol is defined both with and without the prefix,
|
|
|
|
as in start/_start/__start in gcc/libgcc1-test.c. */
|
|
|
|
#define RESOLVE_SYMBOL_REDEFINITION(sym) \
|
|
|
|
(SF_GET_GET_SEGMENT (sym) \
|
|
|
|
? (sym->sy_frag = frag_now, \
|
|
|
|
S_SET_VALUE (sym, frag_now_fix ()), \
|
|
|
|
S_SET_SEGMENT (sym, now_seg), \
|
|
|
|
0) \
|
|
|
|
: 0)
|
|
|
|
|
|
|
|
/* Stabs in a coff file go into their own section. */
|
|
|
|
#define SEPARATE_STAB_SECTIONS 1
|
|
|
|
|
|
|
|
/* We need 12 bytes at the start of the section to hold some initial
|
|
|
|
information. */
|
|
|
|
#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
|
|
|
|
|
1999-09-12 11:44:42 +08:00
|
|
|
/* Store the number of relocations in the section aux entry. */
|
|
|
|
#define SET_SECTION_RELOCS(sec, relocs, n) \
|
|
|
|
SA_SET_SCN_NRELOC (section_symbol (sec), n)
|
|
|
|
|
2005-03-16 22:57:00 +08:00
|
|
|
#define obj_app_file(name, app) c_dot_file_symbol (name, app)
|
|
|
|
|
|
|
|
extern int S_SET_DATA_TYPE (symbolS *, int);
|
|
|
|
extern int S_SET_STORAGE_CLASS (symbolS *, int);
|
|
|
|
extern int S_GET_STORAGE_CLASS (symbolS *);
|
|
|
|
extern void SA_SET_SYM_ENDNDX (symbolS *, symbolS *);
|
|
|
|
extern void coff_add_linesym (symbolS *);
|
|
|
|
extern void c_dot_file_symbol (const char *, int);
|
|
|
|
extern void coff_frob_symbol (symbolS *, int *);
|
|
|
|
extern void coff_adjust_symtab (void);
|
|
|
|
extern void coff_frob_section (segT);
|
|
|
|
extern void coff_adjust_section_syms (bfd *, asection *, void *);
|
|
|
|
extern void coff_frob_file_after_relocs (void);
|
|
|
|
extern void coff_obj_symbol_new_hook (symbolS *);
|
2005-10-27 15:40:07 +08:00
|
|
|
extern void coff_obj_symbol_clone_hook (symbolS *, symbolS *);
|
2005-03-16 22:57:00 +08:00
|
|
|
extern void coff_obj_read_begin_hook (void);
|
gas/ChangeLog:
* read.c (potable): Add weakref.
(s_weakref): New.
* read.h (s_weakref): Declare.
* struc-symbol.h (struct symbol): Add sy_weakrefr and sy_weakrefd.
* symbols.c (colon): Clear weakrefr.
(symbol_find_exact): Rename to, and reimplement in terms of...
(symbol_find_exact_noref): ... new function.
(symbol_find): Likewise...
(symbol_find_noref): ... ditto.
(resolve_symbol_value): Resolve weakrefr without setting their
values.
(S_SET_WEAK): Call hook.
(S_GET_VALUE): Follow weakref link.
(S_SET_VALUE): Clear weakrefr.
(S_IS_WEAK): Follow weakref link.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): New.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): New.
(symbol_set_value_expression, symbol_set_frag): Clear weakrefr.
(symbol_mark_used): Follow weakref link.
(print_symbol_value_1): Print weak, weakrefr and weakrefd.
* symbols.h (symbol_find_noref, symbol_find_exact_noref): Declare.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): Declare.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): Declare.
* write.c (adust_reloc_syms): Follow weakref link. Do not
complain if target is undefined.
(write_object_file): Likewise. Remove weakrefr symbols. Drop
unreferenced weakrefd symbols.
* config/obj-coff.c (obj_frob_symbol): Do not force WEAKREFD
symbols EXTERNAL.
(pecoff_obj_set_weak_hook, pecoff_obj_clear_weak_hook): New.
* config/obj-coff.h (obj_set_weak_hook, obj_clear_weak_hook): Define.
* doc/as.texinfo: Document weakref.
* doc/internals.texi: Document new struct members, internal
functions and hooks.
gas/testsuite/ChangeLog:
* gas/all/weakref1.s, gas/all/weakref1.d: New test.
* gas/all/weakref1g.d, gas/all/weakref1l.d: New tests.
* gas/all/weakref1u.d, gas/all/weakref1w.d: New tests.
* gas/all/weakref2.s, gas/all/weakref3.s: New tests.
* gas/all/gas.exp: Run new tests.
2005-10-25 01:51:42 +08:00
|
|
|
#ifdef TE_PE
|
|
|
|
extern void pecoff_obj_set_weak_hook (symbolS *);
|
|
|
|
extern void pecoff_obj_clear_weak_hook (symbolS *);
|
|
|
|
#endif
|
2005-03-16 22:57:00 +08:00
|
|
|
extern void obj_coff_section (int);
|
|
|
|
extern segT obj_coff_add_segment (const char *);
|
|
|
|
extern void obj_coff_section (int);
|
|
|
|
extern void c_dot_file_symbol (const char *, int);
|
|
|
|
extern segT s_get_segment (symbolS *);
|
2005-03-17 01:26:21 +08:00
|
|
|
#ifndef tc_coff_symbol_emit_hook
|
2005-03-16 22:57:00 +08:00
|
|
|
extern void tc_coff_symbol_emit_hook (symbolS *);
|
2005-03-17 01:26:21 +08:00
|
|
|
#endif
|
2005-03-16 22:57:00 +08:00
|
|
|
extern void obj_coff_pe_handle_link_once (void);
|
|
|
|
extern void obj_coff_init_stab_section (segT);
|
|
|
|
extern void c_section_header (struct internal_scnhdr *,
|
|
|
|
char *, long, long, long, long,
|
|
|
|
long, long, long, long);
|
2009-08-17 19:45:23 +08:00
|
|
|
extern void obj_coff_seh_do_final (void);
|
|
|
|
|
|
|
|
#ifndef obj_coff_generate_pdata
|
|
|
|
#define obj_coff_generate_pdata obj_coff_seh_do_final
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif /* OBJ_FORMAT_H */
|