1999-05-03 09:29:11 +02:00
|
|
|
/* subsegs.h -> subsegs.c
|
2014-03-05 12:46:15 +01:00
|
|
|
Copyright (C) 1987-2014 Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02: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 published by
|
2007-07-03 13:01:12 +02:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 09:29:11 +02: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 11:13:19 +02:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For every sub-segment the user mentions in the ASsembler program,
|
|
|
|
* we make one struct frchain. Each sub-segment has exactly one struct frchain
|
|
|
|
* and vice versa.
|
|
|
|
*
|
|
|
|
* Struct frchain's are forward chained (in ascending order of sub-segment
|
|
|
|
* code number). The chain runs through frch_next of each subsegment.
|
|
|
|
* This makes it hard to find a subsegment's frags
|
|
|
|
* if programmer uses a lot of them. Most programs only use text0 and
|
|
|
|
* data0, so they don't suffer. At least this way:
|
|
|
|
* (1) There are no "arbitrary" restrictions on how many subsegments
|
|
|
|
* can be programmed;
|
|
|
|
* (2) Subsegments' frchain-s are (later) chained together in the order in
|
|
|
|
* which they are emitted for object file viz text then data.
|
|
|
|
*
|
|
|
|
* From each struct frchain dangles a chain of struct frags. The frags
|
|
|
|
* represent code fragments, for that sub-segment, forward chained.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "obstack.h"
|
|
|
|
|
* subsegs.h (struct frchain): Add frch_cfi_data field.
* dw2gencfi.c: Include subsegs.h.
(cur_fde_data, last_address, cur_cfa_offset, cfa_save_stack): Removed.
(struct frch_cfi_data): New type.
(unused_cfi_data): New variable.
(alloc_fde_entry): Move cur_fde_data, last_address, cur_cfa_offset
and cfa_save_stack static vars into a structure pointed from
each frchain.
(alloc_cfi_insn_data, cfi_new_fde, cfi_end_fde, cfi_set_return_column,
cfi_add_advance_loc, cfi_add_CFA_def_cfa, cfi_add_CFA_def_cfa_offset,
cfi_add_CFA_remember_state, cfi_add_CFA_restore_state, dot_cfi,
dot_cfi_escape, dot_cfi_startproc, dot_cfi_endproc, cfi_finish):
Likewise.
* gas/cfi/cfi-common-5.d: New test.
* gas/cfi/cfi-common-5.s: New.
* gas/cfi/cfi.exp: Add cfi-common-5 test.
2006-11-03 08:27:39 +01:00
|
|
|
struct frch_cfi_data;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
struct frchain /* control building of a frag chain */
|
|
|
|
{ /* FRCH = FRagment CHain control */
|
|
|
|
struct frag *frch_root; /* 1st struct frag in chain, or NULL */
|
|
|
|
struct frag *frch_last; /* last struct frag in chain, or NULL */
|
|
|
|
struct frchain *frch_next; /* next in chain of struct frchain-s */
|
|
|
|
subsegT frch_subseg; /* subsegment number of this chain */
|
|
|
|
fixS *fix_root; /* Root of fixups for this subsegment. */
|
|
|
|
fixS *fix_tail; /* Last fixup for this subsegment. */
|
|
|
|
struct obstack frch_obstack; /* for objects in this frag chain */
|
|
|
|
fragS *frch_frag_now; /* frag_now for this subsegment */
|
* subsegs.h (struct frchain): Add frch_cfi_data field.
* dw2gencfi.c: Include subsegs.h.
(cur_fde_data, last_address, cur_cfa_offset, cfa_save_stack): Removed.
(struct frch_cfi_data): New type.
(unused_cfi_data): New variable.
(alloc_fde_entry): Move cur_fde_data, last_address, cur_cfa_offset
and cfa_save_stack static vars into a structure pointed from
each frchain.
(alloc_cfi_insn_data, cfi_new_fde, cfi_end_fde, cfi_set_return_column,
cfi_add_advance_loc, cfi_add_CFA_def_cfa, cfi_add_CFA_def_cfa_offset,
cfi_add_CFA_remember_state, cfi_add_CFA_restore_state, dot_cfi,
dot_cfi_escape, dot_cfi_startproc, dot_cfi_endproc, cfi_finish):
Likewise.
* gas/cfi/cfi-common-5.d: New test.
* gas/cfi/cfi-common-5.s: New.
* gas/cfi/cfi.exp: Add cfi-common-5 test.
2006-11-03 08:27:39 +01:00
|
|
|
struct frch_cfi_data *frch_cfi_data;
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct frchain frchainS;
|
|
|
|
|
|
|
|
/* Frchain we are assembling into now. That is, the current segment's
|
2000-09-12 22:57:14 +02:00
|
|
|
frag chain, even if it contains no (complete) frags. */
|
1999-05-03 09:29:11 +02:00
|
|
|
extern frchainS *frchain_now;
|
|
|
|
|
2000-11-07 02:18:45 +01:00
|
|
|
typedef struct segment_info_struct {
|
1999-05-03 09:29:11 +02:00
|
|
|
frchainS *frchainP;
|
|
|
|
unsigned int hadone : 1;
|
|
|
|
|
|
|
|
/* This field is set if this is a .bss section which does not really
|
|
|
|
have any contents. Once upon a time a .bss section did not have
|
|
|
|
any frags, but that is no longer true. This field prevent the
|
|
|
|
SEC_HAS_CONTENTS flag from being set for the section even if
|
|
|
|
there are frags. */
|
|
|
|
unsigned int bss : 1;
|
|
|
|
|
|
|
|
int user_stuff;
|
|
|
|
|
* README-vms: Delete.
* config-gas.com: Delete.
* makefile.vms: Delete.
* vmsconf.sh: Delete.
* config/atof-tahoe.c: Delete.
* config/m88k-opcode.h: Delete.
* config/obj-bout.c: Delete.
* config/obj-bout.h: Delete.
* config/obj-hp300.c: Delete.
* config/obj-hp300.h: Delete.
* config/tc-a29k.c: Delete.
* config/tc-a29k.h: Delete.
* config/tc-h8500.c: Delete.
* config/tc-h8500.h: Delete.
* config/tc-m88k.c: Delete.
* config/tc-m88k.h: Delete.
* config/tc-tahoe.c: Delete.
* config/tc-tahoe.h: Delete.
* config/tc-tic80.c: Delete.
* config/tc-tic80.h: Delete.
* config/tc-w65.c: Delete.
* config/tc-w65.h: Delete.
* config/te-aux.h: Delete.
* config/te-delt88.h: Delete.
* config/te-delta.h: Delete.
* config/te-dpx2.h: Delete.
* config/te-hp300.h: Delete.
* config/te-ic960.h: Delete.
* config/vms-a-conf.h: Delete.
* doc/c-a29k.texi: Delete.
* doc/c-h8500.texi: Delete.
* doc/c-m88k.texi: Delete.
* README: Remove obsolete examples, and list of supported targets.
* Makefile.am: Remove a29k, h8500, m88k, tahoe, tic80, w65,
bout and hp300 support.
(DEP_FLAGS): Don't define BFD_ASSEMBLER.
* configure.in: Remove --enable-bfd-assembler, need_bfd,
primary_bfd_gas.
* configure.tgt: Remove a29k, h8300-coff, h8500-*, i960 non-elf,
m68k non bfd, m88k, or32-coff, tic80-*, vax non-bfd, w65k-*, *-nindy.
* as.c: Remove all non-BFD_ASSEMBLER code, support for above targets.
* as.h: Likewise.
* dw2gencfi.c: Likewise.
* dwarf2dbg.c: Likewise.
* ehopt.c: Likewise.
* input-file.c: Likewise.
* listing.c: Likewise.
* literal.c: Likewise.
* messages.c: Likewise.
* obj.h: Likewise.
* output-file.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.
* struc-symbol.h: Likewise.
* subsegs.c: Likewise.
* subsegs.h: Likewise.
* symbols.c: Likewise.
* symbols.h: Likewise.
* tc.h: Likewise.
* write.c: Likewise.
* write.h: Likewise.
* config/aout_gnu.h: Likewise.
* config/obj-aout.c: Likewise.
* config/obj-aout.h: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-coff.h: Likewise.
* config/obj-evax.h: Likewise.
* config/obj-ieee.h: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-arm.h: Likewise.
* config/tc-avr.c: Likewise.
* config/tc-avr.h: Likewise.
* config/tc-crx.h: Likewise.
* config/tc-d10v.h: Likewise.
* config/tc-d30v.h: Likewise.
* config/tc-dlx.h: Likewise.
* config/tc-fr30.h: Likewise.
* config/tc-frv.h: Likewise.
* config/tc-h8300.c: Likewise.
* config/tc-h8300.h: Likewise.
* config/tc-hppa.h: Likewise.
* config/tc-i370.h: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i386.h: Likewise.
* config/tc-i860.h: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-i960.h: Likewise.
* config/tc-ip2k.h: Likewise.
* config/tc-iq2000.h: Likewise.
* config/tc-m32c.h: Likewise.
* config/tc-m32r.h: Likewise.
* config/tc-m68hc11.h: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-m68k.h: Likewise.
* config/tc-maxq.c: Likewise.
* config/tc-maxq.h: Likewise.
* config/tc-mcore.c: Likewise.
* config/tc-mcore.h: Likewise.
* config/tc-mn10200.h: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-mn10300.h: Likewise.
* config/tc-ms1.h: Likewise.
* config/tc-msp430.c: Likewise.
* config/tc-msp430.h: Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-ns32k.h: Likewise.
* config/tc-openrisc.h: Likewise.
* config/tc-or32.c: Likewise.
* config/tc-or32.h: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-ppc.h: Likewise.
* config/tc-s390.h: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-sh.h: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-tic30.c: Likewise.
* config/tc-tic30.h: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic4x.h: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-tic54x.h: Likewise.
* config/tc-v850.h: Likewise.
* config/tc-vax.c: Likewise.
* config/tc-vax.h: Likewise.
* config/tc-xstormy16.h: Likewise.
* config/tc-xtensa.h: Likewise.
* config/tc-z8k.c: Likewise.
* config/tc-z8k.h: Likewise.
* config/vms-a-conf.h
* doc/Makefile.am: Likewise.
* doc/all.texi: Likewise.
* doc/as.texinfo: Likewise.
* doc/Makefile.in: Regenerate.
* Makefile.in: Regenerate.
* configure: Regenerate.
* config.in: Regenerate.
* po/POTFILES.in: Regenerate.
2005-08-11 03:25:29 +02:00
|
|
|
/* Fixups for this segment. This is only valid after the frchains
|
|
|
|
are run together. */
|
1999-05-03 09:29:11 +02:00
|
|
|
fixS *fix_root;
|
|
|
|
fixS *fix_tail;
|
|
|
|
|
|
|
|
symbolS *dot;
|
|
|
|
|
|
|
|
struct lineno_list *lineno_list_head;
|
|
|
|
struct lineno_list *lineno_list_tail;
|
|
|
|
|
|
|
|
/* Which BFD section does this gas segment correspond to? */
|
|
|
|
asection *bfd_section;
|
|
|
|
|
|
|
|
/* NULL, or pointer to the gas symbol that is the section symbol for
|
|
|
|
this section. sym->bsym and bfd_section->symbol should be the same. */
|
|
|
|
symbolS *sym;
|
|
|
|
|
2000-11-07 02:18:45 +01:00
|
|
|
union {
|
|
|
|
/* Current size of section holding stabs strings. */
|
|
|
|
unsigned long stab_string_size;
|
|
|
|
/* Initial frag for ELF. */
|
|
|
|
char *p;
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
stabu;
|
|
|
|
|
|
|
|
#ifdef NEED_LITERAL_POOL
|
|
|
|
unsigned long literal_pool_size;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_SEGMENT_INFO_TYPE
|
|
|
|
TC_SEGMENT_INFO_TYPE tc_segment_info_data;
|
|
|
|
#endif
|
|
|
|
} segment_info_type;
|
|
|
|
|
2006-05-04 01:52:15 +02:00
|
|
|
|
|
|
|
#define seg_info(sec) \
|
|
|
|
((segment_info_type *) bfd_get_section_userdata (stdoutput, sec))
|
|
|
|
|
2003-12-03 04:39:58 +01:00
|
|
|
extern symbolS *section_symbol (segT);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2003-12-03 04:39:58 +01:00
|
|
|
extern void subsegs_print_statistics (FILE *);
|