This patch is posted just for reference on top of D84029 and D84412.
It's a very first attempt to support GNU ld on Solaris, which is non-trivial given that
both linkers have some options not supported by the other. Currently linker selection
is done at cmake time; it probably needs to be made runtime-selectable.
I suppose that this should be in a Solaris specific file to indicate that it's not for other systems.
GNU ld is almost ubiquitous on Linux and is almost always available at /usr/bin/ld (with very few distributions using others linkers by default or providing an option).
Detecting linker to affect driver decisions is we Linux are very wary of. We are nervous even trying to do some stuff only related to lld.
We likely don't want this function to be in CommonArgs to lure other contributors to use.