Skip to content

Commit

Permalink
Get rid of some obsolete optlink workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed May 25, 2024
1 parent 920678a commit 6d69608
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 49 deletions.
2 changes: 1 addition & 1 deletion compiler/test/compilable/issue17167.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ src="$bin_base.d"

echo 'void main() {}' > "${src}"

# Only compile, not link, since optlink can't handle long file names
# Only compile, don't link, since the Microsoft linker doesn't implicitly support long paths
$DMD -m"${MODEL}" "${DFLAGS}" -c -of"${bin}" "${src}"

rm_retry -r "${OUTPUT_BASE}"
2 changes: 0 additions & 2 deletions compiler/test/compilable/test11559upgradeoptlink.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// REQUIRED_ARGS: -g

// If this is failing, you need optlink 8.00.14 or higher

string gen()
{
string m;
Expand Down
3 changes: 0 additions & 3 deletions compiler/test/runnable/test17338.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// COMDAT folding increases runtime by > 80x
// REQUIRED_ARGS(windows): -L/OPT:NOICF

// Apparently omf or optlink does not support more than 32767 symbols.
// DISABLED: win32

// Generate \sum_{i=0}^{14} 2^i = 32767 template instantiations
// (each with 3 sections) to use more than 64Ki sections in total.

Expand Down
14 changes: 1 addition & 13 deletions compiler/test/tools/unit_test_runner.d
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ string[] buildCmdArgs(string runnerPath, string outputPath, const string[] testF
"-version=NoMain",
"-version=MARS",
"-version=DMDLIB",
"-g",
"-unittest",
"-J" ~ buildOutputPath,
"-Jsrc/dmd/res",
Expand All @@ -277,10 +278,6 @@ string[] buildCmdArgs(string runnerPath, string outputPath, const string[] testF
if (environment.get("DMD_TEST_COVERAGE", "0") == "1")
flags ~= "-cov";

// older versions of Optlink causes: "Error 45: Too Much DEBUG Data for Old CodeView format"
if (!usesOptlink)
flags ~= "-g";

return flags;
}

Expand All @@ -306,15 +303,6 @@ bool missingTestFiles(Range)(Range givenFiles)
return false;
}

bool usesOptlink()
{
version (DigitalMars)
return os == "windows" && model == "32";

else
return false;
}

int main(string[] args)
{
string unitTestFilter;
Expand Down
30 changes: 0 additions & 30 deletions druntime/src/core/sys/windows/stacktrace.d
Original file line number Diff line number Diff line change
Expand Up @@ -339,34 +339,6 @@ private:
}


// Workaround OPTLINK bug (Bugzilla 8263)
extern(Windows) BOOL FixupDebugHeader(HANDLE hProcess, ULONG ActionCode,
ulong CallbackContext, ulong UserContext)
{
if (ActionCode == CBA_READ_MEMORY)
{
auto p = cast(IMAGEHLP_CBA_READ_MEMORY*)CallbackContext;
if (!(p.addr & 0xFF) && p.bytes == 0x1C &&
// IMAGE_DEBUG_DIRECTORY.PointerToRawData
(*cast(DWORD*)(p.addr + 24) & 0xFF) == 0x20)
{
immutable base = DbgHelp.get().SymGetModuleBase64(hProcess, p.addr);
// IMAGE_DEBUG_DIRECTORY.AddressOfRawData
if (base + *cast(DWORD*)(p.addr + 20) == p.addr + 0x1C &&
*cast(DWORD*)(p.addr + 0x1C) == 0 &&
*cast(DWORD*)(p.addr + 0x20) == ('N'|'B'<<8|'0'<<16|'9'<<24))
{
debug(PRINTF) printf("fixup IMAGE_DEBUG_DIRECTORY.AddressOfRawData\n");
memcpy(p.buf, cast(void*)p.addr, 0x1C);
*cast(DWORD*)(p.buf + 20) = cast(DWORD)(p.addr - base) + 0x20;
*p.bytesread = 0x1C;
return TRUE;
}
}
}
return FALSE;
}

private string generateSearchPath()
{
__gshared string[3] defaultPathList = ["_NT_SYMBOL_PATH",
Expand Down Expand Up @@ -427,8 +399,6 @@ shared static this()
if (!dbghelp.SymInitialize(hProcess, generateSearchPath().ptr, TRUE))
return;

dbghelp.SymRegisterCallback64(hProcess, &FixupDebugHeader, 0);

InitializeCriticalSection(&mutex);
initialized = true;
}

0 comments on commit 6d69608

Please sign in to comment.