Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ bootstrap-gen0-refresh-argv-driver:
./script/bootstrap-gen0-refresh-argv-driver.sh
helper-runtime-prelink-refresh:
php script/emit-helper-runtime-object.php --prelink
helper-runtime-common-publish:
php script/emit-helper-runtime-common.php --from-prelinked
helper-runtime-prelink-check:
php script/check-helper-runtime-prelink.php
bootstrap-init:
Expand Down
6 changes: 3 additions & 3 deletions lib/AOT/HelperRuntimeCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
final class HelperRuntimeCommon
{
/** Opt-in: PHP_COMPILER_HELPER_RUNTIME_COMMON=1 */
/** Opt-in until units are re-emitted with AotGcSections: PHP_COMPILER_HELPER_RUNTIME_COMMON=1 */
public const ENV = 'PHP_COMPILER_HELPER_RUNTIME_COMMON';

/**
Expand Down Expand Up @@ -129,8 +129,8 @@ public static function publishManifestMetadata(string $objectPath, string $bitco
'arch' => HelperRuntimeCache::archKey(),
'role' => 'committed per-arch split-compilation helper units (#15889)',
];
$manifest['core_fingerprint'] = HelperRuntimeCache::coreFingerprint();
$manifest['llvm_identity_token'] = HelperRuntimeCache::llvmIdentityToken();
// Preserve arch-level fields written by --prelink (unit_count, total_bytes, …).
// Only refresh common.o metadata; do not rewrite core_fingerprint here (#36246).
$manifest['common_object_sha256'] = hash_file('sha256', $objectPath) ?: '';
$manifest['common_object_bytes'] = is_file($objectPath) ? filesize($objectPath) : 0;
$manifest['common_bitcode_bytes'] = is_file($bitcodePath) ? filesize($bitcodePath) : 0;
Expand Down
Binary file added prelinked/helper-runtime/x86_64-linux/common.bc
Binary file not shown.
Binary file added prelinked/helper-runtime/x86_64-linux/common.o
Binary file not shown.
6 changes: 5 additions & 1 deletion prelinked/helper-runtime/x86_64-linux/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
"published_fresh": 1,
"kept_live_unpublished": 0,
"total_bytes": 829020666,
"refresh": "php script/publish-helper-units-prelink.php (targeted dom refresh #32122)"
"refresh": "php script/publish-helper-units-prelink.php (targeted dom refresh #32122)",
"common_object_sha256": "460cc7680f59db5030b3c900629ac91fe8b927a468491c50d634e80a8cc6459c",
"common_object_bytes": 1649928,
"common_bitcode_bytes": 1116,
"common_emitted_at": "2026-09-02T22:19:24+00:00"
}
23 changes: 20 additions & 3 deletions script/check-helper-runtime-prelink.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

use PHPCompiler\AOT\HelperRuntimeCache;
use PHPCompiler\AOT\HelperRuntimeCommon;

$root = dirname(__DIR__);
require $root.'/vendor/autoload.php';
Expand All @@ -34,6 +35,7 @@
exit($strict ? 1 : 0);
}

$commonBroken = false;
if (is_file($archManifestPath)) {
$archManifest = json_decode((string) file_get_contents($archManifestPath), true);
$committedCore = \is_array($archManifest) ? (string) ($archManifest['core_fingerprint'] ?? '') : '';
Expand All @@ -47,6 +49,17 @@
exit(1);
}
}
$expectedCommonSha = \is_array($archManifest) ? (string) ($archManifest['common_object_sha256'] ?? '') : '';
if ('' !== $expectedCommonSha) {
$commonPath = HelperRuntimeCommon::commonObjectPath();
if (!is_file($commonPath)) {
++$commonBroken;
fwrite(STDOUT, " BROKEN common.o (manifest expects shared runtime prologue)\n");
} elseif (!HelperRuntimeCommon::commonObjectIsLinkable()) {
++$commonBroken;
fwrite(STDOUT, " STALE common.o (sha256 or core_fingerprint mismatch)\n");
}
}
}

$fresh = 0;
Expand Down Expand Up @@ -84,12 +97,16 @@
++$fresh;
}

$commonNote = HelperRuntimeCommon::commonObjectIsLinkable()
? ', common.o fresh'
: (is_file(HelperRuntimeCommon::commonObjectPath()) ? ', common.o stale' : ', common.o absent');
fwrite(STDOUT, sprintf(
"check-helper-runtime-prelink: %s — %d fresh, %d stale, %d broken%s\n",
"check-helper-runtime-prelink: %s — %d fresh, %d stale, %d broken%s%s\n",
$arch,
$fresh,
$stale,
$broken,
($stale + $broken) > 0 ? ' — refresh: php script/emit-helper-runtime-object.php --prelink' : ''
$commonBroken > 0 ? ', common broken' : $commonNote,
($stale + $broken + $commonBroken) > 0 ? ' — refresh: php script/emit-helper-runtime-object.php --prelink; common: php script/emit-helper-runtime-common.php --from-prelinked' : ''
));
exit($strict && ($stale + $broken) > 0 ? 1 : 0);
exit($strict && ($stale + $broken + $commonBroken) > 0 ? 1 : 0);
Loading