Commit Graph

15 Commits

Author SHA1 Message Date
Ken Raeburn d19dcb6715 Use one active frag and one obstack per frag chain:
* frags.c (frags): Variable deleted.
(frag_alloc): New function.
(frag_grow, frag_more, frag_variant, frag_now_fix, frag_append_1_char): Refer
to frchain_now->frch_obstack instead of frags variable.
(frag_new): Ditto.  Verify that frch_last and frag_now match on entry and exit,
and that old frag_now has non-zero type.  Replace "know" uses with "assert".
Use frag_alloc instead of mucking with obstack alignment.
* frags.h (frags): Declaration deleted.
* subsegs.h (struct frchain): Add new field frch_frag_now.
* subsegs.c (frchains, dummy_frag, absolute_frchain): New static variables.
(subsegs_begin): Initialize frchains obstack.  Under gcc, don't give it any
stricter alignment than frchainS structures need.  Do not initialize frags
obstack.  Set frag_now to point to dummy_obstack.  Initialize absolute_frchain.
(subseg_set_rest): Save and restore frag_now in frch_frag_now field of
frchainS.  Don't create new frags on section switch, and use frag_alloc when
creating a new frag chain.  For absolute section, set frchain_now to
absolute_frchain.  Verify that frch_last and frag_now match on entry and exit.
Initialize per-chain obstack, and under gcc, set required alignment to that
needed by fragS structure.
* write.c (chain_frchains_together_1): Verify fr_type is nonzero.

In one test case of Mike's (i386-linux, over 300K lines of .s code with lots
of stabs records), run time and memory use are reduced by about 1/3.

Might introduce some problems in cases that use the frag obstacks in unusual
ways.  Test suite does pass for i386-linux and sparc-solaris targets though.
1995-10-18 21:21:38 +00:00
Ian Lance Taylor 1356d77df3 * struc-symbol.h (struct symbol): Add sy_mri_common bit.
* read.h (mri_comon_symbol): Declare.
	(s_mri_common): Declare.
	* read.c (mri_line_label): New static variable.
	(mri_common_symbol): New global variable.
	(potable): Add "common" and "common.s".
	(read_a_source_file): In MRI mode, set mri_line_label for a label
	at the start of a line.
	(s_mri_common): New function.
	(s_space): Handle mri_common_symbol.
	* symbols.c (colon): Change return value from void to symbolS *,
	and return new symbol.  If mri_common_symbol is set, attach the
	new symbol to it.
	(resolve_symbol_value): Handle an sy_mri_common symbol.
	* symbols.h (colon): Change return value in declaration.
	* subsegs.c (subseg_set_rest): Clear mri_common_symbol.
	(subseg_set (both versions)): Likewise.
	* frags.c (frag_more): Warn if mri_common_symbol is not NULL.
	* write.c (adjust_reloc_syms): Skip sy_mri_common symbols.
	(write_object_file): Discard sy_mri_common symbols.
	(fixup_segment): Change relocations against sy_mri_common symbols
	to be against the common symbol itself.
	* config/obj-coff.c (yank_symbols): Discard sy_mri_common symbols.
	(fixup_segment): Change relocations against sy_mri_common symbols
	to be against the common symbol itself.
	* config/obj-aout.c (obj_crawl_symbol_chain): Discard
	sy_mri_common symbols.
1995-08-08 21:41:30 +00:00
Ken Raeburn 3b6d6f715f * config/obj-aout.c (obj_aout_frob_symbol): Use bfd_ind_section_ptr and
bfd_und_section_ptr.

* subsegs.c (subseg_set_rest): Compare segT values directly, without casting to
int first.
1994-07-14 18:40:36 +00:00
Ken Raeburn 3c498933ab Updated some copyrights, cleaned up some header-file comments, and:
* symbols.c (symbol_create): New function, most of the guts of the old
symbol_new function.
(symbol_new): Now just checks symbol_table_frozen, calls symbol_create, and
enters the symbol into the symbol table.
* subsegs.c (section_symbol): If EMIT_SECTION_SYMBOLS is not true, and the
symbol table is frozen, call symbol_create instead of symbol_new.
* symbols.h (symbol_create, symbol_table_frozen): Declare.

* symbols.c (symbol_clear_list_pointers): Always a function now.
* struc-symbol.h (symbol_clear_list_pointers): Deleted macro version.

