Patchwork Fix MIPS build after recent options changes

login
register
mail settings
Submitter Joseph S. Myers
Date Oct. 4, 2010, 5:26 p.m.
Message ID <Pine.LNX.4.64.1010041724090.11322@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/66712/
State New
Headers show

Comments

Joseph S. Myers - Oct. 4, 2010, 5:26 p.m.
I found my most recent options patch had broken the build for MIPS
because it removed the target_flags_explicit declaration for the
GENERATOR_FILE case, and target_flags_explicit is used in macros such
as GENERATE_LL_SC which are used in insn conditions which are used in
generator files.

I had thought that this declaration was unneeded for generator files
because it was already the case before my patch that they did not get
a *definition* of this variable.  However, insn conditions get used if
only inside __builtin_constant_p, so it is necessary to have a
declaration even without a definition.

This use of target_flags_explicit in insn conditions is inappropriate
by my model of option_handling; elements of global_options_set (or in
future such a structure passed around as a pointer) should be used
only in initial option processing to indicate what was explicitly
passed, as part of determining default values, and not subsequently in
code generation which should be based on variables or flags determined
at initialization (possibly using target_flags_explicit as part of
that initial determination).  Thus it will need fixing in due course.
However, this patch does the minimal change to get MIPS building
again: declaring target_flags_explicit in mips.h if GENERATOR_FILE.
Tested building cc1 for cross to mips-elf.  OK to commit?

2010-10-04  Joseph Myers  <joseph@codesourcery.com>

	* config/mips/mips.h (target_flags_explicit): Declare for
	GENERATOR_FILE.
Richard Sandiford - Oct. 4, 2010, 8:02 p.m.
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> 2010-10-04  Joseph Myers  <joseph@codesourcery.com>
>
> 	* config/mips/mips.h (target_flags_explicit): Declare for
> 	GENERATOR_FILE.

OK.

Richard

Patch

Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(revision 164932)
+++ gcc/config/mips/mips.h	(working copy)
@@ -26,6 +26,12 @@ 
 
 #include "config/vxworks-dummy.h"
 
+#ifdef GENERATOR_FILE
+/* This is used in some insn conditions, so needs to be declared, but
+   does not need to be defined.  */
+extern int target_flags_explicit;
+#endif
+
 /* MIPS external variables defined in mips.c.  */
 
 /* Which ABI to use.  ABI_32 (original 32, or o32), ABI_N32 (n32),