This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] cgen vs relc vs locals
- From: DJ Delorie <dj at redhat dot com>
- To: binutils at sourceware dot org
- Date: Wed, 13 May 2009 17:41:40 -0400
- Subject: [patch] cgen vs relc vs locals
Use of local labels in %lo() on mep-elf caused a segfault as there was
no bfd symbol for that expression. No regressions on gas or gcc
tests. Committed.
2009-05-13 DJ Delorie <dj@redhat.com>
* cgen.c (gas_cgen_parse_operand): Guard against NULL pointers.
Index: cgen.c
===================================================================
RCS file: /cvs/src/src/gas/cgen.c,v
retrieving revision 1.33
diff -p -U3 -r1.33 cgen.c
--- cgen.c 3 Jul 2007 11:01:02 -0000 1.33
+++ cgen.c 13 May 2009 21:29:06 -0000
@@ -452,9 +452,10 @@ gas_cgen_parse_operand (cd, want, strP,
if (exp.X_op == O_symbol
&& reloc_type == BFD_RELOC_RELC
&& exp.X_add_symbol->sy_value.X_op == O_constant
- && exp.X_add_symbol->bsym->section != expr_section
- && exp.X_add_symbol->bsym->section != absolute_section
- && exp.X_add_symbol->bsym->section != undefined_section)
+ && (!exp.X_add_symbol->bsym
+ || (exp.X_add_symbol->bsym->section != expr_section
+ && exp.X_add_symbol->bsym->section != absolute_section
+ && exp.X_add_symbol->bsym->section != undefined_section)))
{
/* Local labels will have been (eagerly) turned into constants
by now, due to the inappropriately deep insight of the