[Issue 15338] New: COFF EH tables are not linker-GC-able
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Nov 14 18:26:29 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15338
Issue ID: 15338
Summary: COFF EH tables are not linker-GC-able
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Keywords: bare-metal, link-failure
Severity: blocker
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: thecybershadow at gmail.com
Bare-bones (no runtime) Win32/64 program:
///////////////////// test.d ////////////////////
import core.sys.windows.windows;
import std.conv : to;
extern(C)
void start()
{
static immutable msg = "Hello!".to!(TCHAR[]);
MessageBox(null, msg.ptr, msg.ptr, 0);
ExitProcess(0);
}
pragma(startaddress, start);
/////////////////////////////////////////////////
Compiles and links fine on Win32 (OMF), but with Win64 (COFF):
C:\Test> dmd -release -betterC -c -m64 test.d
C:\Test> link /SUBSYSTEM:CONSOLE /ENTRY:start test.obj user32.lib kernel32.lib
Microsoft (R) Incremental Linker Version 12.00.30723.0
Copyright (C) Microsoft Corporation. All rights reserved.
test.obj : error LNK2001: unresolved external symbol _D12TypeInfo_Aya6__initZ
test.obj : error LNK2019: unresolved external symbol memcpy referenced in
function _D6object14__T7_rawDupTaZ7_rawDupFNaNbANgaZANga
test.obj : error LNK2001: unresolved external symbol _D14TypeInfo_Const6__vtblZ
test.obj : error LNK2019: unresolved external symbol _D10TypeInfo_a6__initZ
referenced in function
_D6object20__T12_getPostblitTaZ12_getPostblitFNaNbNiNeZDFNaNbNiNfKaZv
test.obj : error LNK2019: unresolved external symbol _d_newarrayU referenced in
function _D6object14__T7_rawDupTaZ7_rawDupFNaNbANgaZANga
test.obj : error LNK2019: unresolved external symbol _D6object7__arrayZ
referenced in function _D6object19__T11_doPostblitTaZ11_doPostblitFNaNbNiNfAaZv
test.obj : error LNK2001: unresolved external symbol _D10TypeInfo_k6__initZ
test.obj : error LNK2019: unresolved external symbol _D11TypeInfo_Aa6__initZ
referenced in function _D6object14__T7_rawDupTaZ7_rawDupFNaNbANgaZANga
test.obj : error LNK2019: unresolved external symbol
_D6object8TypeInfo8postblitMxFPvZv referenced in function
_D6object20__T12_getPostblitTaZ12_getPostblitFNaNbNiNeZDFNaNbNiNfKaZv
test.exe : fatal error LNK1120: 9 unresolved externals
It looks like DMD generates pdata sections which refer (and thus pull in)
std.conv.to (and all its dependencies), even though it is never called at
runtime (only compilation).
Maybe the -betterC switch can disable pdata sections.
--
More information about the Digitalmars-d-bugs
mailing list