• 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: Universal Binary static data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Universal Binary static data


  • Subject: Re: Universal Binary static data
  • From: Henri Asseily <email@hidden>
  • Date: Fri, 15 Sep 2006 16:28:17 +0200



On Sep 15, 2006, at 2:50 PM, Matt Mashyna wrote:

I have an application that uses a universal, dynamic library. There is some static data that gets modified as a security check. I know this is a bad practice but that's how it works on my client's windows scheme so...

I can locate this static data in the dylib. The linker makes two sets of static data; PPC and Intel. The problem is that when it's built on a PPC machine the PPC part is first followed by the Intel part. When it's built on Intel the opposite is true.

I think it must be a linker issue. Is there a way to force Xcode to always put them in a specific order no matter what platform it's built on ? Or is there a way to tell what order they are in by examining a header ?

From the Mac OS X ABI Mach-O File Format Reference:
--
A binary that contains code for more than one architecture always begins with a fat_header data structure, followed by two fat_arch data structures and the actual data for the architectures contained in the file. All data in these data structures is stored in big- endian byte order.
--


What you need to do is read the fat_header data structure, that will specify how many fat_arch data structures exist (fat_header- >nfat_arch). You then iterate through those and grab the architecture type in each (fat_archs[i]->cpu_type). You can also get the offset and size of each data structure to go straight into what you want to change.

Look at /usr/include/mach-o/fat.h, and the otool command line source code (in the cctools darwin package).

Better yet:

http://developer.apple.com/samplecode/CheckExecutableArchitecture/ listing1.html


HTH, H _______________________________________________ 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
  • Follow-Ups:
    • Re: Universal Binary static data
      • From: Matt Mashyna <email@hidden>
References: 
 >Universal Binary static data (From: Matt Mashyna <email@hidden>)

  • Prev by Date: Re: If build errors, then don't debug
  • Next by Date: Re: Universal Binary static data
  • Previous by thread: Universal Binary static data
  • Next by thread: Re: Universal Binary static data
  • Index(es):
    • Date
    • Thread