* subsegs.h (segment_info_type): Use fix_tail field even if
authorIan Lance Taylor <ian@airs.com>
Mon, 2 May 1994 21:26:55 +0000 (21:26 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 2 May 1994 21:26:55 +0000 (21:26 +0000)
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
gas/write.c

index 42800e739aad696dca1c2f700f49f7bc09803d9a..e260cb3538d1fcbb6c98af57e6ee4e6b95e62760 100644 (file)
@@ -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
index 9fa7ba6a0ffa30d6668af305161e49dd7597b6da..000e7907213ccbddec2ba630c0e45ae9553114c9 100644 (file)
@@ -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 ()