|
From: Toàn T. <min...@gm...> - 2017-11-23 07:06:41
|
Hi everyone, I'm having a problem while trying to cross compile Valgrind for ARM. These are my whole process step by step: 1/ export PATH=$PATH:/usr/local/arm_linux_4.2/bin/ (export PATH to my cross compiler) 2/ Extract valgrind-3.13.0 3/ cd to valgrind-3.13.0 folder 4/ Run command: sed -i -e "s#armv7#arm#g" configure (to allow cross compile for ARM) 5/ sudo ./configure --host=arm-none-linux-gnueabi 6/ sudo make and the following error pops up: arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_arm=1 -DVGO_linux=1 -DVGP_arm_linux=1 -DVGPV_arm_linux_vanilla=1 -Ipriv -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-qual -Wwrite-strings -Wformat -Wformat-security -fno-stack-protector -fno-strict-aliasing -fno-builtin -marm -mcpu=cortex-a8 -Wbad-function-cast -fstrict-aliasing -MT priv/libvex_arm_linux_a-main_globals.o -MD -MP -MF priv/.deps/libvex_arm_linux_a-main_globals.Tpo -c -o priv/libvex_arm_linux_a-main_globals.o `test -f 'priv/main_globals.c' || echo './'`priv/main_globals.c priv/main_globals.c:1: *error: bad value (cortex-a8) for -mcpu= switch * Makefile:1254: recipe for target 'priv/libvex_arm_linux_a-main_globals.o' failed What am I doing wrong and how to fix this? Your help is very much appreciated. |
|
From: John R. <jr...@bi...> - 2017-11-23 17:30:15
|
> Hi everyone, I'm having a problem while trying to cross compile Valgrind for ARM. armv6 and lower are not supported because the hardware lacks reasonable support for threads. It is [was] possible to run memcheck of a single-thread program on amrv6. Search the mailing list archives and bug reports of a few years ago for the patches; I contributed one set. Beware that it is *VERY SLOW* and it is likely that you will run out of RAM when checking any real program. It is foolish even to try running memcheck on anything less than a RaspberryPi-3B (1GB RAM, 1GHz CPU, $35.) You have much better things to do. Linux distributions such as Fedora and Debian already package valgrind for armv7*. > priv/main_globals.c:1: *error: bad value (cortex-a8) for -mcpu= switch * > Makefile:1254: recipe for target 'priv/libvex_arm_linux_a-main_globals.o' failed -mcpu=cortex-a8 does not match -march=arm. Delete the -mcpu entirely. |
|
From: Toàn T. <min...@gm...> - 2017-11-24 03:15:29
|
Hi John Reiser, Thank you for your reply. To be more specific, here is my target device spec: *Processor : ARM926EJ-S rev 5 (v5l) BogoMIPS : 119.19 Features : swp half thumb fastmult edsp java CPU implementer : 0x41 CPU architecture: 5TEJ CPU variant : 0x0 CPU part : 0x926 CPU revision : 5 * Since it uses ARM926EJ-S processor, in an attempt to fix *error: bad value (cortex-a8) for -mcpu= switch,* I replace cortex-a8 with arm926ej-s for all files in valgrind-3.13.0 folder. I am able to bypass this error but another error pops up: m_dispatch/dispatch-arm-linux.S: Assembler messages: m_dispatch/dispatch-arm-linux.S:104: Error: selected processor does not support `movw r1,#47' m_dispatch/dispatch-arm-linux.S:105: Error: selected processor does not support `movw r2,#0' m_dispatch/dispatch-arm-linux.S:157: Error: selected processor does not support `movw r1,#:lower16:vgPlain_stats__n_xindirs_32' m_dispatch/dispatch-arm-linux.S:158: Error: selected processor does not support `movt r1,#:upper16:vgPlain_stats__n_xindirs_32' m_dispatch/dispatch-arm-linux.S:165: Error: selected processor does not support `movw r1,#(((1<<15))-1)' m_dispatch/dispatch-arm-linux.S:166: Error: selected processor does not support `movw r4,#:lower16:vgPlain_tt_fast' m_dispatch/dispatch-arm-linux.S:169: Error: selected processor does not support `movt r4,#:upper16:vgPlain_tt_fast' m_dispatch/dispatch-arm-linux.S:182: Error: selected processor does not support `movw r1,#:lower16:vgPlain_stats__n_xindir_misses_32' m_dispatch/dispatch-arm-linux.S:183: Error: selected processor does not support `movt r1,#:upper16:vgPlain_stats__n_xindir_misses_32' Makefile:3224: recipe for target 'm_dispatch/libcoregrind_arm_linux_a-dispatch-arm-linux.o' faile So i tried your suggestion, which is "Delete the -mcpu entirely". Another error pops up: m_dispatch/dispatch-arm-linux.S: Assembler messages: m_dispatch/dispatch-arm-linux.S:157: Error: constant expression required -- `movw r1,#:lower16:vgPlain_stats__n_xindirs_32' m_dispatch/dispatch-arm-linux.S:158: Error: constant expression required -- `movt r1,#:upper16:vgPlain_stats__n_xindirs_32' m_dispatch/dispatch-arm-linux.S:166: Error: constant expression required -- `movw r4,#:lower16:vgPlain_tt_fast' m_dispatch/dispatch-arm-linux.S:169: Error: constant expression required -- `movt r4,#:upper16:vgPlain_tt_fast' m_dispatch/dispatch-arm-linux.S:182: Error: constant expression required -- `movw r1,#:lower16:vgPlain_stats__n_xindir_misses_32' m_dispatch/dispatch-arm-linux.S:183: Error: constant expression required -- `movt r1,#:upper16:vgPlain_stats__n_xindir_misses_32' Makefile:3224: recipe for target 'm_dispatch/libcoregrind_arm_linux_a-dispatch-arm-linux.o' failed I desperately need a tool to check memory leak for binary file on my device. Is there any workaround for this? Toan Tran. On Fri, Nov 24, 2017 at 12:30 AM, John Reiser <jr...@bi...> wrote: > Hi everyone, I'm having a problem while trying to cross compile Valgrind >> for ARM. >> > > armv6 and lower are not supported because the hardware lacks reasonable > support > for threads. It is [was] possible to run memcheck of a single-thread > program > on amrv6. Search the mailing list archives and bug reports of a few years > ago > for the patches; I contributed one set. Beware that it is *VERY SLOW* > and it is likely that you will run out of RAM when checking any real > program. > > It is foolish even to try running memcheck on anything less than > a RaspberryPi-3B (1GB RAM, 1GHz CPU, $35.) You have much better things to > do. > Linux distributions such as Fedora and Debian already package valgrind for > armv7*. > > priv/main_globals.c:1: *error: bad value (cortex-a8) for -mcpu= switch * >> Makefile:1254: recipe for target 'priv/libvex_arm_linux_a-main_globals.o' >> failed >> > > -mcpu=cortex-a8 does not match -march=arm. Delete the -mcpu entirely. > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: John R. <jr...@bi...> - 2017-11-24 04:36:32
|
> To be more specific, here is my target device spec:
> Processor : ARM926EJ-S rev 5 (v5l) BogoMIPS : 119.19 Features : swp half thumb fastmult edsp java
> CPU implementer : 0x41 CPU architecture: 5TEJ CPU variant : 0x0 CPU part : 0x926 CPU revision : 5
> So i tried your suggestion, which is "Delete the -mcpu entirely". Another error pops up:
>
> m_dispatch/dispatch-arm-linux.S: Assembler messages:
> m_dispatch/dispatch-arm-linux.S:157: Error: constant expression required -- `movw r1,#:lower16:vgPlain_stats__n_xindirs_32'
> m_dispatch/dispatch-arm-linux.S:158: Error: constant expression required -- `movt r1,#:upper16:vgPlain_stats__n_xindirs_32'
> m_dispatch/dispatch-arm-linux.S:166: Error: constant expression required -- `movw r4,#:lower16:vgPlain_tt_fast'
> m_dispatch/dispatch-arm-linux.S:169: Error: constant expression required -- `movt r4,#:upper16:vgPlain_tt_fast'
> m_dispatch/dispatch-arm-linux.S:182: Error: constant expression required -- `movw r1,#:lower16:vgPlain_stats__n_xindir_misses_32'
> m_dispatch/dispatch-arm-linux.S:183: Error: constant expression required -- `movt r1,#:upper16:vgPlain_stats__n_xindir_misses_32'
> Makefile:3224: recipe for target 'm_dispatch/libcoregrind_arm_linux_a-dispatch-arm-linux.o' failed
0. Running valgrind on Fedora or Debian on a RaspberryPi-3B is so easy and inexpensive
that the app must not be portable. Perhaps it is tied to some special hardware that
is available only on the board with your ARM926EJ-S rev 5 (v5l) ? Why not run on
armv7*, using the software model that simulates the device?
Remember: memcheck is 40 to 50 times slower than straight execution
(the 926EJ has small and slow caches),
so if the device has any hard timing constraints then you may be out of luck;
but often you can change the timing constraints in a software model.
Why not manipulate the device on the 936EJ over the network from the RaspberryPi?
Use what the hardware hackers did to develop the device and/or its software driver.
1. Because the 926EJ is armv5l, then it doesn't do threads very well. Valgrind
assumes that threads work well, so if the app uses threads then you will fail
if you try to run memcheck on the 926EJ. Get armv7*.
2. Looking at the code, the first 2 and last 2 complaints from the assembler
refer to blocks like:
/* stats only */
movw r1, #:lower16:vgPlain_stats__n_xindirs_32
movt r1, #:upper16:vgPlain_stats__n_xindirs_32
ldr r2, [r1, #0]
add r2, r2, #1
str r2, [r1, #0]
and indeed, r1 and r2 are dead after that. So one option is to comment-out
the block of code, and remember that the statistics will be incorrect.
[But you never looked at them before.]
3. The other two complaints refer to:
/* try a fast lookup in the translation cache */
// r0 = next guest, r1,r2,r3,r4 scratch
movw r1, #VG_TT_FAST_MASK // r1 = VG_TT_FAST_MASK
movw r4, #:lower16:VG_(tt_fast)
and r2, r1, r0, LSR #1 // r2 = entry #
movt r4, #:upper16:VG_(tt_fast) // r4 = &VG_(tt_fast)
which can be re-written to use an explicit pointer; something like:
ldr r4, p_tt_fast // r4 = &VG_(tt_fast)
movw r1, #VG_TT_FAST_MASK // r1 = VG_TT_FAST_MASK
and r2, r1, r0, LSR #1 // r2 = entry #
<<snip>>
b postamble
p_tt_fast:
.word VG_(tt_fast)
This will be 1 or 2 cycles slower: a couple percent overall.
--
|