"register",
"",
}; /* Used by error reporters, dumpers etc. */
+#else /* BFD_ASSEMBLER */
+
+/* Gas segment information for bfd_abs_section_ptr and
+ bfd_und_section_ptr. */
+static segment_info_type *abs_seg_info;
+static segment_info_type *und_seg_info;
+
#endif /* BFD_ASSEMBLER */
static void subseg_set_rest PARAMS ((segT, subsegT));
if (! seginfo)
{
seginfo = (segment_info_type *) xmalloc (sizeof (*seginfo));
- if (! seginfo)
- abort ();
- seginfo->fix_root = 0;
+ memset ((PTR) seginfo, 0, sizeof (*seginfo));
+ seginfo->fix_root = NULL;
+ seginfo->fix_tail = NULL;
seginfo->bfd_section = seg;
seginfo->sym = 0;
- bfd_set_section_userdata (stdoutput, seg, (char *) seginfo);
+ if (seg == bfd_abs_section_ptr)
+ abs_seg_info = seginfo;
+ else if (seg == bfd_und_section_ptr)
+ und_seg_info = seginfo;
+ else
+ bfd_set_section_userdata (stdoutput, seg, (PTR) seginfo);
}
}
#else
* position of chain rooted in frchain_root.
*/
for (frcP = *(lastPP = &frchain_root);
- frcP && (int) (frcP->frch_seg) <= (int) seg;
+ frcP && frcP->frch_seg <= seg;
frcP = *(lastPP = &frcP->frch_next))
{
- if ((int) (frcP->frch_seg) == (int) seg
+ if (frcP->frch_seg == seg
&& frcP->frch_subseg >= subseg)
{
break;
*
*/
if (!frcP
- || ((int) (frcP->frch_seg) > (int) seg
+ || (frcP->frch_seg > seg
|| frcP->frch_subseg > subseg)) /* Kinky logic only works with 2 segments. */
{
/*
seginfo = seg_info (secptr);
if (! seginfo)
{
- secptr->output_section = secptr;
+ /* Check whether output_section is set first because secptr may
+ be bfd_abs_section_ptr. */
+ if (secptr->output_section != secptr)
+ secptr->output_section = secptr;
seginfo = (segment_info_type *) xmalloc (sizeof (*seginfo));
- memset ((char *) seginfo, 0, sizeof(seginfo));
+ memset ((PTR) seginfo, 0, sizeof (*seginfo));
seginfo->fix_root = NULL;
+ seginfo->fix_tail = NULL;
seginfo->bfd_section = secptr;
- bfd_set_section_userdata (stdoutput, secptr, (char *) seginfo);
+ if (secptr == bfd_abs_section_ptr)
+ abs_seg_info = seginfo;
+ else if (secptr == bfd_und_section_ptr)
+ und_seg_info = seginfo;
+ else
+ bfd_set_section_userdata (stdoutput, secptr, (PTR) seginfo);
seginfo->frchainP = NULL;
seginfo->lineno_list_head = seginfo->lineno_list_tail = NULL;
seginfo->sym = NULL;
#define obj_sec_sym_ok_for_reloc(SEC) 0
#endif
+/* Get the gas information we are storing for a section. */
+
+segment_info_type *
+seg_info (sec)
+ segT sec;
+{
+ if (sec == bfd_abs_section_ptr)
+ return abs_seg_info;
+ else if (sec == bfd_und_section_ptr)
+ return und_seg_info;
+ else
+ return (segment_info_type *) bfd_get_section_userdata (stdoutput, sec);
+}
+
symbolS *
section_symbol (sec)
segT sec;
s = symbol_find (sec->name);
if (!s)
{
- s = symbol_new (sec->name, sec, 0, &zero_address_frag);
+#ifndef EMIT_SECTION_SYMBOLS
+#define EMIT_SECTION_SYMBOLS 1
+#endif
+
+ if (EMIT_SECTION_SYMBOLS
+#ifdef BFD_ASSEMBLER
+ && symbol_table_frozen
+#endif
+ )
+ s = symbol_new (sec->name, sec, 0, &zero_address_frag);
+ else
+ s = symbol_create (sec->name, sec, 0, &zero_address_frag);
S_CLEAR_EXTERNAL (s);
/* Use the BFD section symbol, if possible. */