From 1b96bdce15535044d1b2b17b0e99c4beab0bf31f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 2 May 1994 21:26:55 +0000 Subject: [PATCH] * subsegs.h (segment_info_type): Use fix_tail field even if BFD_ASSEMBLER. * subsegs.c (subseg_change): Initialize fix_tail field. (subseg_get): Likewise. * write.c (frags_chained): New static variable. (fix_new_internal): If frags_chained is set, use fix_root and fix_tail from seg_info (now_seg), rather than frchain_now. (chain_frchains_together_1): Set fix_tail field. (chain_frchains_together): Set frags_chained. --- gas/ChangeLog | 12 ++++++++++++ gas/write.c | 23 +++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 42800e739aa..e260cb3538d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +Mon May 2 17:09:24 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * subsegs.h (segment_info_type): Use fix_tail field even if + BFD_ASSEMBLER. + * subsegs.c (subseg_change): Initialize fix_tail field. + (subseg_get): Likewise. + * write.c (frags_chained): New static variable. + (fix_new_internal): If frags_chained is set, use fix_root and + fix_tail from seg_info (now_seg), rather than frchain_now. + (chain_frchains_together_1): Set fix_tail field. + (chain_frchains_together): Set frags_chained. + Thu Apr 28 01:39:15 1994 Ken Raeburn (raeburn@kr-pc.cygnus.com) * config/tc-mips.c (s_option): Only refer to g_switch_* variables diff --git a/gas/write.c b/gas/write.c index 9fa7ba6a0ff..000e7907213 100644 --- a/gas/write.c +++ b/gas/write.c @@ -45,6 +45,14 @@ extern CONST int md_long_jump_size; int symbol_table_frozen; +#ifdef BFD_ASSEMBLER +/* We generally attach relocs to frag chains. However, after we have + chained these all together into a segment, any relocs we add after + that must be attached to a segment. This will include relocs added + in md_estimate_size_for_relax, for example. */ +static int frags_chained = 0; +#endif + #ifndef BFD_ASSEMBLER #ifndef MANY_SEGMENTS @@ -144,8 +152,12 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel, { #ifdef BFD_ASSEMBLER - fixS **seg_fix_rootP = &frchain_now->fix_root; - fixS **seg_fix_tailP = &frchain_now->fix_tail; + fixS **seg_fix_rootP = (frags_chained + ? &seg_info (now_seg)->fix_root + : &frchain_now->fix_root); + fixS **seg_fix_tailP = (frags_chained + ? &seg_info (now_seg)->fix_tail + : &frchain_now->fix_tail); #endif #ifdef REVERSE_SORT_RELOCS @@ -301,6 +313,7 @@ chain_frchains_together_1 (section, frchp) if (seg_info (section)->fix_root == (fixS *) NULL) seg_info (section)->fix_root = frchp->fix_root; prev_fix->fx_next = frchp->fix_root; + seg_info (section)->fix_tail = frchp->fix_tail; prev_fix = frchp->fix_tail; } #endif @@ -327,6 +340,10 @@ chain_frchains_together (abfd, section, xxx) if (info != (segment_info_type *) NULL) info->frchainP->frch_last = chain_frchains_together_1 (section, info->frchainP); + + /* Now that we've chained the frags together, we must add new fixups + to the segment, not to the frag chain. */ + frags_chained = 1; } #endif @@ -972,6 +989,7 @@ relax_and_size_all_segments () #if defined (BFD_ASSEMBLER) || !defined (BFD) +#ifdef BFD_ASSEMBLER static void set_symtab () { @@ -1007,6 +1025,7 @@ set_symtab () assert (result == true); symbol_table_frozen = 1; } +#endif void write_object_file () -- 2.30.2