GHC should avoid going through assembler when compiling C
Motivation
Currently, when compiling a C file, be it coming from command line or unregisterised codegen, the GHC driver will first invoke the C compiler with -x c
flags to emit an assembly file, then compile this assembly file to generate the object file. The reason of this two step distinction is merely historical, and we should call the C compiler to emit the object file in a single invocation:
- Compared to generating assembly file first, this should be always slightly faster.
- For certain architectures (e.g. wasm32), the assembler is very fragile and error-prone.
Proposal
Change the GHC driver behavior, when compiling C, call the C compiler to generate the object file in a single invocation.