• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Stripped" executable still has symbols in it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Stripped" executable still has symbols in it


  • Subject: Re: "Stripped" executable still has symbols in it
  • From: Eric Albert <email@hidden>
  • Date: Sun, 02 Dec 2007 20:21:47 -0800

Objective-C's dynamic nature means that Obj-C symbols can't be stripped. Otherwise you wouldn't be able to do runtime lookup of classes and methods. So symbol stripping is mostly useful for removing C and C++ symbols.

Hope this helps,
Eric

On Dec 2, 2007, at 8:01 PM, Jerry Krinock wrote:

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
References: 
 >"Stripped" executable still has symbols in it (From: Jerry Krinock <email@hidden>)

  • Prev by Date: "Stripped" executable still has symbols in it
  • Next by Date: Re: "Stripped" executable still has symbols in it
  • Previous by thread: "Stripped" executable still has symbols in it
  • Next by thread: Re: "Stripped" executable still has symbols in it
  • Index(es):
    • Date
    • Thread