Re: How to strip Cocoa Touch frameworks
Re: How to strip Cocoa Touch frameworks
- Subject: Re: How to strip Cocoa Touch frameworks
- From: Kyle Sluder <email@hidden>
- Date: Thu, 29 Dec 2016 16:22:56 -0600
On Thu, Dec 29, 2016, at 04:01 AM, Andreas Falkenhahn wrote:
> On 28.12.2016 at 16:44 João Varela wrote:
>
> > First of all, I sympathize with you, because I have had my share of
> > problems of hiding sensitive code, from using anti-debugger measures
> > to stripping symbols, only to find out that many symbols I thought
> > were stripped were clearly visible using Steve Nygard’s class-dump
> > utility or the Hopper disassembler or the nm tool, you name it. (I
> > always use Hopper to check how I am doing in terms of obfuscating
> > sensitive code). First of all, I assume you read this page from
> > Apple to know how to handle the stripping of symbols correctly (if not, please read it carefully):
>
> Yes, I know that and I've tried to use an exported symbols list (cf.
> my first mail on this topic) but the real problem is that as soon
> as I set "Strip Style" to "All Symbols", archiving the framework is
> no longer possible. Xcode reports the following error then:
>
> "Symbols referenced by indirect symbol table entries that can't be
> stripped in: ..."
>
> > The tips given there are quite OK for languages like C or C++ that
> > are statically typed. However, languages like objective C, like many
> > scripting languages, are dynamically typed, which means that not all
> > symbols are known at compile time and rely on the runtime to find
> > the right symbols. Because of this, when you use Objective C, you
> > cannot hide your symbols
>
> Yes, I know, but that's not a problem for me because my framework is
> 99.9% C with just a tiny Objective C layer on top of it and I don't
> mind exposing all Objective C names. But the C names should be hidden!
> (except the ones explicitly added in the exported symbols file.)
>
> > There is a "school of thought” among developers that tell you
> > clearly not to bother. [...]
>
> Thanks for your time but my problem is not so much about theory or
> obfuscation but just about the common practice that is symbol stripping.
> Cocoa Touch frameworks are basically just dylibs/shared objects and
> it should be perfectly possible to strip them. For normal macOS dylibs
> this works just fine. It's just iOS that's giving me problems here.
> It might even be a bug in Xcode.
>
> I don't think this was done on purpose or by design. Aren't there
> any people from Apple on this list who can tell more? Maybe let's
> just wait a week or so until everybody is back at work. I'll then
> bump the problem again if it hasn't been solved by then.
strip(1) is preventing you from doing something nonsensical. You can’t
have a relocatable dynamic library that *references* external symbols
without having an indirect symbol table.
You’ll note that if you leave out the step of defining a function that
calls printf(), Archive succeeds successfully. When you add that call to
printf(), the compiler emits a call to an entry in the indirect symbol
table that will be emitted by the linker. If you strip that table, that
call will wind up going nowhere.
I presume that if you statically linked libc (which I didn’t try because
it’s a bad and unsupported idea on our platforms, and I really don’t
want to figure out how to fight Xcode into doing it), you wouldn’t
encounter this error because the compiler and linker would not have
generated any indirect references.
--Kyle Sluder
>
> I appreciate your and Alex's efforts but currently we're somewhat
> just running in circles. I think I included all necessary details
> in my very first mail already. In all the other mails I'm basically
> just repeating what I already said. Anybody who is experienced with
> symbol stripping and the GCC toolchain should be able to see what the
> problem is by just reading my very first mail.
>
> So maybe let's just wait a few more days ... probably many people
> are on holiday right now or can't be bothered with this stuff.
>
> I've also posted the question to Stack Overflow now. Let's see if
> there are people who can help there. Here's the link for reference:
> http://stackoverflow.com/questions/41370990/how-to-strip-cocoa-touch-frameworks
>
> --
> Best regards,
> Andreas Falkenhahn
> mailto:email@hidden
_______________________________________________
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