The solution is to add the option -Wa,-mbig-obj
if your version of GCC supports that option. You probably only need it during the compilation step, not the linker step.
If your compiler does not support that option, you should look into using mingw-w64 and MSYS2.