[php-src] Issue #14467: Build fails on 32-bit Linux and FreeBSD with Clang
| From: | petk | Date: | Tue, 04 Jun 2024 12:06:57 +0000 |
| Subject: | [php-src] Issue #14467: Build fails on 32-bit Linux and FreeBSD with Clang | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247028@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14467
Author: petk
### Description
The following code:
```sh
./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:
```
# builds successfullly
```
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: 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