The linker-flags.f90 test checks for the linker command line. The -target indicates cross-compiling, the toolchain executables themselves are still running on the native platform. If it is Windows, the driver will try to fully resolve the path to ld which may include an .exe suffix.
In in my case, it resolves to my MinGW installation ("C:\\tools\\msys64\\usr\\bin\\ld.exe") found in PATH. The GNU ld that comes with the MSYS2 distribution does not support elf64lppc or MacOS emulation modes (acosx_version_min), but the test also does not require executing the linker.