How can GCC2 Hybrid compilation be improved?

In the preprocessor macros to consts thread or whatever I called it, you pointed out that GCC2 has bad dead-code elimination. I assume that is because the OS is compiled with an updated fork of GCC2. I’m looking for ways to improve that function.

Due to the link-time optimization requirement of the WebAssembly package format I proposed and am looking into, I may require that LLVM be used to install the packages. Clang 12 is in HaikuDepot so that shouldn’t be a huge problem.

This leaves the problem of making binaries architecture-neutral when ApplicationKit headers try to include these architecture-specific preprocessor macros. Obviously, that can’t be allowed. My solution was to convert the preprocessor directives into const directives so that their definitions could be deferred until link-time with an architecture-specific linker library on the destination platform.

For backward compatibility, native code generation that used to depend on those preprocessor macros would need good dead-code elimination and constant-folding to process const directives.

The only other option is to give the bytecode architecture a different header set that doesn’t include those preprocessor directives at all. This will reduce source-code compatibility but is an option.