blocksds / sdk

Main BlocksDS SDK repository
https://blocksds.github.io/docs/
164 stars 11 forks source link

Improve Teak LLVM toolchain #93

Open AntonioND opened 1 year ago

AntonioND commented 1 year ago

As mentioned by @asiekierka in https://github.com/blocksds/sdk/issues/60, the current toolchain by Gericom is quite buggy, mostly because of the lack of users and developers. It's usable as it is right now, but it would be good to have someone work on it to improve the code generation.

This could also be useful for people in the 3DS homebrew community.

AntonioND commented 1 year ago

It looks like the assembler can't evaluate expressions. More information in the message of this commit: https://github.com/blocksds/sdk/commit/164cb5970f22b29401b2375325113504a0635346

asiekierka commented 7 months ago

The main blocker with regards to a good open-source Teak toolchain is the lack of open source compilers which can work well with CHAR_BIT != 8, that is CPUs which don't operate on memory in units of 8-bit bytes (in this case, CHAR_BIT == 16).

Initial research suggests fairly extensive modifications to LLVM would be required to make this work reliably; Gericom's toolchain... didn't make it work reliably.

asiekierka commented 1 month ago

Perhaps the best prior art on LLVM modifications was discussed by @Embecosm - https://www.embecosm.com/2017/04/18/non-8-bit-char-support-in-clang-and-llvm/ - but, as far as I know, a lot of it remains not upstreamed.

Alternatively, a port of binutils/GCC could be attempted; binutils has good and actively maintained support for non-8-bit chars, while GCC at minimum should still have most of the code paths.