This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFD] MIPS/gas: Optimisation cannot be set to 0


Ian Lance Taylor wrote:
> "Maciej W. Rozycki" <macro@mips.com> writes:
> 
> > Wed Feb 12 14:36:29 1997  Ian Lance Taylor  <ian@cygnus.com>
> > 
> > 	* config/tc-mips.c (md_parse_option): When debugging, set
> > 	mips_optimize to 1, not 0.
> 
> My vague recollection of the problem is that at least at that time gcc
> would always pass a -O option to the assembler.  When not optimizing,
> it would pass -O0.  However, inserting NOPs for MIPS variants which do
> not need them does not help debugging.
> 
> Clearly failing to provide a way to set mips_optimize to 0 was an
> oversight.
> 
> >  I have no strong preference, but I think gas should have a mode where its 
> > input is assembled intact.  And swapping branches may produce surprising 
> > interactions with debugging information.  I am therefore in favour to the 
> > first proposal above, but I would like to hear from the others.
> 
> I'm not sure I see the relevance of "assembled intact."  The source is
> assembled just as the user specified with -O1.  -O1 simply inhibits
> adding additional unnecessary nop instructions--nop instructions that
> were required for MIPS ISA I but not for later ISAs.
> 
> At -O1 branches are not swapped, so debugging is not impaired.
> 
> I agree there should be a way to set mips_optimize to 0, but we should
> ensure that gcc -O0 does not set mips_optimize to 0 when assembling.

I plan to commit the appended patch to fix this. Comments?


Thiemo


2007-11-14  Thiemo Seufer  <ths@mips.com>

	* config/tc-mips.c (md_parse_option): Match mips_optimize to the -O
	option supplied, but still keep mips_optimize == 2 as default value.

Index: head/gas/config/tc-mips.c
===================================================================
--- head.orig/gas/config/tc-mips.c	2007-11-14 17:41:58.000000000 +0000
+++ head/gas/config/tc-mips.c	2007-11-14 17:51:43.000000000 +0000
@@ -11013,7 +11013,11 @@
       break;
 
     case 'O':
-      if (arg && arg[0] == '0')
+      if (arg == NULL)
+	mips_optimize = 1;
+      else if (arg[0] == '0')
+	mips_optimize = 0;
+      else if (arg[0] == '1')
 	mips_optimize = 1;
       else
 	mips_optimize = 2;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]