Search code examples
iosmach-o

How can I sections out of __TEXT and into a new segment for a mach-o binary?


How can I move sections out of the __TEXT segment and into a new segment for a mach-o binary? The reason I'm asking is that I'm trying to make my iPhone app smaller, and the iOS App Store encrypts the __TEXT segment of it prior to compression so that it doesn't compress at all. If I can move all the non-executable sections out of that segment and into a new read-only segment, then I can trim the size of my app by about 9%.


Solution

  • ld's -rename_section flag does the job.