• 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: strip -R not working on GCC 4 generated binaries?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strip -R not working on GCC 4 generated binaries?


  • Subject: Re: strip -R not working on GCC 4 generated binaries?
  • From: Chris Espinosa <email@hidden>
  • Date: Mon, 23 May 2005 10:49:44 -0700

On May 23, 2005, at 9:30 AM, Jim Correia wrote:

On May 21, 2005, at 12:08 PM, Chris Espinosa wrote:



gcc 4.0 has a build setting for hiding symbols:


that is enabled by default.  Do an nm on each of the resulting binary and you'll see that the _Foo symbol is marked "T" (exported) in gcc 3.3 but "t" (non-exported) in gcc 4.0.


You can either skip the strip step when using gcc 4 and let it do the stripping for you (which saves you having to maintain your symbols file), or turn the option off to get equivalent behavior between gcc3 and gcc4.


You can control symbol visibility inline, too:



Turning the option off makes my strip phase work again - thanks.


If there is a better way to get the end result that I'm after, I'm all ears too. What I've been doing is building release builds with debug symbols, then stripping with -S so that user crash logs have a backtrace. As an additional step I strip with strip -R to remove "sensitive" symbol names like serial number validation, etc. If there is a better way to do this with the current toolchain, I'll do it that way. Hints?


You could skip the -R phase by marking the "sensitive" symbols hidden in source with __attribute__((visibility("hidden"))).  That has the advantage of declaring the visibility along with the function declaration, so it's less likely to experience a disconnect between your source and your exports file.  See the following article for more details:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html#//apple_ref/doc/uid/TP40001670-97603

The second solution is to just strip everything in your release builds, then symbolicate your backtraces when users send them to you:

http://developer.apple.com/technotes/tn2004/tn2123.html

Chris
 _______________________________________________
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: 
 >strip -R not working on GCC 4 generated binaries? (From: Jim Correia <email@hidden>)
 >Re: strip -R not working on GCC 4 generated binaries? (From: Chris Espinosa <email@hidden>)
 >Re: strip -R not working on GCC 4 generated binaries? (From: Jim Correia <email@hidden>)

  • Prev by Date: Line display doesn't work properly
  • Next by Date: Re: cmath, math.h, and isnan
  • Previous by thread: Re: strip -R not working on GCC 4 generated binaries?
  • Next by thread: How to see the compiler command / output??
  • Index(es):
    • Date
    • Thread