From 8eb8015544837e73663fc6b10bccebef801e1f7f Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Thu, 27 Feb 2025 14:30:21 -0500 Subject: [PATCH] Fix capture_context_win_arm64 in standalone clang build clang-cl does not understand armasm64 assembler syntax. The existing workaround for crashpad_is_in_chromium, which has used clang-cl exclusively for quite some time, was to use a checked-in prebuilt .obj produced by armasm64, rather than assembling the .asm during the build. This same .obj can be used to support the standalone clang build. As Crashpad on Windows is now clang-primary (with an eye toward becoming clang-only), this is not a long-term solution. The existing armasm64 source will need to be translated to an assembler dialect that clang-cl understands. Bug: 399587142, 384682775 Change-Id: Ieeb3c1c54c954997514a3fecb5c362b7d4d7d13d Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6309923 Reviewed-by: Nico Weber Commit-Queue: Mark Mentovai --- util/BUILD.gn | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/util/BUILD.gn b/util/BUILD.gn index ea2e95c7..86d543af 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -528,13 +528,12 @@ crashpad_static_library("util") { "win/safe_terminate_process.asm", ] } else { - # Most Crashpad builds use Microsoft's armasm64.exe macro assembler for - # .asm source files. When building in Chromium, clang-cl is used as the - # assembler instead. Since the two assemblers recognize different - # assembly dialects, the same .asm file can't be used for each. As a - # workaround, use a prebuilt .obj file when the Microsoft-dialect - # assembler isn't available. - if (crashpad_is_in_chromium) { + # When building with clang, clang-cl is used as the assembler. Since + # clang-cl recognizes a different assembly dialect than Microsoft’s + # armasm64 macro assembler, the same .asm file can’t be used for each. As + # a workaround, use a prebuilt .obj file when the Microsoft-dialect + # assembler isn’t available. + if (crashpad_is_clang) { sources += [ "misc/capture_context_win_arm64.obj" ] } else { sources += [ "misc/capture_context_win_arm64.asm" ]