fix lto crash

This commit is contained in:
henderkes
2026-07-07 19:08:26 +07:00
parent 435d2c07b0
commit 3823631a58
2 changed files with 24 additions and 3 deletions

View File

@@ -50,6 +50,15 @@ class ZigToolchain implements ToolchainInterface
$extra_vars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
GlobalEnvManager::putenv("SPC_EXTRA_PHP_VARS=php_cv_have_avx512=no php_cv_have_avx512vbmi=no {$extra_vars}");
}
// An __attribute__((ifunc)) in LTO bitcode crashes zig 0.16's lld (LLVM 21)
// during thin-link symbol resolution
$all_flags = $cflags . ' ' . (getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '') . ' ' . (getenv('SPC_DEFAULT_LD_FLAGS') ?: '');
if (str_contains($all_flags, '-flto')) {
$extra_vars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
if (!str_contains($extra_vars, 'ax_cv_have_func_attribute_ifunc')) {
GlobalEnvManager::putenv("SPC_EXTRA_PHP_VARS={$extra_vars} ax_cv_have_func_attribute_ifunc=no");
}
}
}
public function getCompilerInfo(): ?string