aboutsummaryrefslogtreecommitdiff
path: root/gas/subsegs.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-08-08 21:41:30 +0000
committerIan Lance Taylor <ian@airs.com>1995-08-08 21:41:30 +0000
commit1356d77df3d5860b008035d6ad2f4f1f7093b0fe (patch)
treed866efd6be56cdd01d68b15d4c1e94755dfff025 /gas/subsegs.c
parent7aaec27bc740ff6c5a1377744ec0faac6edca74a (diff)
downloadgdb-1356d77df3d5860b008035d6ad2f4f1f7093b0fe.zip
gdb-1356d77df3d5860b008035d6ad2f4f1f7093b0fe.tar.gz
gdb-1356d77df3d5860b008035d6ad2f4f1f7093b0fe.tar.bz2
* 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.
Diffstat (limited to 'gas/subsegs.c')
-rw-r--r--gas/subsegs.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/gas/subsegs.c b/gas/subsegs.c
index 5ce2e9e..e360d32 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -16,7 +16,7 @@
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 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
* Segments & sub-segments.
@@ -38,7 +38,7 @@ segment_info_type segment_info[SEG_MAXIMUM_ORDINAL];
frchainS *data0_frchainP, *bss0_frchainP;
#endif /* MANY_SEGMENTS */
-char *const seg_name[] =
+char const *const seg_name[] =
{
"absolute",
#ifdef MANY_SEGMENTS
@@ -87,7 +87,6 @@ subsegs_begin ()
know (SEG_MAXIMUM_ORDINAL == SEG_REGISTER);
#endif
- obstack_begin (&frags, 5000);
frchain_root = NULL;
frchain_now = NULL; /* Warn new_subseg() that we are booting. */
/* Fake up 1st frag. It won't be used=> is ok if obstack...
@@ -198,7 +197,7 @@ subseg_set_rest (seg, subseg)
if (frag_now) /* If not bootstrapping. */
{
- frag_now->fr_fix = (char*) obstack_next_free (&frags) - frag_now->fr_literal;
+ frag_now->fr_fix = frag_now_fix ();
frag_wane (frag_now); /* Close off any frag in old subseg. */
}
/*
@@ -261,22 +260,22 @@ subseg_set_rest (seg, subseg)
* This should be the only code that creates a frchainS.
*/
newP = (frchainS *) obstack_alloc (&frags, sizeof (frchainS));
- memset (newP, 0, sizeof (frchainS));
- /* This begines on a good boundary because a obstack_done()
- preceeded it. It implies an obstack_done(), so we expect
- the next object allocated to begin on a correct boundary. */
- *lastPP = newP;
- newP->frch_next = frcP; /* perhaps NULL */
- (frcP = newP)->frch_subseg = subseg;
+ newP->frch_root = 0;
+ newP->frch_subseg = subseg;
newP->frch_seg = seg;
newP->frch_last = NULL;
#ifdef BFD_ASSEMBLER
newP->fix_root = NULL;
newP->fix_tail = NULL;
#endif
+ obstack_begin (&newP->frch_obstack, 5000);
+
+ *lastPP = newP;
+ newP->frch_next = frcP; /* perhaps NULL */
+ frcP = newP;
}
/*
- * Here with frcP ->ing to the frchainS for subseg.
+ * Here with frcP pointing to the frchainS for subseg.
*/
frchain_now = frcP;
/*
@@ -308,6 +307,8 @@ subseg_set_rest (seg, subseg)
frcP->frch_root = new_fragP;
}
frcP->frch_last = new_fragP;
+
+ mri_common_symbol = NULL;
}
/*
@@ -385,6 +386,7 @@ subseg_set (seg, subseg) /* begin assembly for a new sub-segment */
{ /* we just changed sub-segments */
subseg_set_rest (seg, subseg);
}
+ mri_common_symbol = NULL;
}
#else /* BFD_ASSEMBLER */
@@ -478,6 +480,7 @@ subseg_set (secptr, subseg)
{
if (! (secptr == now_seg && subseg == now_subseg))
subseg_set_rest (secptr, subseg);
+ mri_common_symbol = NULL;
}
#ifndef obj_sec_sym_ok_for_reloc
@@ -516,14 +519,15 @@ section_symbol (sec)
#define EMIT_SECTION_SYMBOLS 1
#endif
- if (EMIT_SECTION_SYMBOLS
+ if (! EMIT_SECTION_SYMBOLS
#ifdef BFD_ASSEMBLER
&& symbol_table_frozen
#endif
)
- s = symbol_new (sec->name, sec, 0, &zero_address_frag);
- else
+ /* Here we know it won't be going into the symbol table. */
s = symbol_create (sec->name, sec, 0, &zero_address_frag);
+ else
+ s = symbol_new (sec->name, sec, 0, &zero_address_frag);
S_CLEAR_EXTERNAL (s);
/* Use the BFD section symbol, if possible. */