fix Issue 11931 - Linkers "Symbol Undefined" again with dmd HEAD when -g specified

Also add test case for issue 7595.