I was looking at mod_trace (http://prefetch.net/projects/apache_modtrace/index.html ) and playing with getting it to compile on OS X.

When building for x86_64 with -arch x86_64 we get bad instructions generated:

gcc -o foo  -arch x86_64 foo.c
/var/folders/rV/rV1x2DafFr0R6tGG+1bbk++++TM/-Tmp-//ccnykQ1o.s:11:bad register name `%%esi)'


Using gcc -S I can definitely see we are not generating correct code:

LCFI1:
        __dtrace_probe$6_foo___probe__noargs:
        nop
        leal 0(%%esi), %%esi

Building with -arch i386 works, DTRACE_PROBE1, etc also seem to work on OS X based on the building mod_trace.

I attach a simple reproducer, changing the Makefile to build with - arch i386 works. Simply extract onto a Leopard box, cd into the extracted dir and run make to see the failure. make foo.s will create the generated asm.

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable- checking -enable-werror --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/ $/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/ lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic -- host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)
$ dtrace -V
dtrace: Sun D 1.2.2

Paul

Attachment: dtrace-osx-bug.tgz
Description: Binary data


_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to