|
From: Dmitry Z. <zh...@is...> - 2009-12-23 09:19:49
Attachments:
valist-fix.patch
|
Hello. It seems like ARM branch can't be compiled with recent versions of GCC (stock GCC 4.4 and CodeSourcery arm-2008q3 or even earlier). A patch is attached that allows building of Valgrind. Probably the reason for the failure is in the GCC version 4.4 changelog: "On ARM EABI targets, the C++ mangling of the va_list type has been changed to conform to the current revision of the EABI". This should mean that for ARM va_list is not integer (but a structure it seems) anymore which is still true for other platforms that Valgrind supports. Valgrind sources are written in such a way that it wants va_list to be able to be casted to an integer type implicitly. This is no longer available in current GCC for ARM. Seems like CodeSourcery made this change a little bit earlier (as original GCC version 4.3.2 is able to build Valgrind without errors). Please review the patch. It only makes a cast using union. Following is the error log: In file included from m_debuglog.c:57: ../include/valgrind.h: In function 'VALGRIND_PRINTF': ../include/valgrind.h:4186: error: aggregate value used where an integer was expected ../include/valgrind.h: In function 'VALGRIND_PRINTF_BACKTRACE': ../include/valgrind.h:4201: error: aggregate value used where an integer was expected make[3]: *** [libcoregrind_arm_linux_a-m_debuglog.o] Error 1 make[3]: *** Waiting for unfinished jobs.... mv -f .deps/libcoregrind_arm_linux_a-m_debugger.Tpo .deps/libcoregrind_arm_linux_a-m_debugger.Po mv -f .deps/libcoregrind_arm_linux_a-m_commandline.Tpo .deps/libcoregrind_arm_linux_a-m_commandline.Po make[3]: Leaving directory `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/batuzovk/valgrind/valgrind-clean' make: *** [all] Error 2 Regards, Dmitry |
|
From: Julian S. <js...@ac...> - 2010-01-04 01:13:45
|
Committed as r11006. Thanks. J On Wednesday 23 December 2009, Dmitry Zhurikhin wrote: > Hello. > > It seems like ARM branch can't be compiled with recent versions of GCC > (stock GCC 4.4 and CodeSourcery arm-2008q3 or even earlier). A patch is > attached that allows building of Valgrind. Probably the reason for the > failure is in the GCC version 4.4 changelog: "On ARM EABI targets, the C++ > mangling of the va_list type has been changed to conform to the current > revision of the EABI". This should mean that for ARM va_list is not > integer (but a structure it seems) anymore which is still true for other > platforms that Valgrind supports. Valgrind sources are written in such a > way that it wants va_list to be able to be casted to an integer type > implicitly. This is no longer available in current GCC for ARM. Seems > like CodeSourcery made this change a little bit earlier (as original GCC > version 4.3.2 is able to build Valgrind without errors). Please review the > patch. It only makes a cast using union. > > Following is the error log: > In file included from m_debuglog.c:57: > ../include/valgrind.h: In function 'VALGRIND_PRINTF': > ../include/valgrind.h:4186: error: aggregate value used where an integer > was expected > ../include/valgrind.h: In function 'VALGRIND_PRINTF_BACKTRACE': > ../include/valgrind.h:4201: error: aggregate value used where an integer > was expected > make[3]: *** [libcoregrind_arm_linux_a-m_debuglog.o] Error 1 > make[3]: *** Waiting for unfinished jobs.... > mv -f .deps/libcoregrind_arm_linux_a-m_debugger.Tpo > .deps/libcoregrind_arm_linux_a-m_debugger.Po > mv -f .deps/libcoregrind_arm_linux_a-m_commandline.Tpo > .deps/libcoregrind_arm_linux_a-m_commandline.Po > make[3]: Leaving directory > `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[2]: *** [all] Error > 2 > make[2]: Leaving directory > `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[1]: *** > [all-recursive] Error 1 > make[1]: Leaving directory `/home/batuzovk/valgrind/valgrind-clean' > make: *** [all] Error 2 > > > Regards, > Dmitry |
|
From: Julian S. <js...@ac...> - 2010-01-27 16:24:06
|
Uh, this unfortunately kills the VALGRIND_PRINTF_BACKTRACE macro
at least on amd64-linux, and, I suspect, on all platforms (V segfaults).
Problem is this
union {
va_list vargs;
unsigned long t;
} args;
va_start(args.vargs, format);
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
(unsigned long)format, (unsigned long)(args.t),
0, 0, 0);
on amd64-linux, sizeof(vargs) == 24. So what this code does is
to initialise a 24-byte structure, pass the first 8 bytes of it
to the client request ("unsigned long)(args.t)"). Back on the
"other side of the fence", the client request handler does this
union {
va_list vargs;
unsigned long t;
} args;
Int count;
args.t = (unsigned long)arg[2];
count =
VG_(vmessage)( Vg_ClientMsg, (char *)arg[1], args.vargs );
that is, initialises the first 1/3 of the 24-byte structure with supplied
8 bytes, passes the whole structure to VG_(vmessage), and segfaults.
We can only pass machine words as arguments in client requests. So the
obvious solution is to pass a reference to the vargs structure rather
than (trying to pass) the structure itself.
This is all somewhat complicated by the fact that VG_USERREQ__PRINTF
effectively constitutes a public API, and we can't change the behaviour
of it. So there needs to be a new VG_USERREQ__PRINTF_VARGS_BY_REF request
and the VALGRIND_PRINTF_BACKTRACE (et al) macros should then use that.
J
On Monday 04 January 2010, Julian Seward wrote:
> Committed as r11006. Thanks.
>
> J
>
> On Wednesday 23 December 2009, Dmitry Zhurikhin wrote:
> > Hello.
> >
> > It seems like ARM branch can't be compiled with recent versions of GCC
> > (stock GCC 4.4 and CodeSourcery arm-2008q3 or even earlier). A patch is
> > attached that allows building of Valgrind. Probably the reason for the
> > failure is in the GCC version 4.4 changelog: "On ARM EABI targets, the
> > C++ mangling of the va_list type has been changed to conform to the
> > current revision of the EABI". This should mean that for ARM va_list is
> > not integer (but a structure it seems) anymore which is still true for
> > other platforms that Valgrind supports. Valgrind sources are written in
> > such a way that it wants va_list to be able to be casted to an integer
> > type implicitly. This is no longer available in current GCC for ARM.
> > Seems like CodeSourcery made this change a little bit earlier (as
> > original GCC version 4.3.2 is able to build Valgrind without errors).
> > Please review the patch. It only makes a cast using union.
> >
> > Following is the error log:
> > In file included from m_debuglog.c:57:
> > ../include/valgrind.h: In function 'VALGRIND_PRINTF':
> > ../include/valgrind.h:4186: error: aggregate value used where an integer
> > was expected
> > ../include/valgrind.h: In function 'VALGRIND_PRINTF_BACKTRACE':
> > ../include/valgrind.h:4201: error: aggregate value used where an integer
> > was expected
> > make[3]: *** [libcoregrind_arm_linux_a-m_debuglog.o] Error 1
> > make[3]: *** Waiting for unfinished jobs....
> > mv -f .deps/libcoregrind_arm_linux_a-m_debugger.Tpo
> > .deps/libcoregrind_arm_linux_a-m_debugger.Po
> > mv -f .deps/libcoregrind_arm_linux_a-m_commandline.Tpo
> > .deps/libcoregrind_arm_linux_a-m_commandline.Po
> > make[3]: Leaving directory
> > `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[2]: *** [all]
> > Error 2
> > make[2]: Leaving directory
> > `/home/batuzovk/valgrind/valgrind-clean/coregrind' make[1]: ***
> > [all-recursive] Error 1
> > make[1]: Leaving directory `/home/batuzovk/valgrind/valgrind-clean'
> > make: *** [all] Error 2
> >
> >
> > Regards,
> > Dmitry
>
> ---------------------------------------------------------------------------
>--- This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
|