Bug 326921 - coregrind fails to compile m_trampoline.S with MIPS/Linux port of Valgrind
Summary: coregrind fails to compile m_trampoline.S with MIPS/Linux port of Valgrind
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.8.0
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on: 270777
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-31 01:31 UTC by Carl
Modified: 2013-11-30 01:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch for old gcc/gas for Valgrind for MIPS (12.77 KB, patch)
2013-11-29 02:51 UTC, Petar Jovanovic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carl 2013-10-31 01:31:44 UTC
I am using a cross compiling gcc toolchain, version 4.0.4.  The gnu assembler is version 2.17.  It is a 32-bit mips platform, small endian.  The c library is uclibc version 0.9.28.

Reproducible: Always

Steps to Reproduce:
1.  Configured with:
# CFLAGS="-mips32r2" ./configure --host=mipsel-linux-uclibc --prefix=/usr
2.  Ran make
# make

Actual Results:  
# make
make  all-recursive
make[1]: Entering directory `/root/mips/valgrind/valgrind-3.8.1'
Making all in include
make[2]: Entering directory `/root/mips/valgrind/valgrind-3.8.1/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1/include'
Making all in VEX
make[2]: Entering directory `/root/mips/valgrind/valgrind-3.8.1/VEX'
make  all-am
make[3]: Entering directory `/root/mips/valgrind/valgrind-3.8.1/VEX'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1/VEX'
make[2]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1/VEX'
Making all in coregrind
make[2]: Entering directory `/root/mips/valgrind/valgrind-3.8.1/coregrind'
make  all-am
make[3]: Entering directory `/root/mips/valgrind/valgrind-3.8.1/coregrind'
mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/usr/lib/valgrind"\" -DVG_PLATFORM="\"mips32-linux\""  -mips32 -g -Wno-long-long -mips32r2 -MT libcoregrind_mips32_linux_a-m_trampoline.o -MD -MP -MF .deps/libcoregrind_mips32_linux_a-m_trampoline.Tpo -c -o libcoregrind_mips32_linux_a-m_trampoline.o `test -f 'm_trampoline.S' || echo './'`m_trampoline.S
m_trampoline.S: Assembler messages:
m_trampoline.S:1040: Error: illegal operands `li $v0,(4000+119)'
m_trampoline.S:1047: Error: illegal operands `li $v0,(4000+193)'
m_trampoline.S:1059: Error: illegal operands `li $v0,0'
m_trampoline.S:1063: Error: illegal operands `addi $v0,$v0,1'
m_trampoline.S:1064: Error: illegal operands `addi $a0,$a0,1'
m_trampoline.S:1066: Error: illegal operands `lbu $t0,($a0)'
m_trampoline.S:1067: Error: illegal operands `bne $t0,$zero,strlen_loop'
make[3]: *** [libcoregrind_mips32_linux_a-m_trampoline.o] Error 1
make[3]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/mips/valgrind/valgrind-3.8.1'
make: *** [all] Error 2


Expected Results:  
It should compile normally.

I did apply an amd64 patch for valgrind as well, but it did not make a difference.
Comment 1 Carl 2013-10-31 01:45:14 UTC
And here is the result when compiling with the latest svn revision:

# make
make  all-recursive
make[1]: Entering directory `/root/mips/valgrind/trunk'
Making all in include
make[2]: Entering directory `/root/mips/valgrind/trunk/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/mips/valgrind/trunk/include'
Making all in VEX
make[2]: Entering directory `/root/mips/valgrind/trunk/VEX'
make  all-am
make[3]: Entering directory `/root/mips/valgrind/trunk/VEX'
mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -Ipriv  -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mips32 -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -mips32r2 -Wwrite-strings -MT priv/libvex_mips32_linux_a-guest_mips_helpers.o -MD -MP -MF priv/.deps/libvex_mips32_linux_a-guest_mips_helpers.Tpo -c -o priv/libvex_mips32_linux_a-guest_mips_helpers.o `test -f 'priv/guest_mips_helpers.c' || echo './'`priv/guest_mips_helpers.c
/tmp/ccEHgGQt.s: Assembler messages:
/tmp/ccEHgGQt.s:3819: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3824: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3842: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3848: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3866: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3871: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3889: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3895: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3913: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3918: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3936: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3942: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3960: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3965: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:3983: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:3989: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4007: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4012: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4030: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4036: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4054: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4057: Error: opcode not supported on this processor: mips32r2 (mips32r2) `round.l.s $f0,$f0'
/tmp/ccEHgGQt.s:4059: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4077: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4083: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4101: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4106: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4124: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4130: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4148: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4153: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4171: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4177: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4195: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4200: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4218: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4223: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4241: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4247: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4265: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4270: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4288: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4293: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4311: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4317: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4335: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4341: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4359: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4364: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4382: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4388: Error: illegal operands `ctc1 $t0,$31'
/tmp/ccEHgGQt.s:4406: Error: illegal operands `cfc1 $t0,$31'
/tmp/ccEHgGQt.s:4412: Error: illegal operands `ctc1 $t0,$31'
make[3]: *** [priv/libvex_mips32_linux_a-guest_mips_helpers.o] Error 1
make[3]: Leaving directory `/root/mips/valgrind/trunk/VEX'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/mips/valgrind/trunk/VEX'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/mips/valgrind/trunk'
make: *** [all] Error 2
Comment 2 Carl 2013-11-05 00:05:47 UTC
And in testing against the new 3.9.0 release, I get the same output as the svn trunk version.
Comment 3 Petar Jovanovic 2013-11-16 04:51:32 UTC
(In reply to comment #0)
> I am using a cross compiling gcc toolchain, version 4.0.4.  The gnu
> assembler is version 2.17.  It is a 32-bit mips platform, small endian.  The
> c library is uclibc version 0.9.28.

That is a very old toolchain, and the assembler at that time did not support many today's common features that make assembly code more readable.
We do not support that old toolchain, but we can give directions how to change the code if anyone really needs it.
Comment 4 Carl 2013-11-18 19:58:42 UTC
Hi, can I get the changes that are needed?  If only for valgrind 3.8.1.  We don't have to move to 3.9.0 for this.
Comment 5 Petar Jovanovic 2013-11-19 14:35:22 UTC
If you can provide us a toolchain and the rest of environment to trigger
these build issues, we can help with the changes.
Comment 6 Carl 2013-11-19 19:01:42 UTC
Here is a subversion repository for it:

http://svn.xp-dev.com/svn/opentvixdev/trunk/smp86xx_toolchain/

To check out:

svn co http://svn.xp-dev.com/svn/opentvixdev/trunk/smp86xx_toolchain/ smp86xx_toolchain

To build:

cd smp86xx_toolchain
make menuconfig
-leave settings as they are and save
make
source toolchain-path.env
Comment 7 Petar Jovanovic 2013-11-29 02:51:08 UTC
Created attachment 83822 [details]
patch for old gcc/gas for Valgrind for MIPS

It can be applied to Valgrind 13721 / Vex 2799.
Comment 8 Petar Jovanovic 2013-11-29 02:52:09 UTC
(In reply to comment #6)
Can you try http://bugsfiles.kde.org/attachment.cgi?id=83822 ?
Comment 9 Carl 2013-11-30 01:35:07 UTC
I can now compile it, thanks!  I tested it against revision 13724 as well and it works against that one too.