Conversation
|
Thanks for working on this as the riscv64 arch is not exactly super spread (yet) |
|
I have a visionfive2 board bought explicitly for the purpose of improving RISC-V support for PHP, I'm currently working on a RISC-V port of PHP's JIT compiler :) |
|
@danog That's great! Just be aware, Dmitry is working on a new version of the JIT, with plans to completely replace the old JIT in PHP 9.0. The goal is to have a common frontend to avoid 1:1 compilation of PHP opcodes to each individual architecture. https://github.com/dstogov/ir I'm not sure how much sense it makes to add support for new architectures in the current JIT at this point. /cc @dstogov |
|
@danog implementing new JIT back-ends through https://github.com/dstogov/ir should be much easier. |
|
I saw, your IR framework is really neat! |
Drop autoconf goo added for gcc <= 12.2, which falls back to an __atomic_exchange_1 library call for atomic ops on bytes on riscv64. At least clang-13 doesn't need this, but the AC_CHECK_LIB() autoconf check is too naive to notice. Similar to AC_SEARCH_LIBS(), PHP_CHECK_FUNC() only calls PHP_ADD_LIBRARY() if an additional library is needed to resolve the looked up symbol.. Upstream original PR: php/php-src#11321 ok sthen@ (maintainer)
clang and newer gcc releases support byte-sized atomic accesses on riscv64 through inline builtins. In both cases the hard dependency on libatomic added by GH-11321 isn't useful. Stop using AC_CHECK_LIB() which is too naive to notice that libatomic isn't needed. Instead, PHP_CHECK_FUNC() will retry the check with -latomic if required. Closes GH-11790
Fixes "undefined reference to `__atomic_exchange_1'" errors when compiling on riscv64 with GCC 12.
Newer versions of GCC should inline these atomics (https://www.mail-archive.com/[email protected]/msg283700.html), this PR fixes compilations on slightly older versions of GCC, like the one distributed on Debian 12 (currently GCC 12.2).