"Stripped" executable still has symbols in it
"Stripped" executable still has symbols in it
- Subject: "Stripped" executable still has symbols in it
- From: Jerry Krinock <email@hidden>
- Date: Sun, 2 Dec 2007 20:01:53 -0800
Either my expectations are wrong or I don't know how to build a
"stripped" Cocoa application.
Experiment:
Create a new Cocoa Application project named StripTest. Add a
StripTestController class, and in it a -logHelloWorld method which is
invoked by -applicationDidFinishLaunching:. Build the default Release
build. Result: an executable of 38,184 bytes, and running otool on
the executable shows lots of symbols.
Clean the project, and in the target, Release, switch on "Deployment
Postprocessing", "Strip Linked Product" and "Dead Code Stripping".
Build again. Result: an executable of only 37,104 bytes. But otool
shows that only the two method implementation names are missing. The
class names and method names are all still there. So, if you just
fill in the blanks with the given names from section above, you've got
the same information as from the unstripped product.
I was expecting that a "stripped" executable would do all its jumps
using hex addresses, and running otool on it would show me no English
symbols. Is there any better way to strip a product?
I suspect not, because I see the same thing if I run otool on Apple's
Keynote and Pages executables. But why does the runtime need all
these English symbols?
Another stupid question: If all stripping did was remove two method
names, a total of 89 ASCII characters, why did the executable size
shrink by 1,080 bytes?
Jerry Krinock
****** SNIPPET OF otool OUTPUT RUN ON UNSTRIPPED BINARY:
Class Definitions
defs[0] 0x00003020
isa 0x00003060
super_class 0x00001fe9 NSObject
name 0x00001fd5 StripTestController
version 0x00000000
info 0x00000001 CLS_CLASS
instance_size 0x00000004
ivars 0x00000000 (not in an __OBJC section)
methods 0x000030a0
obsolete 0x00000000
method_count 2
method_name 0x00001fa8 applicationDidFinishLaunching:
method_types 0x00001f94 v12@0:4@8
method_imp 0x00001f83 -[StripTestController
applicationDidFinishLaunching:]
method_name 0x00001fc7 logHelloWorld
method_types 0x00001f9e v8@0:4
method_imp 0x00001f73 -[StripTestController logHelloWorld]
cache 0x00000000
protocols 0x00000000 (not in an __OBJC section)
Meta Class
isa 0x00001fe9 NSObject
super_class 0x00001fe9 NSObject
name 0x00001fd5 StripTestController
****** SAME SNIPPET OF otool OUTPUT RUN ON "STRIPPED" BINARY:
I have noted the two lines where the names were stripped.
Class Definitions
defs[0] 0x00003020
isa 0x00003060
super_class 0x00001fe9 NSObject
name 0x00001fd5 StripTestController
version 0x00000000
info 0x00000001 CLS_CLASS
instance_size 0x00000004
ivars 0x00000000 (not in an __OBJC section)
methods 0x000030a0
obsolete 0x00000000
method_count 2
method_name 0x00001fa8 applicationDidFinishLaunching:
method_types 0x00001f94 v12@0:4@8
method_imp 0x00001f81 <--- Name was stripped
method_name 0x00001fc7 logHelloWorld
method_types 0x00001f9e v8@0:4
method_imp 0x00001f71 <--- Name was stripped
cache 0x00000000
protocols 0x00000000 (not in an __OBJC section)
Meta Class
isa 0x00001fe9 NSObject
super_class 0x00001fe9 NSObject
name 0x00001fd5 StripTestController
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden