Skip to content

Latest commit

 

History

History
125 lines (89 loc) · 3.94 KB

Notes.md

File metadata and controls

125 lines (89 loc) · 3.94 KB

mipsel-gcw0-linux-uclibc.json

Origin

rustc +nightly -Z unstable-options --print target-spec-json --target=mipsel-unknown-linux-gnu

Modifications

-  "env": "gnu",
+  "env": "uclibc",

The impact of this is a bit complicated. On the one hand, the nix package is broken as heck on target_env="uclibc". nix imports a bunch of libc stuff which is just plain missing on uclibc, and thus fails to build. (TODO: fix nix?) On the other hand, target_env="gnu" is wrong and breaks std::env::args()! Specifically, init no longer calls really_init. uclibc does call .init_array.* as defined by rust's stdlib, but the parameters are different or bogus! Specifically:

  • argc is either uninitialized or a pointer (large varying values per run)
  • argv is either uninitialized or 0/nullptr (only ever observed to be 0 on my RG350M)
  • _envp... heck if I know, I didn't check.
-  "features": "+mips32r2,+softfloat",
+  "features": "+mips32r2",

Apparently gcw0 uses hard floats, whereas the default mipsel-unknown-linux-musl target uses soft floats.

-  "is-builtin": true,
+  "is-builtin": false,

Duh.

+  "linker": "/opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc",

gcw0-toolchain binaries assume it's been installed to /opt/gcw0-toolchain, so we might as well make the target assume the same.

-  "llvm-target": "mipsel-unknown-linux-gcc",
+  "llvm-target": "mipsel-gcw0-linux-uclibc",

Seems... more accurate, based on gcw0-toolchain layout? Not entirely sure about the impact of changing "vendor" from "unknown' to "gcw0".

-  "vendor": "unknown"
+  "vendor": "gcw0"

Ditto

Xargo.toml

Necessary to cause xargo to build std.

[target.mipsel-gcw0-linux-uclibc.dependencies.std]
features = []

Reference

Commands

rustc --target=mipsel-unknown-linux-gnu --print target-features
rustc +nightly -Z unstable-options --print target-spec-json --target=mipsel-unknown-linux-gnu

Environment Variables

Var Value Why
RUST_TARGET_PATH workspace xargo can't find target spec json files otherwise (workspace related?)
RUSTUP_TOOLCHAIN nightly-2020-06-15 xargo +nightly-2020-06-15 sadly doesn't work
PATH /opt/gcw0-toolchain/usr/bin Less necessary now that we have a target json spec
XARGO_RUST_SRC ~/.rustup/toolchains/nightly-2020-06-15-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src Make a copy of that folder and modify it if you want to tweak std

.cargo/config

Xargo

Custom Targets

OpenDingux Toolchains

RG350M

Unrelated

OpenDinux OpenGL ES 2 Support