mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
-fno-sanitize=undefined is enabled in zig by default, not in gcc and clang
This commit is contained in:
@@ -51,4 +51,15 @@ class opcache extends Extension
|
||||
{
|
||||
return 'Zend Opcache';
|
||||
}
|
||||
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
if (!str_contains(getenv('CC'), 'zig')) {
|
||||
return false;
|
||||
}
|
||||
// opcache requires -lunwind, the equivalent to -lgcc_s that gcc automatically links
|
||||
$extra_libs = trim(getenv('SPC_EXTRA_LIBS') . ' -lunwind');
|
||||
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,10 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
$zts = '';
|
||||
}
|
||||
$disable_jit = $this->getOption('disable-opcache-jit', false) ? '--disable-opcache-jit ' : '';
|
||||
$cc = trim(getenv('CC'));
|
||||
if (!$disable_jit && $this->getExt('opcache') && str_contains($cc, 'zig')) {
|
||||
f_putenv("CC=$cc -fno-sanitize=undefined");
|
||||
}
|
||||
|
||||
$config_file_path = $this->getOption('with-config-file-path', false) ?
|
||||
('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : '';
|
||||
@@ -175,6 +179,9 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
}
|
||||
$this->buildEmbed();
|
||||
}
|
||||
if (!$disable_jit && $this->getExt('opcache') && str_contains($cc, 'zig')) {
|
||||
f_putenv("CC=$cc");
|
||||
}
|
||||
if ($enableFrankenphp) {
|
||||
logger()->info('building frankenphp');
|
||||
$this->buildFrankenphp();
|
||||
|
||||
Reference in New Issue
Block a user