php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75951 The 'asm goto' constructs are not supported by LLVM
Submitted: 2018-02-11 12:53 UTC Modified: 2020-11-18 14:20 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:1 (20.0%)
From: serghei at phalconphp dot com Assigned: cmb (profile)
Status: Not a bug Package: *General Issues
PHP Version: master-Git-2018-02-11 (Git) OS: Linux
Private report: No CVE-ID: None
 [2018-02-11 12:53 UTC] serghei at phalconphp dot com
Description:
------------
There is a few places with code like `__asm__ goto`. For example Zend/zend_operators.h:532

```
	__asm__ goto(
		"decq (%0)\n\t"
		"jo  %l1\n"
		:
		: "r"(&op1->value)
		: "cc", "memory"
		: overflow);
	return;
```

Please avoid using `asm goto` as it not supported by LLVM.

Refs: https://bugs.llvm.org/show_bug.cgi?id=9295


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-11 13:05 UTC] serghei at phalconphp dot com
There are a few places with code like __asm__ goto. For example Zend/zend_operators.h:532


	__asm__ goto(
		"decq (%0)\n\t"
		"jo  %l1\n"
		:
		: "r"(&op1->value)
		: "cc", "memory"
		: overflow);
	return;


Please avoid using 'asm goto' as it not supported by LLVM.

Refs: https://bugs.llvm.org/show_bug.cgi?id=9295
 [2018-02-11 15:08 UTC] danack@php.net
The asm goto is wrapped inside a #if defined(HAVE_ASM_GOTO)

Asking a project to avoid using a construct to support a particular compiler is unlikely to get the result you want.

You (or someone else) who cares about compiling on LLVM would be better off asking for (or even better submitting) a patch to the build configuration to stop HAVE_ASM_GOTO being defined for the LLVM compiler.
 [2018-02-11 16:48 UTC] levim@php.net
Supposedly we are checking this at configure time already: https://github.com/php/php-src/blob/c718970e9e48d49c19933f2e4d2cd680094be79f/configure.ac#L767-L778.

What version of Clang are you using?
 [2018-02-11 17:16 UTC] serghei at phalconphp dot com
Hello danack@

I hope that you are going good.

Please stop decide what exactly I want. It is just my bug report, not my wants. I faced with it on Travis CI by testing on it on latest GCC/LLVM.

Thank you
Have a nice day
 [2018-02-11 17:20 UTC] spam2 at rhsoft dot net
yes, it's your bugreport but at the wrong bugtracker
https://bugs.llvm.org/
 [2018-02-11 17:26 UTC] serghei at phalconphp dot com
c
 [2018-02-11 17:30 UTC] serghei at phalconphp dot com
Please note 'asm goto' is a PHP contributor's bug, not LLVM. The 'asm goto' is not implemented everywhere. Right now I can't build latest PHP using LLVM.
 [2018-02-11 17:38 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2018-02-11 17:38 UTC] nikic@php.net
As others have already set, this issue should not exist since https://github.com/php/php-src/commit/4e0b3c0c4c27cddcff6013a2c408597bbe87d2d5.

Can you please provide your configure.log?
 [2018-02-12 11:52 UTC] serghei at phalconphp dot com
Hi nikic@,

Unfortunately configure.log does not exists. Current configure output is: 

============================== cut ==============================

checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for icc... no
checking for suncc... no
checking whether clang and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /home/travis/.phpenv/versions/master
checking for PHP includes... -I/home/travis/.phpenv/versions/master/include/php -I/home/travis/.phpenv/versions/master/include/php/main -I/home/travis/.phpenv/versions/master/include/php/TSRM -I/home/travis/.phpenv/versions/master/include/php/Zend -I/home/travis/.phpenv/versions/master/include/php/ext -I/home/travis/.phpenv/versions/master/include/php/ext/date/lib
checking for PHP extension directory... /home/travis/.phpenv/versions/master/lib/php/extensions/no-debug-zts-20170718
checking for PHP installed headers prefix... /home/travis/.phpenv/versions/master/include/php
checking if debug is enabled... no
checking if zts is enabled... yes
checking for re2c... re2c
checking for re2c version... 0.13.6 (ok)
checking for gawk... gawk
checking whether to enable Zephir Parser... yes, shared
checking for ld used by clang... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from clang object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if clang supports -fno-rtti -fno-exceptions... yes
checking for clang option to produce PIC... -fPIC
checking if clang PIC flag -fPIC works... yes
checking if clang static flag -static works... yes
checking if clang supports -c -o file.o... yes
checking whether the clang linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

