Reapply r327026 (partially):
Merge lld trunk r321017 to contrib/llvm/tools/lld.
(Note that in this merge, I foolishly combined upstream changes with
this local change. But only this ifdef part is really needed, as we
always default to ELF link mode.)
(cherry picked from commit 59948e95d8deadafca3acd659b6dfc78b708f117)