Re: Universal Binary static data
Re: Universal Binary static data
- Subject: Re: Universal Binary static data
- From: Matt Mashyna <email@hidden>
- Date: Fri, 15 Sep 2006 10:42:43 -0400
Thanks for the tips. Just what I was looking for.
Matt
On Sep 15, 2006, at 10:28 AM, Henri Asseily wrote:
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