Bug 17072 – [REG 2.073.0-b1] missing symbols with -inline
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2017-01-08T12:26:00Z
Last change time
2017-01-24T11:54:54Z
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2017-01-08T12:26:46Z
With dmd 2.073.0-beta1, this code
import core.thread;
void main()
{
Thread.sleep(dur!"msecs"(50));
}
produces a link error:
>dmd.exe test.d -m64 -inline
test.obj : error LNK2019: unresolved external symbol _D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNfxS4core4time8DurationZS4core4time8Duration referenced in function _Dmain
This does not happen with dmd 2.072 or without -inline.
Comment #1 by code — 2017-01-15T17:58:10Z
There is a difference between the mangling of the symbol included in phobos64.lib and the one requested.
phobos64.lib has:
_D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNjNfxS4core4time8DurationZS4core4time8Duration
linker wants:
_D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNfxS4core4time8DurationZS4core4time8Duration
ddemangle doesn't yet know Nj, it stands for FuncAttrReturn (https://dlang.org/spec/abi.html#FuncAttrReturn).
So what we have here is likely a difference in return inference in different compilations, leading the test below to think that the template was already instantiated by druntime, therefor not emitting it itself, but the instantiation in druntime inferred a different STCreturn.
It's only reproducible w/ -inline b/c that runs semantic3 on imported functions and templates.
Happens because the released library is build with -dip25 which enables return inference and obviously creates ABI incompatibilities.
Comment #2 by bugzilla — 2017-01-16T02:29:00Z
(In reply to Rainer Schuetze from comment #0)
> This does not happen with dmd 2.072 or without -inline.
It does work if you throw -dip25. Still a regression, though.