Implement flexible target specification

See commit message.
I think this should stay here for all gnu-like linkers.