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@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.
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
fi
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
fi
# 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