This is the mail archive of the
mailing list for the binutils project.
PR22127, as segfaults assembling invalid .reloc
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 14 Sep 2017 14:15:49 +0930
- Subject: PR22127, as segfaults assembling invalid .reloc
- Authentication-results: sourceware.org; auth=none
"sec" gets set to NULL on errors in the offset expression. This patch
disables part of the reloc expression processing that needs "sec"
valid. I didn't disable the entire reloc expression handling so that
errors in the reloc expression are reported even when the offset
expression has an error.
* write.c (resolve_reloc_expr_symbols): Don't segfault when
sec has been set to NULL.
diff --git a/gas/write.c b/gas/write.c
index 4f6547d..df88905 100644
@@ -724,7 +724,7 @@ resolve_reloc_expr_symbols (void)
as_bad_where (r->file, r->line, _("invalid reloc expression"));
sec = NULL;
- else if (sym != NULL)
+ else if (sym != NULL && sec != NULL)
/* Convert relocs against local symbols to refer to the
corresponding section symbol plus offset instead. Keep
Australia Development Lab, IBM