-fno-sanitize=undefined is enabled in zig by default, not in gcc and clang

This commit is contained in:
DubbleClick
2025-06-24 09:05:44 +07:00
parent ee0de6933f
commit 74849a8d48
3 changed files with 21 additions and 3 deletions

View File

@@ -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;
}
}