============================== cut ==============================

Compile output:

============================== cut ==============================

In file included from /home/travis/build/phalcon/php-zephir-parser/parser/parser.c:1:
In file included from /home/travis/.phpenv/versions/master/include/php/main/php.h:35:
In file included from /home/travis/.phpenv/versions/master/include/php/Zend/zend.h:333:
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:482:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:532:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:589:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
In file included from /home/travis/build/phalcon/php-zephir-parser/parser/scanner.c:15:
In file included from /home/travis/.phpenv/versions/master/include/php/main/php.h:35:
In file included from /home/travis/.phpenv/versions/master/include/php/Zend/zend.h:333:
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:482:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:532:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:589:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:679:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:679:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
In file included from /home/travis/build/phalcon/php-zephir-parser/zephir_parser.c:19:
In file included from /home/travis/.phpenv/versions/master/include/php/main/php.h:35:
In file included from /home/travis/.phpenv/versions/master/include/php/Zend/zend.h:333:
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:482:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:532:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:589:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/home/travis/.phpenv/versions/master/include/php/Zend/zend_operators.h:679:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^

============================== cut ==============================

Should I provide something else?

Best wishes,
 [2018-02-12 12:10 UTC] nikic@php.net
Sorry, the name of the file is config.log, not configure.log. Please post it on something like gist.github.com instead of directly in the bug tracker, as the file will be very large.
 [2018-02-14 10:38 UTC] serghei at phalconphp dot com
Hello nikic,

Here is config.log
http://vpaste.net/UDArc
 [2018-02-14 12:08 UTC] nikic@php.net
Okay, so my guess here is that you (successfully) built PHP using gcc, which generated a config.h for gcc with asm goto support, and then you are building an extension using clang (against a gcc-built PHP assuming support for asm goto). Is that correct?
 [2018-02-14 13:28 UTC] serghei at phalconphp dot com
Actually no. I use Travis CI build matrix to phpize/configure each time for now. Here is compiler martix .travis.yml (relevant part):

compiler:
    - gcc
    - clang

env:
    global:
        - CFLAGS="-g3 -O0 -Wall -fvisibility=hidden"
        - ZEND_DONT_UNLOAD_MODULES=1
        - USE_ZEND_ALLOC=0
        - REPORT_EXIT_STATUS=1
        - NO_INTERACTION=1
    matrix:
        - CC="gcc" RE2C_VERSION="0.13.6"
        - CC="clang" RE2C_VERSION="0.13.6"
        - CC="gcc" RE2C_VERSION="1.0.3"
        - CC="clang" RE2C_VERSION="1.0.3"

matrix:
    fast_finish: true
    allow_failures:
        - php: nightly
    exclude:
        - env: CC="gcc"
          compiler: clang
        - env: CC="clang"
          compiler: gcc
 [2018-06-10 15:05 UTC] cmb@php.net
Is that still unresolved for PHP-7.3.0alpha1?
 [2018-06-24 04:25 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2018-06-25 07:40 UTC] serghei at phalconphp dot com
This is still unresolved. Feedback was provided. Please reopen the ticket.
 [2018-06-25 07:54 UTC] requinix@php.net
-Status: No Feedback +Status: Open
 [2018-06-25 07:54 UTC] requinix@php.net
There was a question about whether this has been fixed in the 7.3.0 alpha.
 [2018-08-28 09:01 UTC] julien dot voisin+php at dustri dot org
I can reproduce the issue with "PHP 7.4.0-dev (cli) (built: Aug 28 2018 06:11:44) ( ZTS )" : https://travis-ci.org/nbs-system/snuffleupagus/jobs/421463652
 [2019-01-19 11:56 UTC] serghei at phalconphp dot com
I realized why this happens. I think because PHP at Travis CI was compiled using GCC (see phpenv project). So, I think this issue may be closed
 [2020-11-18 14:20 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-11-18 14:20 UTC] cmb@php.net
> I think because PHP at Travis CI was compiled using GCC (see
> phpenv project).

That.  phpize builds require the current build environment to
be compatible to the one which was used for building PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 06:01:28 2024 UTC