Hi,

I'm trying to get cross compilation to Sitara AM1808 (Lego Mindstorms
EV3) working, but haven't been able to get working binaries.

First I simply tried compiling with `rustc
--target=arm-unknown-linux-gnueabi`, but got errors with missing std.

So next I compiled rust from source with `configure
--target=arm-unknown-linux-gnueabi --host=i686-unknown-linux-gnu`.
Then I could create a binary without errors with `env
LD_LIBRARY_PATH=$HOME/local/rust-cross/lib
PATH=$HOME/local/rust-cross/bin:$PATH local/rust-cross/bin/rustc -C
linker=/usr/bin/arm-linux-gnueabi-gcc
--target=arm-unknown-linux-gnueabi hello.rs`, but trying to run the
binary on the device just gives me "Illegal instruction".

For the record, checking the type of the helloworld with file gives

    hello: ELF 32-bit LSB  shared object, ARM, EABI5 version 1 (SYSV),
    dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
    BuildID[sha1]=f48dc778edb4e4818915f45e4e6e985cf4e7eb59, not stripped

while working bash from the device is

    bash: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV),
    dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
    BuildID[sha1]=8ab870f6f5cbbb621b85763f557b41832a3f3181, stripped

I also tried setting target-cpu=arm9 and target-feature=+v5te, but
that didn't affect anything.

Next I tried using an external assembler by telling rustc -C
no-integrated-as. That gave a bunch of errors::

    error: linking with `/usr/bin/arm-linux-gnueabi-gcc` failed: exit code: 1
    note: /usr/bin/arm-linux-gnueabi-gcc '-c' '-o' 'hello.o' 'hello.s'
    note: hello.s: Assembler messages:
    hello.s:576: Error: selected processor does not support ARM mode `blx r2'
    hello.s:692: Error: selected processor does not support ARM mode `blx r2'
    hello.s:785: Error: selected processor does not support ARM mode `blx r2'
    hello.s:855: Error: selected processor does not support ARM mode `blx r2'
    hello.s:1280: Rd and Rm should be different in mul
    hello.s:2505: Rd and Rm should be different in mul
    hello.s:2663: Error: selected processor does not support ARM mode `clz 
r0,r0'
    hello.s:2730: Rd and Rm should be different in mul
    hello.s:2958: Error: selected processor does not support ARM mode `blx r2'
    hello.s:3074: Error: selected processor does not support ARM mode `blx r2'
    hello.s:3167: Error: selected processor does not support ARM mode `blx r2'
    hello.s:3237: Error: selected processor does not support ARM mode `blx r2'
    hello.s:3662: Rd and Rm should be different in mul
    hello.s:3979: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4058: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4146: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4220: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4306: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4380: Error: selected processor does not support ARM mode `blx r2'
    hello.s:4450: Error: selected processor does not support ARM mode `blx r2'
    hello.s:5135: Rd and Rm should be different in mul

    error: aborting due to previous error

As my last idea I tried emitting bc, ir and asm from rustc and using
llc and arm-linux-gnueabi-as to make binaries, but llc from ir gave

    llc: hello.ll:88:140: error: expected value token
    call void
    
@_ZN2os4args20h5a44d7ab05eef5ebjtjE(%"struct.collections::vec::Vec<[collections::string::String]>[#6]"*
    noalias nocapture sret dereferenceable(12) %1)

, bc

    llc: hello.bc: error: Invalid value

and the assembler

    hello.s: Assembler messages:
    hello.s:1279: Rd and Rm should be different in mul
    hello.s:2504: Rd and Rm should be different in mul
    hello.s:2729: Rd and Rm should be different in mul
    hello.s:3661: Rd and Rm should be different in mul
    hello.s:5134: Rd and Rm should be different in mul

similar to using the no-integrated-as earlier.

I'm now fully out of ideas what could be going wrong and how to fix it.
Any suggestions would be very much appreciated.

-- 
Tomi Pieviläinen, +358 400 487 504
A: Because it disrupts the natural way of thinking.
Q: Why is top posting frowned upon?
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to