However, GCC in MinGW outputs object files in COFF format
GCC can be configured to generate various outputs (including ELF
) regardless of which host it runs on.
That is, a GCC running on Linux could be configured to generate COFF
, and a GCC running on Windows could be configured to generate ELF32
or ELF64
, for various processors (e.g. x86
, or SPARC
, or MIPS
).
A compiler that runs on one kind of host, but generates code for a different kind, is called a cross-compiler.
TCC only supports the ELF format
This is not a meaningful statement: it could mean that you want GCC to generate ELF32 for i686 Linux
, or ELF64 for SPARC Solaris
, or any number of other processor/os/bit combinations.
You should figure out what target processor and operating system you want to run your final executable on, and then build (non-trivial) or download appropriate cross-compiler from Windows to that target.
file test.o
test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
Ok, you want Windows to Linux/i386/ELF32
cross-compiler.