Hey @oakmacaroon 
Out of interest (it’s not important for the solution to your issue), could you please tell us which SOC/CPU you’re using and why? I suspect this might be a rather exciting story!
The documentation you’re referring to is unfortunately pretty outdated; at least it doesn’t apply to GHC versions which are using Hadrian as build system (I guess - without having it looked up >= 9.6.)
In general, changing the target ISA is not a supported feature. However, you might have luck with some hacking involved.
The tricky bit is that all intermediate compilers (LLVM IR, C and Assembly) may emit code (or object code in case of Assembly) that may lead to compressed instructions. They may have a default target which is not yours. So, it’s best to tell them precisely which target you want.
For obvious reasons, it’s also not good enough to just apply these changes to an existing GHC installation as you need to have libraries and the RTS be compiled for the specific target as well.
For my ongoing work on support for the V(ector) extension, I wrote this hacky Hadrian flavour transformer to accomplish this: !13467: Draft: RISC-V vectors · Merge requests · Glasgow Haskell Compiler / GHC · GitLab . You could probably create a new Flavour
for this as well.
And, also ran the autoconf scripts as CFLAGS=-march=rv64gv ./configure
.
Then, you could try to change llvm-targets
as you considered. Or, try to use the NCG, if you’re using GHC 9.12 (as there’s an unreleased bugfix, master
would be a good choice then.) AFAIK there are no explicit compressed instructions used in the NCG. However, there may be surprises regarding other extensions as we never tested the NCG to be limited to a specific instruction set.
Gaining visibility how the underlying tools are called is probably key to this endeavor. For GCC and GAS you could e.g. try -optc=-v -opta=-v
.
I hope this helps. Please let me know when you’re stuck or have more questions.