[php-src] Issue #7914: Building litespeed sapi on riscv64 fails
| From: | andypost | Date: | Sat, 08 Jan 2022 17:46:01 +0000 |
| Subject: | [php-src] Issue #7914: Building litespeed sapi on riscv64 fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238883@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7914
Author: andypost
### Description
Building with
--enable-litespeed on risv64 fails with
```
/usr/lib/gcc/riscv64-alpine-linux-musl/10.3.1/../../../../riscv64-alpine-linux-musl/bin/ld:
sapi/litespeed/.libs/lsapilib.o: in function `lsapi_close_connection':
/home/buildozer/aports/community/php7/src/php-7.4.20/sapi/litespeed/lsapilib.c:438: undefined
reference to `__sync_lock_test_and_set_1'
/usr/lib/gcc/riscv64-alpine-linux-musl/10.3.1/../../../../riscv64-alpine-linux-musl/bin/ld:
sapi/litespeed/.libs/lsapilib.o: in function `LSAPI_Prefork_Accept_r':
/home/buildozer/aports/community/php7/src/php-7.4.20/sapi/litespeed/lsapilib.c:3572: undefined
reference to `__sync_lock_test_and_set_1'
/usr/lib/gcc/riscv64-alpine-linux-musl/10.3.1/../../../../riscv64-alpine-linux-musl/bin/ld:
sapi/litespeed/.libs/lsapilib.o: in function `lsapi_prefork_server_accept':
/home/buildozer/aports/community/php7/src/php-7.4.20/sapi/litespeed/lsapilib.c:3157: undefined
reference to `__sync_lock_test_and_set_1'
collect2: error: ld returned 1 exit status
make: *** [Makefile:404: sapi/litespeed/php] Error 1
```
Debug shows that it caused by usage __sync_lock_test_and_set_1 with constant, see https://gitlab.alpinelinux.org/alpine/aports/-/issues/12775#note_204733
> Two solutions:
1. Get PHP upstream to use something other than ё__sync_lock_test_and_setё if they need to store
values other than the immediate constant 1 since GCC upstream explicitly documents that this is not
supported on all architectures.
2. Get GCC upstream to support __sync_lock_test_and_set with values other than a
immediate constant 1 on the RISC-V architecture (if technically possible).
It fails for all supported versions 7.4+ but 8.0+ is priority
### PHP Version
PHP 8.0+
### Operating System
Alpinelinux