Bug 13117 – Executable size of hello world explodes from 472K to 2.7M
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-07-13T07:44:00Z
Last change time
2014-08-22T08:04:37Z
Keywords
pull
Assigned to
nobody
Creator
dbugreporter
Comments
Comment #0 by dbugreporter — 2014-07-13T07:44:26Z
Compiled with dmd_2.066.0~b3-0_amd64 (or ~b2) hello world executable becomes 2.7 megabytes while with 2.065 it's 472 kilobytes.
import std.stdio;
void main() {
writeln("hello");
}
Comment #1 by k.hara.pg — 2014-07-13T08:21:30Z
Issue does not occur in Windows platform.
-m32
With git head: 145,436 bytes
With 2.065: 138,268 bytes
-m64
With git head: 259,584 bytes
With 2.065: 257,536 bytes
Comment #2 by bugzilla — 2014-07-13T09:24:10Z
Not again! Dammit, this should be tested for in the autotester suite.
Comment #3 by bugzilla — 2014-07-14T03:31:33Z
I just tried this, and am seeing 394,000 size executables. I cannot reproduce your results.
Looked with xxd, there's nothing but a bunch of zeros between those sections.
Comment #6 by code — 2014-07-15T23:47:43Z
Only happens with ld.bfd (my version is 2.23.2). For some reason the output file contains a single RWE segment with .text and .bss.
This also only happens with the libphobos2.a of the distributed binary. I cannot reproduce the issue when building libphobos2.a myself.
Comment #7 by code — 2014-07-16T22:09:15Z
Doesn't happen with PIC code either.
dmd -fPIC main
Comment #8 by code — 2014-07-16T23:24:20Z
This problem seems to stem from mixed writeable flags for the
.deh/.minfo sections in PIC/non-PIC code. The ld.bfd linker would
still try to bracket the sections, even though it previously mapped
them to different segments, thereby creating one huge segment which
contains all read-only and all writeable data plus the big hole in
between them.
https://github.com/D-Programming-Language/dmd/pull/3778