Commit 701eb086 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Fix V8 snapshot build for 32-bit Win/cross

This CL includes a revert of [1] with thakis@'s proposed fix at [2].  Verified a
build with the below gn args works on Linux:

target_os = "win"
target_cpu = "x86"
is_debug = false
is_official_build = true
is_component_build = false
use_goma = true
enable_nacl = false
use_custom_libcxx = true

[1] https://chromium.googlesource.com/v8/v8.git/+/93ee541417b6f5904072c0ecdfc6fc041811b489
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=942347#c2

BUG=chromium:942347
R=machenbach
CC=thakis

Change-Id: I34f5744a9f600efbc075f4b5ba8d1c66bff46ae6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1529250
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60349}
parent ad4865b9
......@@ -3581,6 +3581,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
if (target_os == "fuchsia") {
defines = [ "V8_TARGET_OS_FUCHSIA" ]
} else if (target_os == "win") {
defines = [ "V8_TARGET_OS_WIN" ]
}
}
}
......
......@@ -37,10 +37,9 @@ declare_args() {
# Enable the snapshot feature, for fast context creation.
# https://v8.dev/blog/custom-startup-snapshots
# TODO(thakis): Make snapshots work in 64-bit win/cross builds
# (https://crbug.com/803591) and 32-bit win/cross builds
# (https://crbug.com/942347)
v8_use_snapshot = !is_win || host_os == "win"
# TODO(thakis): Make snapshots work in 64-bit win/cross builds,
# https://803591
v8_use_snapshot = !(is_win && host_os != "win" && target_cpu == "x64")
# Enable several snapshots side-by-side (e.g. default and for trusted code).
v8_use_multi_snapshots = false
......
......@@ -41,7 +41,7 @@ namespace internal {
// Name mangling.
// Symbols are prefixed with an underscore on 32-bit architectures.
#if defined(V8_OS_WIN) && !defined(V8_TARGET_ARCH_X64) && \
#if defined(V8_TARGET_OS_WIN) && !defined(V8_TARGET_ARCH_X64) && \
!defined(V8_TARGET_ARCH_ARM64)
#define SYMBOL_PREFIX "_"
#else
......@@ -65,7 +65,7 @@ DataDirective PointerSizeDirective() {
} // namespace
const char* DirectiveAsString(DataDirective directive) {
#if defined(V8_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
#if defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
switch (directive) {
case kByte:
return "BYTE";
......@@ -76,7 +76,7 @@ const char* DirectiveAsString(DataDirective directive) {
default:
UNREACHABLE();
}
#elif defined(V8_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
switch (directive) {
case kByte:
return "DCB";
......@@ -432,10 +432,10 @@ int PlatformDependentEmbeddedFileWriter::IndentedDataDirective(
return fprintf(fp_, " %s ", DirectiveAsString(directive));
}
// V8_OS_WIN (MSVC)
// V8_TARGET_OS_WIN (MSVC)
// -----------------------------------------------------------------------------
#elif defined(V8_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
// For MSVC builds we emit assembly in MASM syntax.
// See https://docs.microsoft.com/en-us/cpp/assembler/masm/directives-reference.
......@@ -566,7 +566,7 @@ int PlatformDependentEmbeddedFileWriter::IndentedDataDirective(
#undef V8_ASSEMBLER_IS_MASM
#elif defined(V8_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
// The the AARCH64 ABI requires instructions be 4-byte-aligned and Windows does
// not have a stricter alignment requirement (see the TEXTAREA macro of
......@@ -692,7 +692,7 @@ void PlatformDependentEmbeddedFileWriter::SectionData() {
}
void PlatformDependentEmbeddedFileWriter::SectionRoData() {
#if defined(V8_OS_WIN)
#if defined(V8_TARGET_OS_WIN)
fprintf(fp_, ".section .rdata\n");
#else
fprintf(fp_, ".section .rodata\n");
......@@ -779,7 +779,7 @@ void PlatformDependentEmbeddedFileWriter::DeclareFunctionBegin(
const char* name) {
DeclareLabel(name);
#if defined(V8_OS_WIN)
#if defined(V8_TARGET_OS_WIN)
#if defined(V8_TARGET_ARCH_ARM64)
// Windows ARM64 assembly is in GAS syntax, but ".type" is invalid directive
// in PE/COFF for Windows.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment