mrk-its / rust-mos

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
55 stars 7 forks source link

Get rid of compiler-builtins (and cargo) fork #21

Closed mrk-its closed 6 months ago

mrk-its commented 1 year ago

We are forking compiler builtins to apply such little patch: https://github.com/mrk-its/compiler-builtins/commit/384dcad08d0e920229167eac82553046d0e1188b Cargo is forked because we need force usage of compiler-builtins fork - getting rid of it would greatly simplify releasing.

Let's investigate why compilation of these int and float modules fail

mlund commented 1 year ago

This is the error coming from vanilla compiler-builtins:

LLVM ERROR: unable to legalize instruction: %37:_(s32) = G_FDIV %36:_, %31:_ (in function: _ZN17compiler_builtins5float3pow9__powisf217h041f3b35704658baE)
error: could not compile `compiler_builtins` (lib)

powisf2 appears here. The error seems simply to be due to a missing pow() function on the C side of things (the SDK still doesn't support floats, see https://github.com/llvm-mos/llvm-mos-sdk/issues/58)

mlund commented 1 year ago

Could this patch be achieved from Cargo.toml?, i.e. something like the following:

[dependencies]
compiler-builtins = { git = "https://github.com/mrk-its/compiler-builtins.git }
mrk-its commented 1 year ago

Could this patch be achieved from Cargo.toml?, i.e. something like the following:

no, patching this way unfortunately doesn't work (at least it didn't last time I was checking, maybe something changed in the meantime)

mlund commented 1 year ago

Perhaps we could figure out how this is handled for other targets without floating point support. There are mentions of "soft-float".

mrk-its commented 6 months ago

llvm-mos got floats support recently: https://github.com/llvm-mos/llvm-mos/issues/10 And it looks compiler-builtins patching is no longer necessary.