Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind cross compilation for ARMv5tel

I ran configure with the following option:

./configure --target=armv5tel CC=arm-linux-gnueabi-gcc --host=i686-linux

then ran make

I encountered the following error:

m_cpuid.S: Assembler messages:
m_cpuid.S:40: Error: bad instruction `pushl %ebp'
m_cpuid.S:41: Error: bad instruction `movl %esp,%ebp'
m_cpuid.S:42: Error: bad instruction `pushl %ecx'
m_cpuid.S:43: Error: bad instruction `pushfl'
m_cpuid.S:44: Error: bad instruction `pushfl'
m_cpuid.S:45: Error: bad instruction `popl %eax'
m_cpuid.S:46: Error: bad instruction `movl %eax,%ecx'
m_cpuid.S:47: Error: bad instruction `xorl $0x200000,%eax'
m_cpuid.S:48: Error: bad instruction `pushl %eax'
m_cpuid.S:49: Error: bad instruction `popfl'
m_cpuid.S:50: Error: bad instruction `pushfl'
m_cpuid.S:51: Error: bad instruction `popl %eax'
m_cpuid.S:52: Error: bad instruction `popfl'
m_cpuid.S:53: Error: bad instruction `xorl %ecx,%eax'
m_cpuid.S:54: Error: bad instruction `andl $0x200000,%eax'
m_cpuid.S:55: Error: bad instruction `shrl $21,%eax'
m_cpuid.S:56: Error: bad instruction `popl %ecx'
m_cpuid.S:57: Error: bad instruction `movl %ebp,%esp'
m_cpuid.S:58: Error: bad instruction `popl %ebp'
m_cpuid.S:59: Error: bad instruction `ret'
m_cpuid.S:76: Error: bad instruction `pushl %ebp'
m_cpuid.S:77: Error: bad instruction `movl %esp,%ebp'
m_cpuid.S:78: Error: bad instruction `pushl %eax'
m_cpuid.S:79: Error: bad instruction `pushl %ebx'
m_cpuid.S:80: Error: bad instruction `pushl %ecx'
m_cpuid.S:81: Error: bad instruction `pushl %edx'
m_cpuid.S:82: Error: bad instruction `pushl %esi'
m_cpuid.S:83: Error: bad instruction `movl 8(%ebp),%eax'
m_cpuid.S:84: Error: bad instruction `cpuid'
m_cpuid.S:85: Error: bad instruction `movl 12(%ebp),%esi'
m_cpuid.S:86: Error: bad instruction `testl %esi,%esi'
m_cpuid.S:87: Error: bad instruction `jz 1f'
m_cpuid.S:88: Error: bad instruction `movl %eax,(%esi)'
m_cpuid.S:90: Error: bad instruction `movl 16(%ebp),%esi'
m_cpuid.S:91: Error: bad instruction `testl %esi,%esi'
m_cpuid.S:92: Error: bad instruction `jz 2f'
m_cpuid.S:93: Error: bad instruction `movl %ebx,(%esi)'
m_cpuid.S:95: Error: bad instruction `movl 20(%ebp),%esi'
m_cpuid.S:96: Error: bad instruction `testl %esi,%esi'
m_cpuid.S:97: Error: bad instruction `jz 3f'
m_cpuid.S:98: Error: bad instruction `movl %ecx,(%esi)'
m_cpuid.S:100: Error: bad instruction `movl 24(%ebp),%esi'
m_cpuid.S:101: Error: bad instruction `testl %esi,%esi'
m_cpuid.S:102: Error: bad instruction `jz 4f'
m_cpuid.S:103: Error: bad instruction `movl %edx,(%esi)'
m_cpuid.S:105: Error: bad instruction `popl %esi'
m_cpuid.S:106: Error: bad instruction `popl %edx'
m_cpuid.S:107: Error: bad instruction `popl %ecx'
m_cpuid.S:108: Error: bad instruction `popl %ebx'
m_cpuid.S:109: Error: bad instruction `popl %eax'
m_cpuid.S:110: Error: bad instruction `movl %ebp,%esp'
m_cpuid.S:111: Error: bad instruction `popl %ebp'
m_cpuid.S:112: Error: bad instruction `ret'
m_cpuid.S:154: Error: junk at end of line, first unrecognized character is `,'
make[3]: *** [libcoregrind_x86_linux_a-m_cpuid.o] Error 1
make[3]: Leaving directory `/home/swathi/Desktop/valgrind-3.6.0/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/swathi/Desktop/valgrind-3.6.0/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/swathi/Desktop/valgrind-3.6.0'
make: *** [all] Error 2

Am I missing something?

swathi

like image 941
swathi Avatar asked Nov 19 '10 18:11

swathi


2 Answers

Your configure arguments are not right for cross-compilation. To cross-compile with recent autoconf you just specify host and let it figure the rest out. So it would be more like this:

./configure --host=arm-linux-gnueabi

I also had to modify the configure script by replacing "armv7*" with "arm*". You'll see where.

However, there's another problem. The ARM support in valgrind covers all ARMv5 instructions and a select subset of v6 and v7 instructions. BUT, and it's a big but, to actually RUN valgrind you must use a CPU capable of running ARMv7 code. That means Cortex-A or better.

If you intend to run valgrind on an ARMv5 class processor (like XScale) it will not work and the target program will fault with an illegal opcode.

Sad but true. No valgrind for me.

HTH.

like image 151
Mike Cashwell Avatar answered Feb 01 '23 01:02

Mike Cashwell


  1. make clean
  2. ./configure CC="your path of gcc" --target=arm-none-linux-gnueabi --host=armv7-none-linux-gnueabi
  3. make
  4. sudo make install
like image 22
Ravi Sharma Avatar answered Jan 31 '23 23:01

Ravi Sharma