Description
The following code:
./buildconf
./configure
make
Resulted in this output on FreeBSD 14 32-bit with Clang 16.0.6 (default compiler selected by the system):
ld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in ext/opcache/.libs/zend_accelerator_debug.o
>>> referenced by zend_accelerator_debug.c:58 (ext/opcache/zend_accelerator_debug.c:58)
>>> ext/opcache/.libs/zend_accelerator_debug.o:(zend_accel_error_va_args)
make: stopped in .../php-src
But I expected this output instead:
On Debian 32-bit with Clang this happens:
ext/standard/base64.o: unsupported non-PIC call to IFUNC `php_base64_encode_ex'
/usr/bin/ld: failed to set dynamic section sizes: bad value
/usr/bin/ld: /usr/bin/ld: ext/standard/base64.o: unsupported non-PIC call to IFUNC `ext/standard/base64.ophp_base64_encode_ex: unsupported non-PIC call to IFUNC `'php_base64_encode_ex
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:
|
dnl Disable PIC mode by default where it is known to be safe to do so, to avoid |
|
dnl the performance hit from the lost register. |
|
AC_MSG_CHECKING([whether to force non-PIC code in shared modules]) |
|
case $host_alias in |
|
i?86-*-linux*|i?86-*-freebsd*) |
|
if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then |
|
with_pic=no |
|
AC_MSG_RESULT(yes) |
|
else |
|
AC_MSG_RESULT(no) |
|
fi |
|
;; |
|
*) |
|
AC_MSG_RESULT(no) |
|
;; |
|
esac |
(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
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:
php-src/configure.ac
Lines 242 to 257 in bbbe56e
(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