Get rid of some obsolete optlink workarounds

This commit is contained in:
Martin Kinkelin 2024-05-25 17:51:41 +02:00
parent 920678a820
commit 6d69608aae
5 changed files with 2 additions and 49 deletions

View file

@ -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}"

View file

@ -1,7 +1,5 @@
// REQUIRED_ARGS: -g
// If this is failing, you need optlink 8.00.14 or higher
string gen()
{
string m;

View file

@ -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.

View file

@ -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",
@ -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;
}
@ -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;

View file

@ -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",
@ -427,8 +399,6 @@ shared static this()
if (!dbghelp.SymInitialize(hProcess, generateSearchPath().ptr, TRUE))
return;
dbghelp.SymRegisterCallback64(hProcess, &FixupDebugHeader, 0);
InitializeCriticalSection(&mutex);
initialized = true;
}