Hi, I was trying to build php using LLVM/Clang (trunk) on Mac OS X, 10.5.6. http://downloads.php.net/johannes/php-5.3.0RC1.tar.bz2 Apple gcc works. Clang generates a buggy executable. under php source root, CC=clang ./configure --disable-all make make test The resulting `php' will crash, even with an empty php file. Argument strings on the stack at: c0000000 ./sapi/cli/php #0 0x00181daf in ZEND_RETURN_SPEC_CONST_HANDLER () #1 0x00164db7 in execute () #2 0x001436fd in zend_execute_scripts () #3 0x000ee779 in php_execute_script () #4 0x001c18c2 in main () Clang works well when building php in debug mode. CC=clang ./configure --disable-all --enable-debug Is this a problem with the LLVM optimizer or the Clang front-end? Thanks. - xi
Hi, I downloaded the file here, and used the same commands. This is what I got: Number of tests : 9537 5371 Tests skipped : 4166 ( 43.7%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 7 ( 0.1%) ( 0.1%) Expected fail : 3 ( 0.0%) ( 0.1%) Tests passed : 5361 ( 56.2%) ( 99.8%) I'm on linux x86_64 with clang version: "clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 68002M)". Not sure why it's working here... - Anders On Fri, Apr 3, 2009 at 5:12 PM, Xi Wang <xi.wang at gmail.com> wrote:> Hi, > > I was trying to build php using LLVM/Clang (trunk) on Mac OS X, 10.5.6. > http://downloads.php.net/johannes/php-5.3.0RC1.tar.bz2 > > Apple gcc works. > > Clang generates a buggy executable. under php source root, > CC=clang ./configure --disable-all > make > make test > > The resulting `php' will crash, even with an empty php file. > > Argument strings on the stack at: c0000000 > ./sapi/cli/php > #0 0x00181daf in ZEND_RETURN_SPEC_CONST_HANDLER () > #1 0x00164db7 in execute () > #2 0x001436fd in zend_execute_scripts () > #3 0x000ee779 in php_execute_script () > #4 0x001c18c2 in main () > > Clang works well when building php in debug mode. > CC=clang ./configure --disable-all --enable-debug > > Is this a problem with the LLVM optimizer or the Clang front-end? Thanks. > > - xi > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Apr 3, 2009, at 8:12 AM, Xi Wang wrote:> Hi, > > I was trying to build php using LLVM/Clang (trunk) on Mac OS X, > 10.5.6. > http://downloads.php.net/johannes/php-5.3.0RC1.tar.bz2 > > Apple gcc works. > > Clang generates a buggy executable. under php source root, > CC=clang ./configure --disable-all > make > make test > > The resulting `php' will crash, even with an empty php file. > > Argument strings on the stack at: c0000000 > ./sapi/cli/php > #0 0x00181daf in ZEND_RETURN_SPEC_CONST_HANDLER () > #1 0x00164db7 in execute () > #2 0x001436fd in zend_execute_scripts () > #3 0x000ee779 in php_execute_script () > #4 0x001c18c2 in main () > > Clang works well when building php in debug mode. > CC=clang ./configure --disable-all --enable-debug > > Is this a problem with the LLVM optimizer or the Clang front-end? > Thanks.It is impossible to tell with this amount of detail. Does it work correctly if you build with -O0 ? -Chris
Thanks! I only tried Mac OS X and Linux, both 32 bit. I will find a linux x86_64. - xi On Fri, Apr 3, 2009 at 12:07 PM, Anders Johnsen <skabet at gmail.com> wrote:> Hi, > > I downloaded the file here, and used the same commands. > > This is what I got: > > Number of tests : 9537 5371 > Tests skipped : 4166 ( 43.7%) -------- > Tests warned : 0 ( 0.0%) ( 0.0%) > Tests failed : 7 ( 0.1%) ( 0.1%) > Expected fail : 3 ( 0.0%) ( 0.1%) > Tests passed : 5361 ( 56.2%) ( 99.8%) > > I'm on linux x86_64 with clang version: "clang version 1.0 > (http://llvm.org/svn/llvm-project/cfe/trunk 68002M)". Not sure why > it's working here... > > - Anders > > On Fri, Apr 3, 2009 at 5:12 PM, Xi Wang <xi.wang at gmail.com> wrote: >> Hi, >> >> I was trying to build php using LLVM/Clang (trunk) on Mac OS X, 10.5.6. >> http://downloads.php.net/johannes/php-5.3.0RC1.tar.bz2 >> >> Apple gcc works. >> >> Clang generates a buggy executable. under php source root, >> CC=clang ./configure --disable-all >> make >> make test >> >> The resulting `php' will crash, even with an empty php file. >> >> Argument strings on the stack at: c0000000 >> ./sapi/cli/php >> #0 0x00181daf in ZEND_RETURN_SPEC_CONST_HANDLER () >> #1 0x00164db7 in execute () >> #2 0x001436fd in zend_execute_scripts () >> #3 0x000ee779 in php_execute_script () >> #4 0x001c18c2 in main () >> >> Clang works well when building php in debug mode. >> CC=clang ./configure --disable-all --enable-debug >> >> Is this a problem with the LLVM optimizer or the Clang front-end? Thanks. >> >> - xi >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Fri, Apr 3, 2009 at 12:07 PM, Chris Lattner <clattner at apple.com> wrote:> It is impossible to tell with this amount of detail. Does it work > correctly if you build with -O0 ?Yes, with -O0 the resulting executable looks fine. --enable-debug actually sets -O0 (otherwise -O2). Clang can build/test php 5.2.9 with either -O0 or -O2, but not for php 5.3RC0 with -O2. I further looked into the php code. It seems that php 5.3 is using inline asm. Is that the reason? - xi