There is no logic in cabal-install nor Cabal which stops you building dynamic libraries with compilers which do not support them.
Cross compilers (wasm/javascript) both don't support dynamic libraries but we only don't build them because they both also happen to be statically linked.
When we distribute a dynamically linked cross compilers (like all other bindists), this logic will break. We should explicitly check if a target supports specific ways and refuse to build that way if it doesn't support it.