Open petk opened 5 months ago
Might not be related but ifunc had been disabled for quite a time on freebsd then had been enabled for freebsd >= 12 months ago. But nielsdos was willing to look into this I believe so we ll see :)
To keep in mind for future update
FreeBSD 15.0 is not expected to include support for 32-bit platforms other than armv7. The armv6, i386, and powerpc platforms are deprecated and will be removed. 64-bit systems will still be able to run older 32-bit binaries.
We expect to support armv7 as a Tier 2 architecture in FreeBSD 15.0 and stable/15. However, we also anticipate that armv7 may be removed in FreeBSD 16.0. We will provide an update on the status of armv7 for both 15.x and 16.x at the time of 15.0 release.
Support for executing 32-bit binaries on 64-bit platforms via the COMPAT_FREEBSD32 option will continue for at least the stable/15 and stable/16 branches. Support for compiling individual 32-bit applications via cc -m32 will also continue for at least the stable/15 branch, which includes suitable headers in /usr/include and libraries in /usr/lib32.
Ports will not include support for deprecated 32-bit platforms for FreeBSD 15.0 and later releases. These future releases will not include binary packages or support for building packages from ports for deprecated 32-bit platforms.
I can reproduce this for FreeBSD at least, didn't test for Linux (yet). The FreeBSD issue is not related to ifuncs but is simply because the opcache dso in this case is not built with PIC. I guess it should be auto-enabled on this platform.
You can reproduce the problem simply with:
int x;
int foo(void) { return x; }
Compile with clang -shared file.c -o file.so
and observe the same error.
It doesn't happen on 64-bit because IIRC fPIC is mandatory there.
We have a report of this as well with our hardened gcc: https://bugs.gentoo.org/930145
Description
The following code:
Resulted in this output on FreeBSD 14 32-bit with Clang 16.0.6 (default compiler selected by the system):
But I expected this output instead:
On Debian 32-bit with Clang this happens:
When using GCC it works ok. Issue is that there is a check to disable PIC mode for shared extensions on 32-bit Linux and FreeBSD: https://github.com/php/php-src/blob/bbbe56eecc6ff6b3971ba4f924d51c9aa11955c5/configure.ac#L242-L257
(Probably solution would be to skip the non-PIC mode for Clang on 32-bit)
PHP Version
PHP 8.2, 8.3 and 8.4-dev
Operating System
32-bit Linux and FreeBSD