This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: gdbserver optimizer build failure
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Stan Shebs'" <stan at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Sat, 19 Jun 2010 00:44:43 +0200
- Subject: RE: gdbserver optimizer build failure
- References: <000f01cb0f28$e3d8b610$ab8a2230$@muller@ics-cnrs.unistra.fr> <4C1BE60D.6040208@codesourcery.com>
> -----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