Skip to content

Commit d09f4d4

Browse files
committed
gas s_fill caused internal error in frag_new
Fix an internal error after "non-constant fill count for absolute section". * read.c (s_fill): Don't create frags after errors.
1 parent 0eb3224 commit d09f4d4

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

gas/read.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,22 +2201,32 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
22012201
as_warn (_("repeat < 0; .fill ignored"));
22022202
size = 0;
22032203
}
2204-
2205-
if (size && !need_pass_2)
2204+
else if (size && !need_pass_2)
22062205
{
2207-
if (now_seg == absolute_section)
2206+
if (now_seg == absolute_section && rep_exp.X_op != O_constant)
22082207
{
2209-
if (rep_exp.X_op != O_constant)
2210-
as_bad (_("non-constant fill count for absolute section"));
2211-
else if (fill && rep_exp.X_add_number != 0)
2212-
as_bad (_("attempt to fill absolute section with non-zero value"));
2213-
abs_section_offset += rep_exp.X_add_number * size;
2208+
as_bad (_("non-constant fill count for absolute section"));
2209+
size = 0;
2210+
}
2211+
else if (now_seg == absolute_section && fill && rep_exp.X_add_number != 0)
2212+
{
2213+
as_bad (_("attempt to fill absolute section with non-zero value"));
2214+
size = 0;
22142215
}
22152216
else if (fill
22162217
&& (rep_exp.X_op != O_constant || rep_exp.X_add_number != 0)
22172218
&& in_bss ())
2218-
as_bad (_("attempt to fill section `%s' with non-zero value"),
2219-
segment_name (now_seg));
2219+
{
2220+
as_bad (_("attempt to fill section `%s' with non-zero value"),
2221+
segment_name (now_seg));
2222+
size = 0;
2223+
}
2224+
}
2225+
2226+
if (size && !need_pass_2)
2227+
{
2228+
if (now_seg == absolute_section)
2229+
abs_section_offset += rep_exp.X_add_number * size;
22202230

22212231
if (rep_exp.X_op == O_constant)
22222232
{

0 commit comments

Comments
 (0)