4 ms·
The main source of interest for GCC Rust is because GCC targets more platforms than LLVM. A partially-overlapping interest is using Rust in Linux: Linux targets
by lmkg 4y ago
The main source of interest for GCC Rust is because GCC targets more platforms than LLVM. A partially-overlapping interest is using Rust in Linux: Linux targets non-LLVM platforms, but is also deeply tied to GCC and Rust-for-Linux would have a lower barrier to entry if it doesn't require a second toolchain.
Long-term, it's considered a strong signal for the health and viability of Rust if it's not strictly tied to one implementation.
- potatochup 4y agoYup. We have microcontrollers that we'd like to write rust on, but we can't because llvm doesn't support the architecture.
- 3836293648 4y agoBut that's not an argument for GCC-RS, that's an argument for rustc_codegen_gcc. The purpose of GCC-RS is a) licensing and b) fracturing the community to stabilise the language spec, something I'm very doubtful over for at least a few more years.
- tcmart14 4y agoA question for curiosity since I don't know much about llvm and specifically the architecture. Does LLVM not support architectures because there is some barrier, or a higher barrier than GCC? And GCC makes it easier to support some architectures or is it just as easy to add the support to LLVM but no one does it because GCC already supports it?
- cozzyd 4y agoThe vendor sometimes does this and GCC is much more standard in the embedded space. And crucially, it's required to be open source. For example, for arm-none-eabi, ARM provides a GCC toolchain (https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain https://developer.arm.com/Tools%20and%20Software/GNU%20Toolc...) but makes you purchase the LLVM-based one (https://developer.arm.com/Tools%20and%20Software/Arm%20Compiler%20for%20Embedded https://developer.arm.com/Tools%20and%20Software/Arm%20Compi...). Now I'm fairly certain there's an open-source way to target ARM microcontrollers with LLVM but you can't download it from ARM...
- kelnos 4y agoThat's so strange. Rustup does ship with support for baremetal EABI ARM: $ rustup target list | grep arm | grep none armebv7r-none-eabi armebv7r-none-eabihf armv7a-none-eabi armv7r-none-eabi armv7r-none-eabihf ... which means the publicly-available open source version of LLVM also supports it.
- cozzyd 4y agoSure I bet it does, otherwise Rust wouldn't work on perhaps the most common microcontroller target, and I know it does. I don't know if there are secret sauce bits ARM adds to their version, or if there are differences in hardware support or anything like that. (I use gcc on these targets...have never looked into using Clang/LLVM on them). edit: looking into this more, yes, upstream clang/llvm should work, though it doesn't include a C stdlib for this target (of little import to Rust, presumably), so you'll have to find one (e.g. by taking it from the GNU toolchain) if you want to use a C stdlib on embedded. Who knows what secret sauce armclang adds to clang...
- steveklabnik 4y agoWhere's the "purchase" part there? I see a download link, and it seemed to download the toolchain? I don't have any projects lying around to actually try it out, but it looks complete? I briefly looked at the license and it seems that if you're getting it for free, then its all good, you just get no support. (I only write Rust on ARM and so am unfamiliar with the various toolchains they offer, honestly.)
- cozzyd 4y agoAh, ok I saw this table: https://i.imgur.com/5ofzjC3.png https://i.imgur.com/5ofzjC3.png and that trying to download required an account (which is not true for the GCC toolset) and assumed they'd make you pay something. But maybe they just try to trick you into thinking you might have to... (or I am easily fooled). edit: My legalese is not great, but isn't the the license saying that you can't legally distribute software compiled with the LLVM-based ARM tools if you obtained it for free? Obviously the gcc-based tools can't have such restrictions. 3.2 NON-COMMERCIAL USE AND FREE OF CHARGE LICENSES: ... (b) if you are receiving a Non-Commercial Use License or version (as applicable) of the Arm Tools: (i) you and your Permitted Users may use the Arm Tools for internal use only; and (ii) you are not permitted to distribute or sub-license (A) any part of the Arm Tools, or (B) Your Software, Your Hardware, or Your Reports developed under this License using the Arm Tools. The Arm Tools shall be used only by you and your Permitted Users, and you shall not (except as otherwise authorised in writing by Arm) allow any other third party whatsoever to use the Arm Tools. For the avoidance of doubt, if you are receiving a Non-Commercial Use License and the license is provided to you free of charge, the restrictions in both sub-clauses (a) and (b) above will apply to your use of the Arm Tools. additional edit: Here's what happens when I try to run armclang: $ armclang armclang: error: Failed to check out a license. The license file could not be found. Check that ARMLMD_LICENSE_FILE is set correctly. I did not bother to figure out if there's a way to get a license without paying (though I would likely qualify for a non-commercial license as an academic user, but it seems like a pain).
- cogman10 4y agoIt's a mixture of problems. GCC targets more platforms than LLVM, that much is true. But beyond that, it's pretty common in the microcontroller world for a vendor to release their own specially patched version of GCC blessed for a given platform. They simply aren't doing that for the LLVM. Those blessed GCCs aren't often seeing the hacks merged upstream. Here's one such example: https://www.ti.com/tool/MSP430-GCC-OPENSOURCE?keyMatch=gcc&tisearch=Search-EN-Everything https://www.ti.com/tool/MSP430-GCC-OPENSOURCE?keyMatch=gcc&a...
- epage 4y agoNote that for providing more platform support, there is also rustc_codegen_gcc which just replaces LLVM with libgccjust but keeps the rustc frontend.