December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic Wrote:
> Try using the unilink linker:
>
> ftp://ftp.styx.cabel.net/pub/UniLink/
>
> Get ulnb0329.zip
>
> You have to configure ulink.cfg to this:
> -zsnn.lib
> -LC:\dmd\windows\lib
> -LC:\dm\lib
> -Go
>
> -zkernel32;advapi32;user32;wsock32;shell32;snn.lib
> -LC:\dmd2\windows\lib
> -Go
>
> Then linking is just: ulink <file1>.obj <file2>.obj <lib>.obj etc..
It is nice tool. Too bad it is still beta & proprietary, or am I mistaken ?
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | > Use http://thecybershadow.net/d/mapview to get a graphical view of your app.
> E.g. on Linux it sometimes shows Afterpadding way too large.
I meant there still are some quirks though like Afterpadding shown way too large cause of ld map file parsing errors.
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bane | On 12/10/2011 7:39 AM, Bane wrote:
> Short term and long term suggestions ? Anything we can do ? I heard it is some problem with linking dead code?
>
>
>
> import std.stdio;
> int main(){
> writefln("Hello Bloat!");
> return 0;
> }
>
> dmd -release -O hello.d
>
> On Windows:
> v1.071 = 339 Kb
> v2.056 = 1017 Kb
>
> It looks very ugly and might distract some people.
If Walter simply releases a few small parts of SNN.lib, it's quite possible to use your own C runtime instead. And that will lower the executable size down to ~10 KB.
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bane | > import std.stdio; > int main(){ > writefln("Hello Bloat!"); > return 0; > } > > dmd -release -O hello.d > > On Windows: > v1.071 = 339 Kb > v2.056 = 1017 Kb $ dmd -release -O test.d 867K $ strip -s test 572K I don't know where the 300KB come from. The map files are equal: dmd -release -O -map test.d dmd -release -O -L-s -map test.d This is what Hello World looks like on x64 Linux: http://thecybershadow.net/d/mapview/view.php?id=4ee3af86c32f2 |
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | > If Walter simply releases a few small parts of SNN.lib, it's quite possible to use your own C runtime instead. And that will lower the executable size down to ~10 KB. Impossible. You forget the D runtime, type info and all the crap from phobos that gets pulled in. http://thecybershadow.net/d/mapview/view.php?id=4ee3af86c32f2 |
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Maybe it increases from 2.055.
Now std.uni module has big tables for dealing with Unicode code points
correctly.
And, the pair of 2.057 and new std.regex module has same issue.
Kenji Hara
2011/12/11 Trass3r <un@known.com>:
>> import std.stdio;
>> int main(){
>> writefln("Hello Bloat!");
>> return 0;
>> }
>>
>> dmd -release -O hello.d
>>
>> On Windows:
>> v1.071 = 339 Kb
>> v2.056 = 1017 Kb
>
>
> $ dmd -release -O test.d
> 867K
> $ strip -s test
> 572K
>
> I don't know where the 300KB come from.
> The map files are equal:
> dmd -release -O -map test.d
> dmd -release -O -L-s -map test.d
>
>
> This is what Hello World looks like on x64 Linux: http://thecybershadow.net/d/mapview/view.php?id=4ee3af86c32f2
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 12/10/2011 11:18 AM, Trass3r wrote:
>> If Walter simply releases a few small parts of SNN.lib, it's quite possible to use your own C runtime instead. And that will lower the executable size down to ~10 KB.
>
> Impossible. You forget the D runtime, type info and all the crap from phobos that gets pulled in.
> http://thecybershadow.net/d/mapview/view.php?id=4ee3af86c32f2
Sorry, I meant EXCLUDING the 'hello world' part.
i.e. a program that (literally) does nothing should not require anything except argument-parsing, which can be done through msvcrt.dll's __wgetmainargs(). So really, it should hardly need any code at all.
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | > Sorry, I meant EXCLUDING the 'hello world' part. > > i.e. a program that (literally) does nothing should not require anything except argument-parsing, which can be done through msvcrt.dll's __wgetmainargs(). So really, it should hardly need any code at all. I know it shouldn't. But currently you still have to statically link the runtime, gc, etc. even in an empty program: http://thecybershadow.net/d/mapview/view.php?id=4ee3b98636422 |
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 12/10/2011 11:59 AM, Trass3r wrote:
>> Sorry, I meant EXCLUDING the 'hello world' part.
>>
>> i.e. a program that (literally) does nothing should not require anything except argument-parsing, which can be done through msvcrt.dll's __wgetmainargs(). So really, it should hardly need any code at all.
>
> I know it shouldn't. But currently you still have to statically link the runtime, gc, etc. even in an empty program:
> http://thecybershadow.net/d/mapview/view.php?id=4ee3b98636422
Right, but my point is, I could work around (I've gotten within inches of it!) it if simply Walter released a TINY part of snn.lib -- just a handful of tiny source files regarding the TLS-related stuff, EXE segment markers, and whatnot. (I've already raised this issue before, and precisely what we would need, but it seemed to go completely ignored.)
|
December 10, 2011 Re: What can be done to reduce executable size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | > Right, but my point is, I could work around (I've gotten within inches of it!) it if simply Walter released a TINY part of snn.lib -- just a handful of tiny source files regarding the TLS-related stuff, EXE segment markers, and whatnot. (I've already raised this issue before, and precisely what we would need, but it seemed to go completely ignored.)
Nag again and again :)
|
Copyright © 1999-2021 by the D Language Foundation