The whole process of making a ELF using gcc and then wrapping it into a PE is dumb. There are tools you can use to just make a PE directly. People seem to prefer LLVM/clang for that, since it supports all architectures by default via a --target switch.
- The basic CFLAGS is
--target $(GCC_ARCH)-unknown-windows -ffreestanding -fshort-wchar -fno-stack-protector. You have most of that.
- The LDFLAGS are basically the same as what you have right now.
The whole process of making a ELF using gcc and then wrapping it into a PE is dumb. There are tools you can use to just make a PE directly. People seem to prefer LLVM/clang for that, since it supports all architectures by default via a
--targetswitch.--target $(GCC_ARCH)-unknown-windows -ffreestanding -fshort-wchar -fno-stack-protector. You have most of that.