Bug 402123 - invalid assembler opcodes for mips32r2
Summary: invalid assembler opcodes for mips32r2
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: 3.14.0
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-14 13:56 UTC by cote2004-github
Modified: 2019-03-28 21:15 UTC (History)
1 user (show)

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


Attachments
Proposed patch (809 bytes, patch)
2018-12-14 13:56 UTC, cote2004-github
Details
openwrt compile log (13.02 KB, text/plain)
2018-12-14 13:57 UTC, cote2004-github
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cote2004-github 2018-12-14 13:56:27 UTC
Created attachment 116918 [details]
Proposed patch

SUMMARY
Cross-compilation for openwrt fails for mips targets, when -mips32r2 is used.

STEPS TO REPRODUCE
1. clone openwrt master from https://git.openwrt.org/openwrt/openwrt.git
2. run make menuconfig.  
3. You may use default target (Atheros AR7xxx/AR9xxx)
4. Select valgrind under development
5. Turn on build log: Select Advanced configuration options, Enable log files during build process
6. Run make

OBSERVED RESULT
../coregrind/link_tool_exe_linux 0x58000000 mips-openwrt-linux-musl-gcc  -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/build_dir/target-mips_24kc_musl/valgrind-3.14.0:valgrind-3.14.0 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro   -L/opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/staging_dir/target-mips_24kc_musl/usr/lib -L/opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/staging_dir/target-mips_24kc_musl/lib -L/opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/usr/lib -L/opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/lib -znow -zrelro  -o memcheck-mips32-linux -flto -flto-partition=one -fuse-linker-plugin -mips32 -mabi=32 -O2 -finline-functions -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin  -O2 -static -nodefaultlibs -nostartfiles -u __start -mips32 -mabi=32 memcheck_mips32_linux-mc_leakcheck.o memcheck_mips32_linux-mc_malloc_wrappers.o memcheck_mips32_linux-mc_main.o memcheck_mips32_linux-mc_main_asm.o memcheck_mips32_linux-mc_translate.o memcheck_mips32_linux-mc_machine.o memcheck_mips32_linux-mc_errors.o ../coregrind/libcoregrind-mips32-linux.a ../VEX/libvex-mips32-linux.a -lgcc 
{standard input}: Assembler messages:
{standard input}:91297: Error: `fp=64' used with a 32-bit fpu
{standard input}:91320: Error: `fp=64' used with a 32-bit fpu
{standard input}:91341: Error: `fp=64' used with a 32-bit fpu
{standard input}:91362: Error: `fp=64' used with a 32-bit fpu
{standard input}:91383: Error: `fp=64' used with a 32-bit fpu
{standard input}:91404: Error: `fp=64' used with a 32-bit fpu
{standard input}:91425: Error: `fp=64' used with a 32-bit fpu
{standard input}:91446: Error: `fp=64' used with a 32-bit fpu
{standard input}:91467: Error: `fp=64' used with a 32-bit fpu
{standard input}:91488: Error: `fp=64' used with a 32-bit fpu
{standard input}:91509: Error: `fp=64' used with a 32-bit fpu
{standard input}:91530: Error: `fp=64' used with a 32-bit fpu
{standard input}:91551: Error: `fp=64' used with a 32-bit fpu
{standard input}:91572: Error: `fp=64' used with a 32-bit fpu
{standard input}:91593: Error: `fp=64' used with a 32-bit fpu
{standard input}:91597: Error: opcode not supported on this processor: mips32 (mips32) `ceil.l.s $f24,$f24'
{standard input}:91614: Error: `fp=64' used with a 32-bit fpu
{standard input}:91618: Error: opcode not supported on this processor: mips32 (mips32) `ceil.l.d $f24,$f24'
{standard input}:91635: Error: `fp=64' used with a 32-bit fpu
{standard input}:91639: Error: opcode not supported on this processor: mips32 (mips32) `cvt.d.l $f24,$f24'
{standard input}:91656: Error: `fp=64' used with a 32-bit fpu
{standard input}:91660: Error: opcode not supported on this processor: mips32 (mips32) `cvt.l.s $f24,$f24'
{standard input}:91677: Error: `fp=64' used with a 32-bit fpu
{standard input}:91681: Error: opcode not supported on this processor: mips32 (mips32) `cvt.l.d $f24,$f24'
{standard input}:91698: Error: `fp=64' used with a 32-bit fpu
{standard input}:91702: Error: opcode not supported on this processor: mips32 (mips32) `cvt.s.l $f24,$f24'
{standard input}:91719: Error: `fp=64' used with a 32-bit fpu
{standard input}:91723: Error: opcode not supported on this processor: mips32 (mips32) `floor.l.s $f24,$f24'
{standard input}:91740: Error: `fp=64' used with a 32-bit fpu
{standard input}:91744: Error: opcode not supported on this processor: mips32 (mips32) `floor.l.d $f24,$f24'
{standard input}:91761: Error: `fp=64' used with a 32-bit fpu
{standard input}:91765: Error: opcode not supported on this processor: mips32 (mips32) `round.l.s $f24,$f24'
{standard input}:91782: Error: `fp=64' used with a 32-bit fpu
{standard input}:91786: Error: opcode not supported on this processor: mips32 (mips32) `round.l.d $f24,$f24'
{standard input}:91803: Error: `fp=64' used with a 32-bit fpu
{standard input}:91807: Error: opcode not supported on this processor: mips32 (mips32) `trunc.l.s $f24,$f24'
{standard input}:91824: Error: `fp=64' used with a 32-bit fpu
{standard input}:91828: Error: opcode not supported on this processor: mips32 (mips32) `trunc.l.d $f24,$f24'
lto-wrapper: fatal error: /opt/buildbot/slaves/lede-slave-tah/mips_24kc/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/bin/mips-openwrt-linux-musl-gcc returned 1 exit status
compilation terminated.

EXPECTED RESULT
no errors :)

SOFTWARE/OS VERSIONS
Target:
openwrt fdd11a6eaeaec27d3129282cce2fc4fd3b1c1b61
linux 4.14.87
libc: musl-1.1.20

Toolchain:
mipsel-openwrt-linux-gcc version 7.3.0
mipsel-openwrt-linux-as version 2.31.1

Host version:
Linux 4.14.65

ADDITIONAL INFORMATION
I'm attaching a patch that allows me to compile, but I don't know if the check I've changed is indeed correct, or if some mips32r2 machines support those instructions or not.
Comment 1 cote2004-github 2018-12-14 13:57:43 UTC
Created attachment 116919 [details]
openwrt compile log
Comment 2 cote2004-github 2018-12-14 19:39:34 UTC
Step 6 should read (to show building output)
6. Run make V=sc

Build log should be saved in logs/package/devel/valgrind/compile.txt
Comment 3 Julian Seward 2019-03-10 09:31:52 UTC
Petar, any idea about this?
Comment 4 Petar Jovanovic 2019-03-25 18:01:52 UTC
(In reply to Julian Seward from comment #3)
> Petar, any idea about this?

I hope this is fixed with 

https://sourceware.org/git/?p=valgrind.git;a=commit;h=e61d13087096139024788393218367572751b4b6

cote2004-github, can you check with Valgrind ToT?
Comment 5 cote2004-github 2019-03-28 21:15:56 UTC
(In reply to Petar Jovanovic from comment #4)
> cote2004-github, can you check with Valgrind ToT?
I have run dc950d964, and also by applying the patch to 3.14.0, and both work like a charm.
Thank you.