On 2015-02-19 1:41 PM, ketmar wrote:
i remember that DMD creates one section for each function (to allow
smartlink feature). with templates this can be alot. maybe it needs new
cli flag "--collapse-sections" or something like it.
I watched the section names and discovered over 20,000 sections named :
.debug$S
According to the code, a new .debug$S section is created every time it
is searched with the flag IMAGE_SCN_LNK_COMDAT in:
https://github.com/D-Programming-Language/dmd/blob/de6fccf8391b1dfdb959fa0f089920c2c8e6aff8/src/backend/mscoffobj.c#L1724
I deleted this flag and now the program links correctly with COFF with
<50k sections.
It would have been easier to debug with an error in mscoffobj.c:1591:
assert(scnhdr_cnt < 65536, "Too many symbols for COFF format");
https://github.com/D-Programming-Language/dmd/blob/de6fccf8391b1dfdb959fa0f089920c2c8e6aff8/src/backend/mscoffobj.c#L1591
With this simple patch on the compiler, there are stil some errors
compiling Botan on win64, but they are not related to the COFF format
anymore.