[darwinbuild] Re: Darwin 8.0.1 gcc for pentiumpro

Shantonu Sen ssen at opendarwin.org
Sun Jul 31 21:01:48 PDT 2005

On Jul 31, 2005, at 7:35 PM, Michael Franz wrote:

>> You can download these roots and place them into Roots/
>> opendarwin.org/.  Then, when darwinbuild copies files into the
>> BuildRoot, these will be used.
> If the patched version is used, how do I actually test that it is not
> producing SSE2 instructions?  Wouldn't I need to build a program that
> would generate SSE2 and try to run it on an intel install?

You can just look at the generated assembly. Like this:
[shantonu at localhost]$ cat foo.c
int foo(double a) {
   return (int)a;
[shantonu@ localhost]$ cc -S -o - -arch i386 foo.c | grep xmm
         movsd   -16(%ebp), %xmm0
         cvttsd2si       %xmm0, %eax
[shantonu@ localhost]$ cc -S -o - -arch i386 foo.c -mno-sse2 | grep xmm
[shantonu@ localhost]$ cc -S -o - -arch i386 foo.c -march=pentiumpro  
| grep xmm
[shantonu@ localhost]$

If you don't get any output for all 3 invocations, your compiler is  
not auto-generating SSE2 instructions (or at least, that's a pretty  
good metric). There are probably SSE(1) instructions that use the xmm  
registers, this is just a quick heuristic for this one program.

>   Would
> 'this' program work on Darwin 7.2.1?  Or do I need to build an entire
> Darwin 8.0.1 CD with this patched compiler?

I doubt there's useful forward binary compatibility between darwin  
x86 8.x and 7.x. At the very least, you'll find that OpenDarwin 7.2.1  
is missing /usr/lib/libmx.A.dylib, which is a drag.

To deploy the compiler, yes, you'd need to recompiling any  
frameworks, dylibs, or tools on the install media that use SSE2  
instructions. It may be sufficient just to rebuild CoreFoundation and  
IOKit, or there may be more.

When you have the new frameworks, merge them ontop of the Apple  
Darwin 8.0.1 CD contents, and then use the tail end of <http:// 
cvs.opendarwin.org/index.cgi/src/build/buildcd.sh> to build the  
hybrid filesystem for booting

echo "Building ISO ..."

# create a bootable iso-starter for i386
cd "$CDDIR"
ditto usr/standalone/i386 /tmp/i386
cd /tmp/i386
"$MKISOFS" -R -V "$VOLNAME" -no-emul-boot -T -J -c boot.cat -b cdboot  
-hide-joliet-trans-tbl $MKISOFS_QUIET -o "$I386ISO" .
sectors=`du "$I386ISO" | tail -1 | awk '{print $1}'`

# create a bootable image and remove any previous copies
cd "$CDDIR"
if [ -f "$CDDMG" -o -f "$CDDMG".dmg ]; then
         rm -f "$CDDMG" "$CDDMG".dmg
hdiutil create $HDIUTIL_QUIET "$CDDMG".dmg -size $SIZE -layout NONE
dev=`hdid -nomount "$CDDMG".dmg | tail -1 | awk '{print $1}'`
rdev=`echo $dev | sed s/disk/rdisk/`

pdisk $rdev -initialize
blocks=`pdisk $rdev -dump | grep 2: | awk -F" " '{print $4}'`
if [ "$QUIET" == "" ]; then
         pdisk $rdev -dump
# create the partition on the image
pdisk $rdev -createPartition "$VOLNAME" Apple_HFS $sectors `expr  
$blocks - $sectors`
# figure out what slice the partition was created on
slice=`pdisk $rdev -dump | grep "$VOLNAME" | awk -F: '{print $1}' |  
awk -F" " '{print $1}'`

# copy the data onto the image
dd if="$I386ISO" of=$rdev skip=64 seek=64 bs=512

newfs_hfs -v "$VOLNAME" ${rdev}s${slice}
mkdir -p /mnt
mount -t hfs -o perm ${dev}s${slice} /mnt
ditto -rsrc "$CDDIR" /mnt
bless -folder /mnt/System/Library/CoreServices -bootinfo /mnt/usr/ 
standalone/ppc/bootx.bootinfo -label "$VOLNAME"
umount /mnt
hdiutil eject $HDIUTIL_QUIET $dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-dev/attachments/20050731/d5985247/attachment.html

More information about the darwinbuild-dev mailing list