}
/* Allocate a frag on the specified obstack.
- Call this routine from everywhere else, so that all the weird alignment
- hackery can be done in just one place. */
+ Call this routine every time a new frag is made, so that the
+ alignment hackery can be done in just one place. */
fragS *
frag_alloc (struct obstack *ob, size_t extra)
fragS *ptr;
int oalign;
- (void) obstack_alloc (ob, 0);
+ /* This will align the obstack so the next struct we allocate on it
+ will begin at a correct boundary. */
+ (void) obstack_finish (ob);
+ /* Turn off alignment as otherwise obstack_alloc will align the end
+ of the frag (obstack next_free pointer), making it seem like the
+ frag already has contents in fr_literal. */
oalign = obstack_alignment_mask (ob);
obstack_alignment_mask (ob) = 0;
ptr = obstack_alloc (ob, extra + SIZEOF_STRUCT_FRAG);
/* Make sure its type is valid. */
gas_assert (frag_now->fr_type != 0);
- /* This will align the obstack so the next struct we allocate on it
- will begin at a correct boundary. */
- obstack_finish (&frchain_now->frch_obstack);
frchP = frchain_now;
know (frchP);
former_last_fragP = frchP->frch_last;
avail_out = obstack_room (ob);
if (avail_out <= 0)
{
- obstack_finish (ob);
f = frag_alloc (ob, 0);
f->fr_type = rs_fill;
(*last_newf)->fr_next = f;
avail_out = obstack_room (ob);
if (avail_out <= 0)
{
- fragS *newf;
-
- obstack_finish (ob);
- newf = frag_alloc (ob, 0);
+ fragS *newf = frag_alloc (ob, 0);
newf->fr_type = rs_fill;
last_newf->fr_next = newf;
last_newf = newf;