[79538] branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c

Ryan Schmidt ryandesign at macports.org
Fri Jun 17 15:10:06 PDT 2011


On Jun 17, 2011, at 06:30, Clemens Lang wrote:

> This means: non-universal runnable binary on x86* will actually have
> either 0xfeedface or 0xfeedfacf (both in little endian) as magic number.
> However, writing 0xfeedface or 0xfeedfacf into the code will also store
> this number in little endian on these architectures, so
> 	magic == MH_MAGIC || magic == MH_MAGIC_64
> will work just fine on these architectures. ppc and ppc64 binaries on
> x86* would not be recognoized by this code (but then, do we have any
> occassion where we're cross-compiling code to ppc just to run it under
> rosetta later?)
> 
> On PPC or PPC64 architectures the magic number will be 0xfeedface or
> 0xfeedfacf in big endian and writing 0xfeedface into the code will
> store the number in big endian, so the comparison again succeeds. From
> what I know there's no way to run i386 or x86_64 binaries on PPC(64), so
> we can safely ignore this.

Ah ok. Now I see: it'll recognize Intel single-arch binaries on Intel systems, and PowerPC single-arch binaries on PowerPC systems, and universal binaries on all systems.

You're right, there's no way to run Intel binaries on a PowerPC system. Rosetta can run ppc (but not ppc64) binaries on an Intel system (running Snow Leopard or earlier; I hear Rosetta is gone in Lion) and there aren't any cases where we should be compiling single-arch PowerPC binaries on Intel Macs. (Ports using the muniversal portgroup would compile for each arch separately, but they'll get lipo'd together into a universal binary before your code got to them.)

There's is a small selection of ports that install binaries, and I can think of exactly one that installs a ppc-only binary: CronniX.

$ port -v installed CronniX
The following ports are currently installed:
  CronniX @3.0.2_0+universal (active) platform='darwin 10' archs='i386 x86_64'
$ lipo -info /opt/local/Applications/CronniX.app/Contents/Resources/sucrontab
Non-fat file: /opt/local/Applications/CronniX.app/Contents/Resources/sucrontab is architecture: ppc
$ 

But if I remember correctly, the purpose of your branch is to locate binaries that have been compiled against old versions of libraries installed using MacPorts. And even if the odd port like CronniX installs binaries of a weird architecture, they won't be linked with anything from MacPorts.

So all this is a roundabout way of saying I now agree your code is correct. Thanks for taking the time to explain it to me. :)




More information about the macports-dev mailing list