aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-05-02 21:26:55 +0000
committerIan Lance Taylor <ian@airs.com>1994-05-02 21:26:55 +0000
commit1b96bdce15535044d1b2b17b0e99c4beab0bf31f (patch)
tree37c8d5c2db680d66233c8da2ad7f0e610c8df53f /gas/write.c
parentb003875b63650aaf307a9c02137dc8bb5337146e (diff)
downloadgdb-1b96bdce15535044d1b2b17b0e99c4beab0bf31f.zip
gdb-1b96bdce15535044d1b2b17b0e99c4beab0bf31f.tar.gz
gdb-1b96bdce15535044d1b2b17b0e99c4beab0bf31f.tar.bz2
* 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.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gas/write.c b/gas/write.c
index 9fa7ba6..000e790 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 ()