This is fine, I'm surprised the linker flag is needed though. Seems like an LD bug. Only question I have is about the 32 bit builds, I'm assuming non-prifiling builds don't have this issue but now gas will ignore -mbig-obj but ld will probably error out.

So I think the case needs to only apply to x86_64-w64-mingw32 for now so non-prifiling builds work.
For the 32 bit builds we should either force split-sections off for the profiling libs or fix binutils. The latter doesn't seem to be that difficult. Most of the code in the patch is generic bfd anyway.

Yes, because of --oformat,pe-bigobj-x86-64, --oformat is used to set the output format, but there isn't such a format for PE (the name in bfd is a bit misleading). The bigobj is as the name implies a COFF format, e.g. only for object files.--oformat,pe-bigobj-* is only needed if you're doing pre-linking with -r. For the final PE binary, there's no way you should have no# sections anywhere near the limit of of the PE file anyway, as the linker would have merged the subsections again.

what exactly was the error that made you think this was needed @bgamari ?

However, things then fail at linking. I believe this will be fixed by passing --oformat pe-bigobj-x86-64 to the linker, although this hasn't been confirmed yet.

Which is a bit suspicious.. unless the link errors are coming from the ghci whole-object files we prelink, but that shouldn't be it since we provide a linker scripts to merge those sections during prelinking.