5 ms·
I believe between - this - https://docs.rs/gimli/0.23.0/gimli/ https://docs.rs/gimli/0.23.0/gimli/ - https://github.com/rust-lang/compiler-builtins https://g
by Ericson2314 6y ago
I believe between
- this
- https://docs.rs/gimli/0.23.0/gimli/ https://docs.rs/gimli/0.23.0/gimli/
- https://github.com/rust-lang/compiler-builtins https://github.com/rust-lang/compiler-builtins
- https://github.com/redox-os/relibc https://github.com/redox-os/relibc
- https://lld.llvm.org/ https://lld.llvm.org/
It finally possible to make Linux binaries in a high level language not involving anything written in C at build-time or run-time!!!
(And I think with CraneLift + -Z build-std, but without any libc, one should be able to skip linking separately-compiled object files too, and thus skip LLD and C++.)
- gpm 6y ago> at build-time That's going to be hard. You're going to need an operating system, redox might work, not sure if it can run rustc yet. Once you have the operating system you need the hardware, specifically the hardware not to be using C. I'm not sure how I would even go about testing that but even if I had a magic wand I don't think it would be easy to cobble together a computer... and I can't even use particularly exotic hardware because of the limited OS selection.
- Ericson2314 6y agorelibc supports Linux too, not just Redox.
- gpm 6y agoLinux is written in C , as is macos and I suspect portions of windows.
- muricula 6y agoYour suspicions are correct.
- Ericson2314 6y agoI'm talking about the userland side of things. If we want pure Rust at, Redox or some tiny embedded thing is already no-C at runtime. The big novelty here is that build time is getting improved.
- est31 6y agoYeah also cargo has some C dependencies. It uses curl to download stuff from the network, openssl for TLS connections (at least on linux), and libgit2 to clone git repositories, both needed for crates.io downloads (registry is a git repo) as well as for git dependencies in Cargo.toml. But I think the progress is still very important. It shows that Rust can do basically anything. Also, for the c dependencies Cargo uses, rust rewrites exist. reqwest, rustls, and various (currently highly immature) pure-rust git libraries like gitoxide/https://github.com/chrisdickinson/git-rs https://github.com/chrisdickinson/git-rs.
- pjmlp 6y agoThat would be easy, just pick an IBM or Unisys mainframe, home of the systems programming languages created before C was born, and still used.
- wyldfire 6y ago"skip linking" -- what's this part mean? Does cranelift have an option to directly make locally-resolved executables without external references somehow?
- Ericson2314 6y agoYes that is what I mean. I don't know for sure, but because of Cranelift's origins as a JIT for wasm, I suspect that it does.
- wyldfire 6y agoIt wouldn't surprise me if that is a wasm backend only option. It sounds very unconventional for other targets.
- Ericson2314 6y agoTo be clear, Cranelifts original purpose was JIT compiling WASM to machine code, not other things to WASM. Skipping linking isn't too radical: traditional compilers already effectively do it infra-procedurally for resolving labels to (relative) addresses. "wasm backend" sounds like you were thinking the latter?
- stefan_ 6y agoIsn't that just Go? They always had their own standard library (which they would never update to use newer syscalls).
- Ericson2314 6y agoParts of Go's runtime are written in C, so the end-to-end being single-language is emphatically not like Go. relibc is a genuine libc implementation. However, I do believe Rust on Redox might indeed not factor through relibc's C interface for everything, taking advantage of Rust being on both sides. That is like Go.
- jchw 6y ago> Parts of Go's runtime are written in C, ? You can build the Go toolchain (and many other Go apps, so as long as they do not hard depend on C) with CGo disabled. I do not believe this is true. Source, although it is self-evident for Go developers who dabble in cross-compilation. https://golang.org/doc/faq#What_compiler_technology_is_used_to_build_the_compilers https://golang.org/doc/faq#What_compiler_technology_is_used_... (I do think there are optional C dependencies, but that shouldn’t be important; you can go end-to-end without C with exceedingly few compromises.)
- Ericson2314 6y agohttps://stackoverflow.com/questions/34756262/how-is-it-possible-for-the-go-runtime-to-be-written-in-go https://stackoverflow.com/questions/34756262/how-is-it-possi... Wow, OK. Go's GC is in Go. I'm very jealous; I've wanted this for Haskell for a long time.
- pjmlp 6y agoAnd here is the source code for the Oberon's one, in Oberon. https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Kernel.Mod.txt https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Kerne... Or the JikeRVM implementation in Java. https://github.com/JikesRVM/JikesRVM/tree/52582fa1c519d48fe0a80b57bd5883548e90860f/MMTk https://github.com/JikesRVM/JikesRVM/tree/52582fa1c519d48fe0...
- est31 6y agoHaven't the go folks achieved this as well? IIRC their entire toolchain is written in Go.
- pjmlp 6y agoIt was bootstraped via the Plan 9 compilers. Go has multiple implementations, only the reference one is pure Go, gogcc and the llvm variants are naturally a mix of Go and C++.
- est31 6y agoYeah I was referring to the reference toolchain. Not very deep in the go ecosystem, but I presume it's the one which has most use? Regarding the bootstrapping point, rustc was bootstrapped via a "rustboot" compiler written in ocaml. Doesn't make the rust compiler any less rust now, as it compiles itself nowadays (to be precise, version N compiles version N+1, and also supports compiling version N, at least for bootstrap purposes).
- pjmlp 6y agoMy point was more to make it clear that language != implementation, hence the various ones for Go.
- est31 6y agoIndeed, those two aren't the same concepts, but the person I replied to said "It finally possible to make Linux binaries in a high level language not involving anything written in C at build-time or run-time", so mainly referring to the possibility instead of all implementations being that way. For go I didn't want to go into further detail then as I assumed the "default go experience" entails only the official Go toolchain.
- pjmlp 6y agoFair enough.
- titzer 6y ago> It finally possible to make Linux binaries in a high level language not involving anything written in C at build-time or run-time!!! Virgil has been doing this for years. https://github.com/titzer/virgil/ https://github.com/titzer/virgil/
- ezluckyfree 6y agothat repo is 13% C according to github though?
- titzer 6y agoGitHub doesn't understand that .v3 is a new programming language. Their policy is not to recognize new languages unless "hundreds" of repos are using them. Thus, it concludes my project is mostly bash. :-) The C code in the repo is used for a few benchmarking and testing harnesses. It is not used in the runtime or compiler or libraries.
- pjmlp 6y agoI have done that for my toy compiler assignment during the late 90's, there is nothing special about it.
- pmarin 6y agoWhat about the linker?