This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: gdbserver optimizer build failure



> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Stan Shebs
> Envoyé?: Friday, June 18, 2010 11:33 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org
> Objet?: Re: gdbserver optimizer build failure
> 
> Pierre Muller wrote:
> >
> >   gdbserver build currently
> > fails on gcc16 (x86-64 machine running linux).
> >
> 
> This is presumably the same problem as Doug reported a couple days ago:
> 
> http://sourceware.org/ml/gdb-patches/2010-06/msg00370.html
> 
> It doesn't happen to me, probably because it only kicks in on
> particular
> compiler / binutils combos.  But could you please try Ian's suggested
> macro in http://sourceware.org/ml/gdb-patches/2010-06/msg00379.html ?
> It looks like it would do the right thing.
No that patch didn't work on gcc16,
apparently the optimizer still skips the "unsused" code.

The following worked for gcc16:
I first added the volatile to the variable, but it did not seem to be
required.

Pierre


Index: linux-x86-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-x86-low.c,v
retrieving revision 1.19
diff -u -p -r1.19 linux-x86-low.c
--- linux-x86-low.c     15 Jun 2010 10:44:48 -0000      1.19
+++ linux-x86-low.c     18 Jun 2010 22:41:59 -0000
@@ -1486,10 +1486,13 @@ add_insns (unsigned char *start, int len

 /* A function used to trick optimizers.  */

+
+/* volatile */ int always_true_answer = 1;
+
 int
 always_true (void)
 {
-  return 1;
+  return always_true_answer;
 }

 /* Our general strategy for emitting code is to avoid specifying raw



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