Fix issue 10338
Merge pull request #2166 from mxfm/fixlink

[trivial] Minor issue in link.c
Allow out-of-source testsuite builds.
Adapt -cov/-profile test to out-of-source builds.
Change test result dir to catch any leftover hard-coded paths.
Manually replace ${RESULTS_DIR} for Windows compatibility.