driver, link mode: properly implement the -module semantics.
Prior to this commit, -module was not respected when the specified
output name happened to end with the platform's shared library
suffix. In addition, the logic for generating shared libraries
with -module in effect has been incomplete and partially also
incorrect.