[php-src] Issue #19250: Invalid conftest for rl_pending_input when compiling with -flto(=thin)
| From: | henderkes | Date: | Sat, 26 Jul 2025 15:33:42 +0000 |
| Subject: | [php-src] Issue #19250: Invalid conftest for rl_pending_input when compiling with -flto(=thin) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250501@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19250
Author: henderkes
### Description
The following code:
```c
| char rl_pending_input ();
| int
| main (void)
| {
| return rl_pending_input ();
| ;
| return 0;
| }
```
```console
zig-cc -o conftest -flto=thin conftest.c -lreadline >&5
```
Resulted in this output:
```
ld.lld: error: undefined symbol: rl_pending_input
>>> referenced by conftest.c:6
>>>
>>> /home/m/.cache/zig/o/b805c69c22df553bed686894c3b10bd7/conftest.lto.conftest.o:(main)
```
But I expected this output instead:
```
configure:69337: $? = 0
configure:69347: result: yes
```
In my understanding, this comes down to LLVM IR code embedding type information for symbols.
rl_pending_output is defined as an int. Linking against a function
char rl_pending_order() works without lto because it ignores type information, but with
lto it's a mismatch and the function is indeed undefined.
Passing ac_cv_lib_readline_rl_pending_input=yes to compilation works around the issue
and php cli and fpm compile successfully. Embed SAPI fails, but that's for a different ticket.
### PHP Version
```plain
8.X
```
### Operating System
All unix systems