[darwinbuild] Re: Darwin 8.0.1 gcc for pentiumpro
Kevin, On 5/11/05, Kevin Van Vechten <kevin@opendarwin.org> wrote:
As many have noticed, the gcc included in Darwin 8.0.1 targets Pentium 4 with SSE2. I've patched GCC to target Pentium Pro, and uploaded the roots (and diffs):
<http://opendarwin.org/~kevin/downloads/gcc_pentiumpro_8A428/>
gcc-4061.root.tar.gz (50MB) gcc_os-1809.root.tar.gz (29MB) gcc_os_35-3506.root.tar.gz (49MB)
I don't have any pre-P4 machines to test on, so if someone could test the output of these on a pentium pro or later, I'd appreciate the feedback.
How can I test this using the latest darwinbuild 0.5? I can build from a G3 running OS X 10.3 and try to run on an Athlon XP running OpenDarwin 7.2.1. Also, how do I perform a 'make clean' once a package has been built? Michael
On Jun 10, 2005, at 5:43 AM, Michael Franz wrote:
Kevin,
On 5/11/05, Kevin Van Vechten <kevin@opendarwin.org> wrote:
As many have noticed, the gcc included in Darwin 8.0.1 targets Pentium 4 with SSE2. I've patched GCC to target Pentium Pro, and uploaded the roots (and diffs):
<http://opendarwin.org/~kevin/downloads/gcc_pentiumpro_8A428/>
gcc-4061.root.tar.gz (50MB) gcc_os-1809.root.tar.gz (29MB) gcc_os_35-3506.root.tar.gz (49MB)
I don't have any pre-P4 machines to test on, so if someone could test the output of these on a pentium pro or later, I'd appreciate the feedback.
How can I test this using the latest darwinbuild 0.5? I can build from a G3 running OS X 10.3 and try to run on an Athlon XP running OpenDarwin 7.2.1.
You can download these roots and place them into Roots/ opendarwin.org/. Then, when darwinbuild copies files into the BuildRoot, these will be used.
Also, how do I perform a 'make clean' once a package has been built?
You can clean out the entire BuildRoot directory. Otherwise, there's not much need to do a 'make clean' since the build number gets incremented each time, so you'll start with a fresh OBJROOT, SYMROOT, and DSTROOT with each build. - Kevin
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? 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? Michael
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. 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 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
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.
I can't find CoreFoundation as a project. Is IOKit, IOKitUser or IOKitTools? IOKitUser doesn't build since it depends on Bom.h. IOKitTools will not build since it needs xcodebuild. Michael
OK, I found CF and Rob Braun's patches for a few packages. I will see how far I get. On 8/6/05, Michael Franz <mvfranz@gmail.com> wrote:
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.
I can't find CoreFoundation as a project. Is IOKit, IOKitUser or IOKitTools? IOKitUser doesn't build since it depends on Bom.h. IOKitTools will not build since it needs xcodebuild.
Michael
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.
When I run this test on the base install, 1 & 3 have output, the same for using the patched roots. However, when I build the patched gcc myself, the resulting compiler produces no mmx results. So, do I infer that the patched roots ARE producing SSE2, but that the gcc patch does work? Michael
The patched roots work for me (at least gcc_os (gcc 3.3) did). How did you install it? Shantonu On Aug 6, 2005, at 7:57 AM, Michael Franz wrote:
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.
When I run this test on the base install, 1 & 3 have output, the same for using the patched roots. However, when I build the patched gcc myself, the resulting compiler produces no mmx results. So, do I infer that the patched roots ARE producing SSE2, but that the gcc patch does work?
Michael
On 8/7/05, Shantonu Sen <ssen@opendarwin.org> wrote:
The patched roots work for me (at least gcc_os (gcc 3.3) did). How did you install it?
Shantonu
I copied the downloaded version to /usr/local/share/darwinbuild/cache/Roots/8A428/ and named it gcc.root.tar.gz. Removed everything in the Build8A28/BuildRoot directory, and then did darwinbuild gcc. Once the build root environment was created,I then ran: /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c | grep xmm > test1.out /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c -mno-sse2 | grep xmm > test2.out /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c -march=pentiumpro | grep xmm > test3.out For testing the built versions, I change the path to gcc-4.0 in the Symbols directory.
Woah, dude, that's not how you run gcc. gcc invokes language-specific backends, for example /usr/libexec/gcc/darwin/ppc/3.3/cc1. It sounds like you used a Kevin's gcc driver but not the language backend. Don't do that. You need to chroot into the build root to use it properly. Shantonu On Aug 7, 2005, at 8:32 AM, Michael Franz wrote:
On 8/7/05, Shantonu Sen <ssen@opendarwin.org> wrote:
The patched roots work for me (at least gcc_os (gcc 3.3) did). How did you install it?
Shantonu
I copied the downloaded version to /usr/local/share/darwinbuild/cache/Roots/8A428/ and named it gcc.root.tar.gz. Removed everything in the Build8A28/BuildRoot directory, and then did darwinbuild gcc.
Once the build root environment was created,I then ran: /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c | grep xmm > test1.out /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c -mno-sse2 | grep xmm > test2.out /var/root/development/Build8A428/BuildRoot/usr/bin/gcc -S -o - -arch i386 foo.c -march=pentiumpro | grep xmm > test3.out
For testing the built versions, I change the path to gcc-4.0 in the Symbols directory.
On 8/7/05, Shantonu Sen <ssen@opendarwin.org> wrote:
Woah, dude, that's not how you run gcc. gcc invokes language-specific backends, for example /usr/libexec/gcc/darwin/ppc/3.3/cc1.
It sounds like you used a Kevin's gcc driver but not the language backend. Don't do that. You need to chroot into the build root to use it properly.
Shantonu
I think I figured out what was going on. Since I was using the gcc-4061 but not gcc_os-1809 I was not using the patched version of gcc 3.3, and only installing the patched version of gcc 4.0, which was not being used in the builds. So.... I know understand that gcc-4061 is gcc 4.0 and gcc_os-1809 is gcc 3.3. That helps. It will take a few hours for my current builds to finish, but I am sure I will have the same results as you. Michael
participants (3)
-
Kevin Van Vechten
-
Michael Franz
-
Shantonu Sen