Commit 30b86eed authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Fix Win/cross/x64 builds

See the changes in BUILD.gn for an explanation of why a new flag is necessary.
It's likely that current usages of V8_TARGET_OS_* and V8_TARGET_ARCH_* also need
to change, but this is good enough for now to ensure both Win/cross/x86 and
Win/cross/x64 build.

BUG=chromium:945659
R=machenbach,thakis
TBR=jgruber

Change-Id: Ie2765db91a1c0d8c72ccf42c9d7fece792d9b252
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1542500
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60687}
parent 8504b79f
......@@ -1123,6 +1123,12 @@ template("run_mksnapshot") {
"root_out_dir") + "/mksnapshot",
root_build_dir),
"--turbo_instruction_scheduling",
# In cross builds, the snapshot may be generated for both the host and
# target toolchains. The same host binary is used to generate both, so
# mksnapshot needs to know which target OS to use at runtime. It's weird,
# but the target OS is really |current_os|.
"--ebt_os=$current_os",
]
args += invoker.args
......
......@@ -1169,6 +1169,7 @@ DEFINE_STRING(startup_src, nullptr,
"Write V8 startup as C++ src. (mksnapshot only)")
DEFINE_STRING(startup_blob, nullptr,
"Write V8 startup blob file. (mksnapshot only)")
DEFINE_STRING(ebt_os, nullptr, "EBT target OS. (mksnapshot only)")
//
// Minor mark compact collector flags.
......
......@@ -692,11 +692,10 @@ void PlatformDependentEmbeddedFileWriter::SectionData() {
}
void PlatformDependentEmbeddedFileWriter::SectionRoData() {
#if defined(V8_TARGET_OS_WIN)
fprintf(fp_, ".section .rdata\n");
#else
fprintf(fp_, ".section .rodata\n");
#endif
if (i::FLAG_ebt_os == std::string("win"))
fprintf(fp_, ".section .rdata\n");
else
fprintf(fp_, ".section .rodata\n");
}
void PlatformDependentEmbeddedFileWriter::DeclareUint32(const char* name,
......@@ -779,29 +778,31 @@ void PlatformDependentEmbeddedFileWriter::DeclareFunctionBegin(
const char* name) {
DeclareLabel(name);
#if defined(V8_TARGET_OS_WIN)
if (i::FLAG_ebt_os == std::string("win")) {
#if defined(V8_TARGET_ARCH_ARM64)
// Windows ARM64 assembly is in GAS syntax, but ".type" is invalid directive
// in PE/COFF for Windows.
// Windows ARM64 assembly is in GAS syntax, but ".type" is invalid directive
// in PE/COFF for Windows.
#else
// The directives for inserting debugging information on Windows come
// from the PE (Portable Executable) and COFF (Common Object File Format)
// standards. Documented here:
// https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format
//
// .scl 2 means StorageClass external.
// .type 32 means Type Representation Function.
fprintf(fp_, ".def %s%s; .scl 2; .type 32; .endef;\n", SYMBOL_PREFIX, name);
// The directives for inserting debugging information on Windows come
// from the PE (Portable Executable) and COFF (Common Object File Format)
// standards. Documented here:
// https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format
//
// .scl 2 means StorageClass external.
// .type 32 means Type Representation Function.
fprintf(fp_, ".def %s%s; .scl 2; .type 32; .endef;\n", SYMBOL_PREFIX, name);
#endif
#elif defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_ARM64)
// ELF format binaries on ARM use ".type <function name>, %function"
// to create a DWARF subprogram entry.
fprintf(fp_, ".type %s, %%function\n", name);
} else {
#if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_ARM64)
// ELF format binaries on ARM use ".type <function name>, %function"
// to create a DWARF subprogram entry.
fprintf(fp_, ".type %s, %%function\n", name);
#else
// Other ELF Format binaries use ".type <function name>, @function"
// to create a DWARF subprogram entry.
fprintf(fp_, ".type %s, @function\n", name);
// Other ELF Format binaries use ".type <function name>, @function"
// to create a DWARF subprogram entry.
fprintf(fp_, ".type %s, @function\n", name);
#endif
}
}
void PlatformDependentEmbeddedFileWriter::DeclareFunctionEnd(const char* name) {
......
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