mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
add -lcompiler_rt to SPC_COMPILER_EXTRA instead
This commit is contained in:
@@ -233,8 +233,7 @@ class Extension
|
||||
if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) {
|
||||
$prefix = $matches[1];
|
||||
$currentLibs = trim($matches[2]);
|
||||
$lzig = ToolchainManager::getToolchainClass() === ZigToolchain::class ? '-lcompiler_rt -lunwind' : '';
|
||||
$newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp} {$lzig}");
|
||||
$newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp}");
|
||||
$deduplicatedLibs = deduplicate_flags($newLibs);
|
||||
|
||||
FileSystem::replaceFileRegex(
|
||||
|
||||
@@ -65,7 +65,8 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
// php 8.5 contains opcache extension by default,
|
||||
// if opcache_jit is enabled for 8.5 or opcache enabled,
|
||||
// we need to disable undefined behavior sanitizer.
|
||||
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined');
|
||||
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
|
||||
f_putenv('SPC_COMPILER_EXTRA=' . trim($compiler_extra . ' -fno-sanitize=undefined'));
|
||||
}
|
||||
|
||||
if ($this->getOption('enable-zts', false)) {
|
||||
|
||||
@@ -64,6 +64,12 @@ class ZigToolchain implements ToolchainInterface
|
||||
$extra_libs = trim($extra_libs . ' -lunwind');
|
||||
GlobalEnvManager::putenv("SPC_EXTRA_LIBS={$extra_libs}");
|
||||
}
|
||||
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
|
||||
if (!str_contains($compiler_extra, '-lcompiler_rt')) {
|
||||
// Add unwind library if not already present
|
||||
$compiler_extra = trim($compiler_extra . ' -lcompiler_rt');
|
||||
GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}");
|
||||
}
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
||||
if (!$has_avx512) {
|
||||
|
||||
Reference in New Issue
Block a user