LedgerHQ / cargo-ledger

(Moved in the ledger device rust SDK --> https://github.com/LedgerHQ/ledger-device-rust-sdk). Load code on a Ledger device with a `cargo` subcommand
Apache License 2.0
15 stars 12 forks source link

Look up binutils from cargo config? #2

Closed Ericson2314 closed 1 year ago

Ericson2314 commented 3 years ago

I did https://github.com/obsidiansystems/cargo-ledger/commit/bf4610480ef65844ffc173fd54c4aba2ca9bcec1 to unblock myself, but this kinda of ugly. Maybe there is way to get the tools from .cargo/config instead?

yhql commented 3 years ago

Hi, can you describe how this could be done? I'm not sure in what field this could be stored. Otherwise, maybe we can switch to using https://github.com/rust-embedded/cargo-binutils. Does it invoke the correct objcopy on your platform ?

Ericson2314 commented 3 years ago

I saw Cargo binutils, it looks like it is just looking up tools from a sysroot, which isn't very self contained. I will try it but I doubt it wil work for me.

Hi, can you describe how this could be done? I'm not sure in what field this could be stored.

I was thinking

[target.<triple>]
linker = "…"            # linker to use

from https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker. I thought one could but other tools there but perhaps not.

However if CARGO_TARGET_<triple>_LINKER is equivalent that to that, nothing stops us to using CARGO_TARGET_<triple>_OBJCOPY and CARGO_TARGET_<triple>_SIZE separate from any Cargo code :). Just might be confusing if the config file equivalent didn't work.