Skip to content

Commit

Permalink
Add support for MinGW-w64 v7.0.0
Browse files Browse the repository at this point in the history
I've diffed the relevant subtress (mingw-w64-crt/lib{32,64,-common}) of
v6 and v7 manually and hopefully caught most potential regressions
(MS functions newly overridden by MinGW implementations).
  • Loading branch information
kinke committed Nov 28, 2019
1 parent bafb3c9 commit 6b4a382
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions buildsdk.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ void sanitizeDef(string defFile)
// ucrtbase.def:
"_assert", "_cabs", "_fpreset", "_tzset",
"ceil", "ceilf", "coshf", "fabs",
"feclearexcept", "fegetenv", "fegetexceptflag", "fegetround", "feholdexcept",
"fesetenv", "fesetexceptflag", "fesetround", "fetestexcept",
"floor", "floorf", "modf", "modff",
"lgamma", "lgammaf", "lgammal",
"sinhf", "sqrt", "sqrtf", "wcsnlen",
// additional ones in msvcr100.def:
"__report_gsfailure",
Expand All @@ -104,7 +107,7 @@ void sanitizeDef(string defFile)
"_wassert",
"acosf", "asinf", "atan2", "atan2f", "atanf",
"btowc",
"cos", "cosf", "exp", "expf", "fmod", "fmodf", "ldexp",
"cos", "cosf", "exp", "expf", "fmod", "fmodf", "frexp", "ldexp",
"longjmp",
"llabs", "lldiv",
"log", "log10f", "logf",
Expand Down Expand Up @@ -143,10 +146,13 @@ void sanitizeDef(string defFile)
}

// Un-hide functions overridden by the MinGW runtime.
foreach (name; overriddenMinGWFunctions)
if (line.endsWith(" DATA"))
{
if (line.length == name.length + 5 && line.startsWith(name) && line.endsWith(" DATA"))
return name;
foreach (name; overriddenMinGWFunctions)
{
if (line.length == name.length + 5 && line.startsWith(name))
return name;
}
}

// Don't export function 'atexit'; we have our own in msvc_atexit.c.
Expand Down Expand Up @@ -248,7 +254,7 @@ bool defWithStdcallMangling2implib(string defFile)
line.startsWith("LIBRARY ") || line.startsWith("EXPORTS"))
return line;

if (line.endsWith(" DATA"))
if (line.length > 5 && (line[$-5] == ' ' || line[$-5] == '\t') && line.endsWith("DATA"))
{
fields ~= line[0 .. $-5];
return line;
Expand Down

0 comments on commit 6b4a382

Please sign in to comment.