The change in 0ba98433971f changed the behaviour of the build when using an XL build compiler because -G is not a pure linker option: it also implies -shared. This was accounted for in the base CMake configuration, so an analysis of the change from 0ba98433971f in relation to a build using Clang (where -shared is introduced by CMake) would not identify the issue. This patch resolves this particular issue by adding -shared alongside -Wl,-G.
At the same time, the investigation reveals that several aspects of the various build configurations are not operating in the manner originally intended.
The other issue related to the -G linker option in the build is that the removal of it (to avoid unnecessary use of run-time linking) is not effective for the build using the Clang compiler. This patch addresses this by adjusting the regular expressions used to remove the broadly-applied -G.
Finally, the issue of specifying the export list with -Wl, instead of a compiler option is flagged with a FIXME comment.
An aside: we should consider if this is worth mentioning to upstream CMake.