Skip to content

Fix linking with clang on 32-bit x86: don't use ifunc resolvers - #24362

Open
marc-mabe wants to merge 1 commit into
php:masterfrom
marc-mabe:fix/mbstring-ifunc-i386-clang
Open

marc-mabe wants to merge 1 commit into
php:masterfrom
marc-mabe:fix/mbstring-ifunc-i386-clang

Conversation

@marc-mabe

Copy link
Copy Markdown
Contributor

Building for 32-bit x86 with clang (tested: clang 21.1.8, -m32) fails to link:

ld: ext/mbstring/mbstring.o: unsupported non-PIC call to IFUNC `mb_fast_check_utf8'

clang calls an ifunc defined in the same translation unit directly (R_386_PC32) instead of through the PLT, which the linker rejects for PIE output. php_addslashes and php_base64_* are affected the same way. Such calls exist since PHP 7.3.

Fix: don't use ifunc resolvers with clang on i386, falling back to the existing function-pointer dispatch. GCC and x86-64 are unchanged.

Building for 32-bit x86 with clang (tested: clang 21.1.8, `-m32`) fails to link:

```
ld: ext/mbstring/mbstring.o: unsupported non-PIC call to IFUNC `mb_fast_check_utf8'
```

clang calls an ifunc defined in the same translation unit directly (`R_386_PC32`) instead of through the PLT, which the linker rejects for PIE output. `php_addslashes` and `php_base64_*` are affected the same way. Such calls exist since PHP 7.3.

Fix: don't use ifunc resolvers with clang on i386, falling back to the existing function-pointer dispatch. GCC and x86-64 are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant