Stripping D symbols?

Heywood Floyd soul8o8 at gmail.com
Sat Oct 16 08:41:39 PDT 2010



..ok, I got bored and installed Ubuntu I tried it, and there it worked fine!

# strip sym
# nm sym | grep Bunny
nm: sym: no symbols
# _


Great! The program runs fine too.
(And the binary went from a size of 399Kb to 191Kb! Woah! That's more than half gone!)

Hm, but how to I go about his now? Seems the OSX-strip is acting funny? Or could it have something to do with DMD still? Maybe I should ask in some darwin-forum about strip... 

BR
/HF






Heywood Floyd Wrote:

> Hello!
> 
> I've been trying to strip an executable created with DMD from symbols. Has anyone any experience with this?
> 
> I can't seem to rid my execs of more or less containing the entire class-tree. Example:
> 
> // sym.d - - - -
> import std.stdio;
> class Bunny{
> 	int x;
> 	int getX()
> 	{
> 		return x;
> 	}
> }
> void main()
> {
> 	auto b = new Bunny();
> 	writefln("Hello %d", b.getX() );
> }
> 
> // - - - - - (OSX 10.6)
> 
> # dmd -release sym
> # strip sym
> # nm sym | grep Bunny
> 000028c8 T _D3sym5Bunny4getXMFZi
> # _
> 
> // - - - - -
> 
> This was of course a simplified example. I tried putting "private" in front of the class, but that didn't change anything.
> 
> Any ideas? I'm just lost. Is it the same on Linux?
> 
> Or maybe this is one of those "features" that allows D to call functions by name or something? I see "T" is a text entry, by reading the man-pages..
> 
> (I suppose it really doesn't matter, but if possible I'd like to not expose function and class names in my binaries, for (I think) obvious reasons.)
> 
> 
> Kind regards
> /HF
> 
> 
> 
> 



More information about the Digitalmars-d-learn mailing list