Build actual crashpad .asm files in win/cross builds

Now that we have llvm-ml, we no longer need the workaround for this.

This upstreams
https://chromium-review.googlesource.com/c/chromium/src/+/3708412

Bug: chromium:762167
Change-Id: Iadc8ba9753bb7dd079415ee744f3b176b7e2f629
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3707748
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Nico Weber 2022-06-17 07:39:41 -04:00 committed by Crashpad LUCI CQ
parent 460943dd9a
commit 7c30a508eb
3 changed files with 15 additions and 95 deletions

View File

@ -509,40 +509,23 @@ crashpad_static_library("util") {
"win/xp_compat.h",
]
# There's no ml.exe yet in cross builds, so provide broken-but-not-asm
# versions of the functions defined in .asm files.
#
# CaptureContext() in capture_context_broken.cc just calls CHECK(false).
# SafeTerminateProcess() in safe_terminate_process.cc just calls regular
# TerminateProcess() without the protection against broken third-party
# patching of TerminateProcess().
#
# TODO(thakis): Use the .asm file in cross builds somehow,
# https://crbug.com/762167.
if (host_os == "win") {
if (current_cpu != "arm64") {
sources += [
"misc/capture_context_win.asm",
"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) {
sources += [ "misc/capture_context_win_arm64.obj" ]
} else {
sources += [ "misc/capture_context_win_arm64.asm" ]
}
}
} else {
if (current_cpu != "arm64") {
sources += [
"misc/capture_context_broken.cc",
"win/safe_terminate_process_broken.cc",
"misc/capture_context_win.asm",
"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) {
sources += [ "misc/capture_context_win_arm64.obj" ]
} else {
sources += [ "misc/capture_context_win_arm64.asm" ]
}
}
}

View File

@ -1,29 +0,0 @@
// Copyright 2017 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "util/misc/capture_context.h"
#include <ostream>
#include "base/check.h"
namespace crashpad {
void CaptureContext(NativeCPUContext* context) {
// Don't use this file in production.
CHECK(false)
<< "Don't use this! For cross builds only. See https://crbug.com/762167.";
}
} // namespace crashpad

View File

@ -1,34 +0,0 @@
// Copyright 2017 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "util/win/safe_terminate_process.h"
#include "base/logging.h"
#if defined(ARCH_CPU_X86)
namespace crashpad {
bool SafeTerminateProcess(HANDLE process, UINT exit_code) {
// Third-party software that hooks TerminateProcess() incorrectly has been
// encountered in the wild. This version of SafeTerminateProcess() lacks
// protection against that, so don't use it in production.
LOG(WARNING)
<< "Don't use this! For cross builds only. See https://crbug.com/777924.";
return TerminateProcess(process, exit_code) != FALSE;
}
} // namespace crashpad
#endif // defined(ARCH_CPU_X86)