From 2d5dec26c31662764c9adfe3ff996174901b8d49 Mon Sep 17 00:00:00 2001 From: Kaoru0822 Date: Sat, 31 Oct 2026 09:01:06 -0700 Subject: [PATCH] fix(ghidra): assemble the Swift verifier's unresolved-jump fixture before linking (#8325) swiftc rejects assembly sources as inputs, so verify:ghidra:swift failed during fixture preparation before any provider check. Assemble both assembly fixtures to objects with xcrun clang and link only objects. Fixes #8188 Co-authored-by: Claude Opus 5.5 --- scripts/verify-real-ghidra-swift.mjs | 47 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/scripts/verify-real-ghidra-swift.mjs b/scripts/verify-real-ghidra-swift.mjs index 7b2c02e04f..c28824fe09 100644 --- a/scripts/verify-real-ghidra-swift.mjs +++ b/scripts/verify-real-ghidra-swift.mjs @@ -59,18 +59,17 @@ const source = fileURLToPath( const literalSource = fileURLToPath( new URL("../tests/conformance/swift/string-literals.swift", import.meta.url), ); -const unresolvedJumpSource = fileURLToPath( - new URL( - "../tests/conformance/swift/unresolved-string-jump.s", - import.meta.url, - ), -); const binary = join(root, "swift-inventory"); const literalBinary = join(root, "swift-literals"); -const literalAssembly = fileURLToPath( - new URL("../tests/conformance/swift/decoder-safeguards.S", import.meta.url), +// swiftc rejects assembly inputs, so each source is assembled to an object first. +const literalObjects = ["decoder-safeguards.S", "unresolved-string-jump.s"].map( + (name) => ({ + source: fileURLToPath( + new URL(`../tests/conformance/swift/${name}`, import.meta.url), + ), + object: join(root, name.replace(/\.[sS]$/u, ".o")), + }), ); -const literalObject = join(root, "decoder-safeguards.o"); const reports = []; let literalReport; let decoderCleaned = true; @@ -81,20 +80,21 @@ try { await mkdir(join(root, "copied")); const copied = join(root, "copied", "swift-inventory"); await copyFile(binary, copied); - await execute( - "xcrun", - [ - "clang", - "-target", - "arm64-apple-macosx13.0", - "-c", - literalAssembly, - "-o", - literalObject, - ], - { timeout: 60_000 }, - ); // Decoding covers AArch64 register pairs, so build that slice on any Mac host. + for (const { source: assembly, object } of literalObjects) + await execute( + "xcrun", + [ + "clang", + "-target", + "arm64-apple-macosx13.0", + "-c", + assembly, + "-o", + object, + ], + { timeout: 60_000 }, + ); await execute( "swiftc", [ @@ -102,8 +102,7 @@ try { "-target", "arm64-apple-macosx13.0", literalSource, - literalObject, - unresolvedJumpSource, + ...literalObjects.map(({ object }) => object), "-o", literalBinary, ],