* symbols.c (debug_verify_symchain): New macro, defined to be
verify_symbol_chain or a cast to void, depending on DEBUG_SYMS.
(many functions): Invoke debug_verify_symchain unconditionally.
1994-07-13 01:48:15 +00:00
Ian Lance Taylor dff770c8d6 * subsegs.c (abs_seg_info, und_seg_info): Define if BFD_ASSEMBLER.
(subseg_change): Store seg_info for bfd_abs_section_ptr in
	abs_seg_info, and store seg_info for bfd_und_section_ptr in
	und_seg_info.
	(subseg_get): Likewise.  Also, don't set output_section if it is
	already set.
	(seg_info): Define as function.
	* subsegs.h (seg_info): Declare as function rather than defining
	as macro.
	* write.c (relax_and_size_seg): Call seg_info rather than
	bfd_get_section_userdata.
1994-06-21 16:45:09 +00:00
Stan Shebs cc886e3d1e Tue Apr 12 18:25:13 1994 Stan Shebs (shebs@andros.cygnus.com)
* subsegs.c (subsegs_begin): Call memset with args in the correct
	order.
	(subseg_get): Clear newly allocated seginfo, set its pointer slots
	to NULL instead of 0.

Fixes a problem observed in sparc-lynx progressive.
1994-04-13 02:02:48 +00:00
Jeff Law d025bc7b6f * subsegs.c (subseg_get): Accept new argument "force_new". If
set then a new segment is always created.  All callers changed.
        (subseg_force_new): New function.  Similar to subseg_new, but
        always force a new segment to be created.
1994-01-13 20:16:44 +00:00
Ian Lance Taylor 604633aeca * subsegs.c: Renamed non-BFD_ASSEMBLER subseg_new to subseg_set.
Wrote non-BFD_ASSEMBLER subseg_new.  Now subseg_new always takes a
	section name, and subseg_set always takes a segT.  Changed all
	callers as appropriate.
	* config/obj-coffbfd.c 	(change_to_section): Renamed to
	obj_coff_add_segment.  Corrected.  Made callers use subseg_new.
	* config/obj-coffbfd.h (obj_segment_name, obj_add_segment):
	Define.

Also some more gcc warning removal.
1993-09-13 21:32:07 +00:00
Steve Chamberlain 65bfcf2e61 * subsegs.c (subsegs_begin): create bss0_frchainP in the same was
as data0_frchainP

	* write.c (write_object_file): various changes to handle data in
	the BSS segment in much the same was as stuff in the DATA segment.

	* subsegs.c (subseg_change): allow and handle a change into SEG_BSS.
1992-06-09 19:36:49 +00:00
Steve Chamberlain 90d4945716 * subsegs.c (subseg_change): allow and handle a change into SEG_BSS. 1992-06-09 14:57:23 +00:00
Steve Chamberlain f8701a3ff8 Thu Jun 4 11:59:13 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* expr.c(expr): allow SEG_REGISTER in expressions.
	* read.c(pseudo_set): register expressions can be the source of a
	set.
	* subsegs.c (subseg_new): Now -R forces all changes to SEG_DATA to
	goto SEG_TEXT (if a.out)
	* write.c (write_object_file): If a.out don't use the old way for
	-R.
	* config/obj-a.out (s_sect): complain if the user tries to use a
	subsegment with a value which might interfere with out -R hackery.
	* config/tc-m68k.c (m68k_reg_parse): lookup names in symbol table
	rather than use ugly if tree. (init_regtable): insert register
	names into symbol table.
1992-06-04 19:21:58 +00:00
K. Richard Pixley 6d5460ab89 changes from Minh Tran-Le <TRANLE@INTELLICORP.COM> to support i386
coff as it appears to be used on aix386.
1992-02-21 11:04:51 +00:00
K. Richard Pixley 8b228fe958 force all files to end in "/* end of filename" 1992-02-13 09:13:54 +00:00
K. Richard Pixley a39116f1c9 White space and comments only. The devo tree prior to this delta is
tagged as "vanilla" for your convenience.

There are also some comment changes.
1992-02-13 08:33:54 +00:00
K. Richard Pixley fecd2382e7 Initial revision 1991-04-04 18:19:53 +00:00