diff options
author | Jeff Law <law@redhat.com> | 1994-01-13 20:16:44 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1994-01-13 20:16:44 +0000 |
commit | d025bc7b6f52c380d358a3d3811b603ea22af1c6 (patch) | |
tree | 57e3420924641b1481c23de01b17ba8f7e069d30 /gas/subsegs.c | |
parent | 644df6f6c299668ea71082bc948481ad29d77989 (diff) | |
download | gdb-d025bc7b6f52c380d358a3d3811b603ea22af1c6.zip gdb-d025bc7b6f52c380d358a3d3811b603ea22af1c6.tar.gz gdb-d025bc7b6f52c380d358a3d3811b603ea22af1c6.tar.bz2 |
* subsegs.c (subseg_get): Accept new argument "force_new". If
set then a new segment is always created. All callers changed.
(subseg_force_new): New function. Similar to subseg_new, but
always force a new segment to be created.
Diffstat (limited to 'gas/subsegs.c')
-rw-r--r-- | gas/subsegs.c | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/gas/subsegs.c b/gas/subsegs.c index 6f5f753..0566d0a 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -374,9 +374,9 @@ subseg_set (seg, subseg) /* begin assembly for a new sub-segment */ #else /* BFD_ASSEMBLER */ segT -subseg_new (segname, subseg) +subseg_get (segname, force_new) const char *segname; - subsegT subseg; + int force_new; { segT secptr; segment_info_type *seginfo; @@ -384,13 +384,17 @@ subseg_new (segname, subseg) ? bfd_get_section_name (stdoutput, now_seg) : 0); - if (now_seg_name + if (!force_new + && now_seg_name && (now_seg_name == segname - || !strcmp (now_seg_name, segname)) - && subseg == now_subseg) + || !strcmp (now_seg_name, segname))) return now_seg; - secptr = bfd_make_section_old_way (stdoutput, segname); + if (!force_new) + secptr = bfd_make_section_old_way (stdoutput, segname); + else + secptr = bfd_make_section_anyway (stdoutput, segname); + seginfo = seg_info (secptr); if (! seginfo) { @@ -400,16 +404,48 @@ subseg_new (segname, subseg) seginfo->fix_tail = 0; seginfo->bfd_section = secptr; bfd_set_section_userdata (stdoutput, secptr, (char *) seginfo); - subseg_set_rest (secptr, subseg); - seginfo->frchainP = frchain_now; + seginfo->frchainP = 0; seginfo->lineno_list_head = seginfo->lineno_list_tail = 0; seginfo->sym = 0; seginfo->dot = 0; seginfo->hadone = 0; seginfo->user_stuff = 0; + seginfo->stabu.stab_string_size = 0; } - else - subseg_set_rest (secptr, subseg); + return secptr; +} + +segT +subseg_new (segname, subseg) + const char *segname; + subsegT subseg; +{ + segT secptr; + segment_info_type *seginfo; + + secptr = subseg_get (segname, 0); + subseg_set_rest (secptr, subseg); + seginfo = seg_info (secptr); + if (! seginfo->frchainP) + seginfo->frchainP = frchain_now; + return secptr; +} + +/* Like subseg_new, except a new section is always created, even if + a section with that name already exists. */ +segT +subseg_force_new (segname, subseg) + const char *segname; + subsegT subseg; +{ + segT secptr; + segment_info_type *seginfo; + + secptr = subseg_get (segname, 1); + subseg_set_rest (secptr, subseg); + seginfo = seg_info (secptr); + if (! seginfo->frchainP) + seginfo->frchainP = frchain_now; return secptr; } @@ -422,6 +458,25 @@ subseg_set (secptr, subseg) subseg_set_rest (secptr, subseg); } +symbolS * +section_symbol (sec) + segT sec; +{ + segment_info_type *seginfo = seg_info (sec); + + if (seginfo == 0) + abort (); + if (seginfo->sym) + return seginfo->sym; + seginfo->sym = symbol_find (sec->name); + if (!seginfo->sym) + { + seginfo->sym = symbol_make (sec->name); + seginfo->sym->bsym = sec->symbol; + } + return seginfo->sym; +} + #endif /* BFD_ASSEMBLER */ /* end of subsegs.c */ |