japaric/f3

Example failing to link with 1.30.0-nightly (2018-09-13)

nicodemus26 opened this issue · 2 comments

This is also the case with cortex-m-rt examples.

I get a linking error:

cargo build --example blinky --target thumbv7em-none-eabihf
   Compiling f3 v0.6.1 (file:///home/nicodemus/src/nicodemus26/f3)             
^Merror: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "-L" "/home/nicodemus/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib" 
...
 "-Wl,-Tlink.x" "-nostartfiles" "-Bdynamic"
  = note: rust-lld: error: unknown argument: -Wl,-Tlink.x
          rust-lld: error: unknown argument: -nostartfiles

Running with arm-none-eabi-gdb (and gdb) from gcc-arm-none-eabi-7-2018-q2.

I can comment the linker flags from .cargo/config and the build succeeds, but I get the following error from gdb when running:

Reading symbols from target/thumbv7em-none-eabihf/debug/examples/blinky...done.
0x00000000 in ?? ()
semihosting is enabled
Start address 0x0, load size 0
Transfer rate: 0 bits in <1 sec.
.gdbinit:18: Error in sourced command file:
Cannot find bounds of current function
(gdb) 

where .gdbinit:18 is the step after load.

Start address 0x0, load size 0 suggest to me that the load is failing silently.

The binary itself is about 2Mb:

ls target/thumbv7em-none-eabihf/debug/examples/blinky -la
-rwxrwxr-x 2 nicodemus nicodemus 2016448 Sep 14 15:04 target/thumbv7em-none-eabihf/debug/examples/blinky
gbip commented

Since a few weeks you have to link your embedded projects using lld.
To adapt the .cargo/config you should take a look at this fix !
The complete file

Fixed in #101 (master, not yet released).