Bug 14311 – Win32 COFF: bad symbols/relocation entries for global data accesses
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2015-03-20T07:07:00Z
Last change time
2015-06-17T21:02:34Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2015-03-20T07:07:24Z
Compile this code for Win64 with "dmd -m32mscoff test.d":
module test;
private __gshared int transform;
shared static this()
{
transform = 3;
}
and check the object file output with "dumpbin /disasm /all test.obj":
_D4test18_sharedStaticCtor1FZv:
00000000: C7 05 00 00 00 00 mov dword ptr [__TMP0],3
03 00 00 00
0000000A: C3 ret
i.e. there is a temporary symbol created for the variable access instead of the actual symbol itself, as the dump for the Win64 build shows:
_D4test18_sharedStaticCtor1FZv:
0000000000000000: 55 push rbp
0000000000000001: 48 8B EC mov rbp,rsp
0000000000000004: C7 05 00 00 00 00 mov dword ptr [_D4test9transformi],3
03 00 00 00
000000000000000E: 5D pop rbp
000000000000000F: C3 ret
This causes bad relocation entries to be built into the executable and causing failures for the phobos unit tests.