Commit ef8323ea authored by Tom Tan's avatar Tom Tan Committed by Commit Bot

Fix embedded assembly for Windows ARM64.

Two Fixes included to make V8 build work for Windows ARM64.
1. Don't emit ".def" and related macros to define function beginning, because they are invalid for Windows ARM64.
2. Set alignment of data section to 8 which is required for instruction which loads element from v8_Default_embedded_blob_.


Version 7.2.479

Performance and stability improvements on all platforms.

TBR=v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com

Change-Id: I0bfea5dd8ed6c1340d11c13dcc2e492e7b22aa8c
Reviewed-on: https://chromium-review.googlesource.com/c/1352210Reviewed-by: 's avatarv8-ci-autoroll-builder <v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com>
Cr-Original-Commit-Position: refs/heads/7.2.479@{#1}
Cr-Original-Branched-From: a8152aac-refs/heads/master@{#57863}
Bug: chromium:893460
Reviewed-on: https://chromium-review.googlesource.com/c/1352791Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Tom Tan <Tom.Tan@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#57915}
parent 82bcbebd
......@@ -126,6 +126,8 @@ void PlatformDependentEmbeddedFileWriter::AlignToCodeAlignment() {
fprintf(fp_, ".balign 32\n");
}
void PlatformDependentEmbeddedFileWriter::AlignToDataAlignment() {}
void PlatformDependentEmbeddedFileWriter::Comment(const char* string) {
fprintf(fp_, "// %s\n", string);
}
......@@ -202,6 +204,8 @@ void PlatformDependentEmbeddedFileWriter::AlignToCodeAlignment() {
fprintf(fp_, ".align 5\n");
}
void PlatformDependentEmbeddedFileWriter::AlignToDataAlignment() {}
void PlatformDependentEmbeddedFileWriter::Comment(const char* string) {
fprintf(fp_, "// %s\n", string);
}
......@@ -283,6 +287,8 @@ void PlatformDependentEmbeddedFileWriter::AlignToCodeAlignment() {
fprintf(fp_, "ALIGN 4\n");
}
void PlatformDependentEmbeddedFileWriter::AlignToDataAlignment() {}
void PlatformDependentEmbeddedFileWriter::Comment(const char* string) {
fprintf(fp_, "; %s\n", string);
}
......@@ -306,7 +312,7 @@ int PlatformDependentEmbeddedFileWriter::HexLiteral(uint64_t value) {
}
void PlatformDependentEmbeddedFileWriter::FilePrologue() {
#if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_ARM64)
#if !defined(V8_TARGET_ARCH_X64)
fprintf(fp_, ".MODEL FLAT\n");
#endif
}
......@@ -367,6 +373,16 @@ void PlatformDependentEmbeddedFileWriter::AlignToCodeAlignment() {
fprintf(fp_, ".balign 32\n");
}
void PlatformDependentEmbeddedFileWriter::AlignToDataAlignment() {
#if defined(V8_OS_WIN) && defined(V8_TARGET_ARCH_ARM64)
// On Windows ARM64, instruction "ldr xt,[xn,v8_Default_embedded_blob_]" is
// generated by clang-cl to load elements in v8_Default_embedded_blob_.
// The generated instruction has scale 3 which requires the load target to be
// aligned at 8 bytes (2^3).
fprintf(fp_, ".balign 8\n");
#endif
}
void PlatformDependentEmbeddedFileWriter::Comment(const char* string) {
fprintf(fp_, "// %s\n", string);
}
......@@ -380,6 +396,10 @@ void PlatformDependentEmbeddedFileWriter::DeclareFunctionBegin(
DeclareLabel(name);
#if defined(V8_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.
#else
// The directives for inserting debugging information on Windows come
// from the PE (Portable Executable) and COFF (Common Object File Format)
// standards. Documented here:
......@@ -388,6 +408,7 @@ void PlatformDependentEmbeddedFileWriter::DeclareFunctionBegin(
// .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.
......
......@@ -34,6 +34,7 @@ class PlatformDependentEmbeddedFileWriter final {
void SectionRoData();
void AlignToCodeAlignment();
void AlignToDataAlignment();
void DeclareUint32(const char* name, uint32_t value);
void DeclarePointerToSymbol(const char* name, const char* target);
......@@ -182,6 +183,7 @@ class EmbeddedFileWriter {
w->Comment("Pointer to the beginning of the embedded blob.");
w->SectionData();
w->AlignToDataAlignment();
w->DeclarePointerToSymbol(embedded_blob_symbol,
embedded_blob_data_symbol);
w->Newline();
......
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