[v8] Update to 9.1.269.39

Adds changes to build the clang version as well as the regular gcc
version.
This commit is contained in:
Rodrigo Hernandez
2021-07-19 18:23:52 -06:00
parent 8302516859
commit 6bec45f695
4 changed files with 380 additions and 232 deletions

View File

@@ -1,8 +1,8 @@
diff --git a/BUILD.gn b/BUILD.gn
index a9ab6783fa..5e144b24e0 100644
index d2bfb6129d..2c40c9f506 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -444,6 +444,11 @@ config("internal_config") {
@@ -474,6 +474,11 @@ config("internal_config") {
if (is_component_build) {
defines += [ "BUILDING_V8_SHARED" ]
}
@@ -14,7 +14,7 @@ index a9ab6783fa..5e144b24e0 100644
}
# Should be applied to all targets that write trace events.
@@ -942,17 +947,25 @@ config("toolchain") {
@@ -977,17 +982,25 @@ config("toolchain") {
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
if (is_win) {
@@ -46,7 +46,7 @@ index a9ab6783fa..5e144b24e0 100644
}
}
if (is_android && v8_android_log_stdout) {
@@ -1008,7 +1021,7 @@ config("toolchain") {
@@ -1043,7 +1056,7 @@ config("toolchain") {
}
if (v8_no_inline) {
@@ -55,7 +55,7 @@ index a9ab6783fa..5e144b24e0 100644
cflags += [ "/Ob0" ]
} else {
cflags += [
@@ -1032,7 +1045,7 @@ config("toolchain") {
@@ -1067,7 +1080,7 @@ config("toolchain") {
}
}
@@ -64,7 +64,7 @@ index a9ab6783fa..5e144b24e0 100644
cflags += [
"/wd4245", # Conversion with signed/unsigned mismatch.
"/wd4267", # Conversion with possible loss of data.
@@ -1054,11 +1067,11 @@ config("toolchain") {
@@ -1089,11 +1102,11 @@ config("toolchain") {
]
}
@@ -78,7 +78,7 @@ index a9ab6783fa..5e144b24e0 100644
cflags += [
# Disable gcc warnings for optimizations based on the assumption that
# signed overflow does not occur. Generates false positives (see
@@ -4499,17 +4512,25 @@ v8_component("v8_libbase") {
@@ -4661,17 +4674,25 @@ v8_component("v8_libbase") {
defines += [ "_CRT_RAND_S" ] # for rand_s()
@@ -113,7 +113,7 @@ index a9ab6783fa..5e144b24e0 100644
}
if (v8_current_cpu == "mips" || v8_current_cpu == "mips64") {
@@ -4606,7 +4627,7 @@ v8_component("v8_libplatform") {
@@ -4768,7 +4789,7 @@ v8_component("v8_libplatform") {
# TODO(skyostil): Switch TraceEventListener to protozero.
"//third_party/perfetto/protos/perfetto/trace:lite",
]
@@ -122,7 +122,7 @@ index a9ab6783fa..5e144b24e0 100644
sources -= [ "src/libplatform/tracing/recorder-default.cc" ]
sources += [ "src/libplatform/tracing/recorder-win.cc" ]
}
@@ -4652,7 +4673,7 @@ v8_source_set("v8_cppgc_shared") {
@@ -4810,7 +4831,7 @@ v8_source_set("v8_cppgc_shared") {
"src/heap/cppgc/sanitizers.h",
]
@@ -131,7 +131,7 @@ index a9ab6783fa..5e144b24e0 100644
if (current_cpu == "x64") {
sources += [ "src/heap/base/asm/x64/push_registers_asm.cc" ]
} else if (current_cpu == "x86") {
@@ -4672,7 +4693,7 @@ v8_source_set("v8_cppgc_shared") {
@@ -4830,7 +4851,7 @@ v8_source_set("v8_cppgc_shared") {
} else if (current_cpu == "riscv64") {
sources += [ "src/heap/base/asm/riscv64/push_registers_asm.cc" ]
}
@@ -140,7 +140,7 @@ index a9ab6783fa..5e144b24e0 100644
if (current_cpu == "x64") {
sources += [ "src/heap/base/asm/x64/push_registers_masm.S" ]
} else if (current_cpu == "x86") {
@@ -4976,6 +4997,12 @@ if (current_toolchain == v8_snapshot_toolchain) {
@@ -5136,6 +5157,12 @@ if (current_toolchain == v8_snapshot_toolchain) {
configs = [ ":internal_config" ]
@@ -153,7 +153,7 @@ index a9ab6783fa..5e144b24e0 100644
deps = [
":v8_base_without_compiler",
":v8_compiler_for_mksnapshot",
@@ -5202,10 +5229,18 @@ if (is_component_build) {
@@ -5366,10 +5393,18 @@ if (is_component_build) {
public_deps = [
":v8_base",
@@ -173,7 +173,7 @@ index a9ab6783fa..5e144b24e0 100644
public_configs = [ ":external_config" ]
}
@@ -5225,7 +5260,16 @@ if (is_component_build) {
@@ -5389,7 +5424,16 @@ if (is_component_build) {
":v8_snapshot",
]
@@ -192,7 +192,7 @@ index a9ab6783fa..5e144b24e0 100644
public_configs = [ ":external_config" ]
}
diff --git a/include/v8.h b/include/v8.h
index 7cb19bbede..b7b16d004c 100644
index 6b672ca750..3d22eb5151 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -31,6 +31,11 @@
@@ -267,7 +267,7 @@ index 861cfe4027..90c41f7097 100644
#undef EXPORT_TEMPLATE_TEST
diff --git a/src/base/platform/platform-win32.cc b/src/base/platform/platform-win32.cc
index 7f6c0e97d2..a0eedf5511 100644
index 50da60c72f..510bc26c51 100644
--- a/src/base/platform/platform-win32.cc
+++ b/src/base/platform/platform-win32.cc
@@ -4,21 +4,14 @@
@@ -429,10 +429,10 @@ index 82555463c0..08c67bc13a 100644
+#undef __deref
#endif // V8_BASE_WIN32_HEADERS_H_
diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h
index 03af2cc5e2..bb19092c54 100644
index 72b8fbc8a8..3ebfc23f1f 100644
--- a/src/codegen/code-stub-assembler.h
+++ b/src/codegen/code-stub-assembler.h
@@ -301,7 +301,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
@@ -303,7 +303,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
// it's possible to add JavaScript-specific useful CodeAssembler "macros"
// without modifying files in the compiler directory (and requiring a review
// from a compiler directory OWNER).
@@ -442,10 +442,10 @@ index 03af2cc5e2..bb19092c54 100644
public TorqueGeneratedExportedMacrosAssembler {
public:
diff --git a/src/codegen/handler-table.cc b/src/codegen/handler-table.cc
index 8aec047d13..12e25a2631 100644
index 7bede6aa9b..c5cdc251f2 100644
--- a/src/codegen/handler-table.cc
+++ b/src/codegen/handler-table.cc
@@ -219,6 +219,12 @@ int HandlerTable::LookupReturn(int pc_offset) {
@@ -224,6 +224,12 @@ int HandlerTable::LookupReturn(int pc_offset) {
difference_type operator-(const Iterator& other) const {
return index - other.index;
}
@@ -488,10 +488,10 @@ index 114b4782c9..92acf77aa4 100644
}
diff --git a/src/common/globals.h b/src/common/globals.h
index d9d502aa51..ea7e54e21d 100644
index f51c3210f8..1df565694a 100644
--- a/src/common/globals.h
+++ b/src/common/globals.h
@@ -1348,7 +1348,7 @@ class BinaryOperationFeedback {
@@ -1364,7 +1364,7 @@ class BinaryOperationFeedback {
// This is distinct from BinaryOperationFeedback on purpose, because the
// feedback that matters differs greatly as well as the way it is consumed.
class CompareOperationFeedback {
@@ -500,7 +500,7 @@ index d9d502aa51..ea7e54e21d 100644
kSignedSmallFlag = 1 << 0,
kOtherNumberFlag = 1 << 1,
kBooleanFlag = 1 << 2,
@@ -1362,7 +1362,7 @@ class CompareOperationFeedback {
@@ -1378,7 +1378,7 @@ class CompareOperationFeedback {
};
public:
@@ -509,7 +509,7 @@ index d9d502aa51..ea7e54e21d 100644
kNone = 0,
kBoolean = kBooleanFlag,
@@ -1375,7 +1375,7 @@ class CompareOperationFeedback {
@@ -1391,7 +1391,7 @@ class CompareOperationFeedback {
kNumberOrOddball = kNumber | kOddball,
kInternalizedString = kInternalizedStringFlag,
@@ -531,6 +531,32 @@ index 8e1d3d4eae..c55d8329de 100644
public:
explicit NodeCache(Zone* zone) : map_(zone) {}
~NodeCache() = default;
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc
index 4bfaa1ccee..e220214719 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -1089,7 +1089,7 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
if (use_info.type_check() != TypeCheckKind::kBigInt) {
double const fv = OpParameter<double>(node->op());
using limits = std::numeric_limits<int64_t>;
- if (fv <= limits::max() && fv >= limits::min()) {
+ if (fv <= static_cast<double>(limits::max()) && fv >= limits::min()) {
int64_t const iv = static_cast<int64_t>(fv);
if (static_cast<double>(iv) == fv) {
return jsgraph()->Int64Constant(iv);
diff --git a/src/compiler/type-cache.h b/src/compiler/type-cache.h
index 2ade5f68a3..11dbf32b4d 100644
--- a/src/compiler/type-cache.h
+++ b/src/compiler/type-cache.h
@@ -191,7 +191,7 @@ class V8_EXPORT_PRIVATE TypeCache final {
template <typename T>
Type CreateRange() {
return CreateRange(std::numeric_limits<T>::min(),
- std::numeric_limits<T>::max());
+ static_cast<double>(std::numeric_limits<T>::max()));
}
Type CreateRange(double min, double max) {
diff --git a/src/heap/paged-spaces-inl.h b/src/heap/paged-spaces-inl.h
index e135e30efc..0c055247bc 100644
--- a/src/heap/paged-spaces-inl.h
@@ -545,7 +571,7 @@ index e135e30efc..0c055247bc 100644
HeapObject next_obj = FromCurrentPage();
if (!next_obj.is_null()) return next_obj;
diff --git a/src/heap/paged-spaces.h b/src/heap/paged-spaces.h
index 5168f0f053..ae5c22d1f3 100644
index 621d92aa89..a8592a5b4d 100644
--- a/src/heap/paged-spaces.h
+++ b/src/heap/paged-spaces.h
@@ -45,7 +45,7 @@ class V8_EXPORT_PRIVATE PagedSpaceObjectIterator : public ObjectIterator {
@@ -574,7 +600,7 @@ index a77ea5d265..0cddb92a02 100644
bool FeedbackMetadata::SpecDiffersFrom(
diff --git a/src/objects/fixed-array-inl.h b/src/objects/fixed-array-inl.h
index a91f89784f..5ecf7e3372 100644
index cca6d40070..d6d36ff59f 100644
--- a/src/objects/fixed-array-inl.h
+++ b/src/objects/fixed-array-inl.h
@@ -88,7 +88,7 @@ bool FixedArray::is_the_hole(Isolate* isolate, int index) {
@@ -587,10 +613,10 @@ index a91f89784f..5ecf7e3372 100644
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
DCHECK(Object(value).IsSmi());
diff --git a/src/objects/fixed-array.h b/src/objects/fixed-array.h
index 53b4cbb22b..8dd24df399 100644
index 98c5d8d5b5..bd5303e44c 100644
--- a/src/objects/fixed-array.h
+++ b/src/objects/fixed-array.h
@@ -130,7 +130,7 @@ class FixedArray
@@ -132,7 +132,7 @@ class FixedArray
inline bool is_the_hole(Isolate* isolate, int index);
// Setter that doesn't need write barrier.
@@ -600,7 +626,7 @@ index 53b4cbb22b..8dd24df399 100644
inline void set(int index, Object value, WriteBarrierMode mode);
diff --git a/src/objects/ordered-hash-table.h b/src/objects/ordered-hash-table.h
index ca1d29d2fd..7758da72d3 100644
index 1746e2dc89..b43974ccfa 100644
--- a/src/objects/ordered-hash-table.h
+++ b/src/objects/ordered-hash-table.h
@@ -7,8 +7,12 @@
@@ -617,7 +643,7 @@ index ca1d29d2fd..7758da72d3 100644
#include "src/objects/smi.h"
#include "src/roots/roots.h"
diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc
index 436dbe7797..6db3de346d 100644
index 9cc26fa3e2..5244bea92f 100644
--- a/src/profiler/heap-snapshot-generator.cc
+++ b/src/profiler/heap-snapshot-generator.cc
@@ -191,7 +191,7 @@ HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, bool global_objects_as_roots)
@@ -629,19 +655,6 @@ index 436dbe7797..6db3de346d 100644
STATIC_ASSERT(kSystemPointerSize != 8 || sizeof(HeapEntry) == 48);
#else // !V8_CC_MSVC
STATIC_ASSERT(kSystemPointerSize != 8 || sizeof(HeapEntry) == 40);
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc
index 9ba26c23ad..5857bf4c39 100644
--- a/src/runtime/runtime-wasm.cc
+++ b/src/runtime/runtime-wasm.cc
@@ -570,7 +570,7 @@ RUNTIME_FUNCTION(Runtime_WasmDebugBreak) {
DebugScope debug_scope(isolate->debug());
// Check for instrumentation breakpoint.
- DCHECK_EQ(script->break_on_entry(), instance->break_on_entry());
+ DCHECK_EQ(script->break_on_entry(), static_cast<bool>(instance->break_on_entry()));
if (script->break_on_entry()) {
MaybeHandle<FixedArray> maybe_on_entry_breakpoints =
WasmScript::CheckBreakPoints(
diff --git a/src/snapshot/snapshot-utils.cc b/src/snapshot/snapshot-utils.cc
index eb2372372c..7defadb4b1 100644
--- a/src/snapshot/snapshot-utils.cc
@@ -695,10 +708,10 @@ index 09673c8ccc..2d221a802d 100644
#include "src/trap-handler/handler-inside-win.h"
#include "src/trap-handler/trap-handler.h"
diff --git a/src/wasm/function-body-decoder-impl.h b/src/wasm/function-body-decoder-impl.h
index 6c9700b100..e3be3c31f5 100644
index d37f718681..3a409e1d76 100644
--- a/src/wasm/function-body-decoder-impl.h
+++ b/src/wasm/function-body-decoder-impl.h
@@ -2006,7 +2006,7 @@ class WasmDecoder : public Decoder {
@@ -2013,7 +2013,7 @@ class WasmDecoder : public Decoder {
}
// TODO(clemensb): This is only used by the interpreter; move there.
@@ -707,11 +720,33 @@ index 6c9700b100..e3be3c31f5 100644
WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
// Handle "simple" opcodes with a fixed signature first.
const FunctionSig* sig = WasmOpcodes::Signature(opcode);
diff --git a/src/wasm/wasm-external-refs.cc b/src/wasm/wasm-external-refs.cc
index f3d900b79a..101d563876 100644
--- a/src/wasm/wasm-external-refs.cc
+++ b/src/wasm/wasm-external-refs.cc
@@ -238,7 +238,7 @@ void float32_to_uint64_sat_wrapper(Address data) {
WriteUnalignedValue<uint64_t>(data, static_cast<uint64_t>(input));
return;
}
- if (input >= std::numeric_limits<uint64_t>::max()) {
+ if (input >= static_cast<float>(std::numeric_limits<uint64_t>::max())) {
WriteUnalignedValue<uint64_t>(data, std::numeric_limits<uint64_t>::max());
return;
}
@@ -268,7 +268,7 @@ void float64_to_uint64_sat_wrapper(Address data) {
WriteUnalignedValue<uint64_t>(data, static_cast<uint64_t>(input));
return;
}
- if (input >= std::numeric_limits<uint64_t>::max()) {
+ if (input >= static_cast<double>(std::numeric_limits<uint64_t>::max())) {
WriteUnalignedValue<uint64_t>(data, std::numeric_limits<uint64_t>::max());
return;
}
diff --git a/test/cctest/BUILD.gn b/test/cctest/BUILD.gn
index e63fe5ed35..2f39d3efb0 100644
index ffa4e3a136..eb26eb7957 100644
--- a/test/cctest/BUILD.gn
+++ b/test/cctest/BUILD.gn
@@ -35,6 +35,12 @@ v8_executable("cctest") {
@@ -32,6 +32,12 @@ v8_executable("cctest") {
"../..:v8_tracing_config",
":cctest_config",
]
@@ -724,7 +759,7 @@ index e63fe5ed35..2f39d3efb0 100644
ldflags = []
@@ -475,17 +481,28 @@ v8_source_set("cctest_sources") {
@@ -488,17 +494,28 @@ v8_source_set("cctest_sources") {
}
if (is_win) {
@@ -765,10 +800,10 @@ index e63fe5ed35..2f39d3efb0 100644
}
diff --git a/test/unittests/BUILD.gn b/test/unittests/BUILD.gn
index 1940dfa77e..b7869e1dbd 100644
index 43858603dc..a4420ed05a 100644
--- a/test/unittests/BUILD.gn
+++ b/test/unittests/BUILD.gn
@@ -186,6 +186,12 @@ v8_executable("unittests") {
@@ -187,6 +187,12 @@ v8_executable("unittests") {
"../..:external_config",
"../..:internal_config_base",
]
@@ -781,9 +816,9 @@ index 1940dfa77e..b7869e1dbd 100644
}
v8_source_set("unittests_sources") {
@@ -492,10 +498,12 @@ v8_source_set("unittests_sources") {
"//testing/gtest",
]
@@ -501,10 +507,12 @@ v8_source_set("unittests_sources") {
deps += [ "../..:wasm_test_common" ]
}
- if (is_win) {
+ if (is_win && !is_mingw) {
@@ -858,10 +893,10 @@ index 2f8197dd36..9b1e4fabb9 100644
}
}
diff --git a/tools/debug_helper/BUILD.gn b/tools/debug_helper/BUILD.gn
index 54cd3b7a4c..9c6666871d 100644
index 2256df1f55..29e27c6af9 100644
--- a/tools/debug_helper/BUILD.gn
+++ b/tools/debug_helper/BUILD.gn
@@ -99,10 +99,12 @@ v8_component("v8_debug_helper") {
@@ -100,10 +100,12 @@ v8_component("v8_debug_helper") {
"../..:v8_libbase",
"../..:v8_shared_internal_headers",
"../..:v8_tracing",
@@ -875,7 +910,7 @@ index 54cd3b7a4c..9c6666871d 100644
}
diff --git a/tools/v8windbg/BUILD.gn b/tools/v8windbg/BUILD.gn
index 10d06a127f..49654be32c 100644
index 5618d2d945..421a2fa7a5 100644
--- a/tools/v8windbg/BUILD.gn
+++ b/tools/v8windbg/BUILD.gn
@@ -6,7 +6,9 @@ import("../../gni/v8.gni")

View File

@@ -44,10 +44,10 @@ index ed94a16a0..3e4a62d24 100644
]
}
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 0ef73ab2b..527203c6d 100644
index 725894d05..8918064c5 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -130,8 +130,12 @@ declare_args() {
@@ -130,12 +130,16 @@ declare_args() {
# separate flags.
is_official_build = false
@@ -55,30 +55,43 @@ index 0ef73ab2b..527203c6d 100644
+ is_mingw = getenv("MSYSTEM") != "" && getenv("MSYSTEM") != "MSYS"
+
# Set to true when compiling with the Clang compiler.
is_clang = current_os != "linux" ||
+ !(getenv("MSYSTEM") != "" && getenv("MSYSTEM") != "MSYS") ||
- is_clang = current_os != "linux" ||
+ is_clang = (current_os != "linux" ||
(current_cpu != "s390x" && current_cpu != "s390" &&
current_cpu != "ppc64" && current_cpu != "ppc" &&
current_cpu != "mips" && current_cpu != "mips64" &&
@@ -201,11 +205,15 @@ if (host_toolchain == "") {
- current_cpu != "riscv64")
+ current_cpu != "riscv64")) ||
+ (getenv("CXX") == "clang" || getenv("CXX") == "clang++")
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
@@ -199,13 +203,17 @@ if (host_toolchain == "") {
# configurations we support this will always work and it saves build steps.
# Windows ARM64 targets require an x64 host for cross build.
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang) {
- if (is_clang) {
+ if (is_clang && !is_mingw) {
host_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
+ } else if (is_mingw) {
+ host_toolchain = "//build/toolchain/win:mingw_$target_cpu"
} else {
host_toolchain = "//build/toolchain/win:$target_cpu"
}
} else if (is_clang) {
- } else if (is_clang) {
+ } else if (is_clang && !is_mingw) {
host_toolchain = "//build/toolchain/win:win_clang_$host_cpu"
+ } else if (is_mingw) {
+ host_toolchain = "//build/toolchain/win:mingw_$host_cpu"
} else {
host_toolchain = "//build/toolchain/win:$host_cpu"
}
@@ -242,6 +250,8 @@ if (target_os == "android") {
@@ -240,8 +248,10 @@ if (target_os == "android") {
} else if (target_os == "win") {
# On Windows, we use the same toolchain for host and target by default.
# Beware, win cross builds have some caveats, see docs/win_cross.md
if (is_clang) {
- if (is_clang) {
+ if (is_clang && !is_mingw) {
_default_toolchain = "//build/toolchain/win:win_clang_$target_cpu"
+ } else if (is_mingw) {
+ _default_toolchain = "//build/toolchain/win:mingw_$target_cpu"
@@ -86,10 +99,10 @@ index 0ef73ab2b..527203c6d 100644
_default_toolchain = "//build/toolchain/win:$target_cpu"
}
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 0c8743726..c60704e6d 100644
index 1904a2559..cd13c8d7d 100644
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -299,8 +299,8 @@ config("compiler") {
@@ -317,8 +317,8 @@ config("compiler") {
}
# In general, Windows is totally different, but all the other builds share
@@ -100,7 +113,7 @@ index 0c8743726..c60704e6d 100644
# Common POSIX compiler flags setup.
# --------------------------------
cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204
@@ -314,7 +314,7 @@ config("compiler") {
@@ -332,7 +332,7 @@ config("compiler") {
} else {
cflags += [ "-fstack-protector" ]
}
@@ -109,7 +122,7 @@ index 0c8743726..c60704e6d 100644
# TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it.
# See also https://crbug.com/533294
cflags += [ "--param=ssp-buffer-size=4" ]
@@ -325,6 +325,12 @@ config("compiler") {
@@ -343,6 +343,12 @@ config("compiler") {
} else if (current_os != "aix") {
# Not available on aix.
cflags += [ "-fstack-protector" ]
@@ -122,7 +135,7 @@ index 0c8743726..c60704e6d 100644
}
}
@@ -354,7 +360,7 @@ config("compiler") {
@@ -375,7 +381,7 @@ config("compiler") {
# Non-Mac Posix and Fuchsia compiler flags setup.
# -----------------------------------
@@ -131,7 +144,7 @@ index 0c8743726..c60704e6d 100644
if (enable_profiling) {
if (!is_debug) {
cflags += [ "-g" ]
@@ -503,7 +509,7 @@ config("compiler") {
@@ -515,11 +521,11 @@ config("compiler") {
# TODO(thakis): Make the driver pass --color-diagnostics to the linker
# if -fcolor-diagnostics is passed to it, and pass -fcolor-diagnostics
# in ldflags instead.
@@ -140,7 +153,12 @@ index 0c8743726..c60704e6d 100644
# On Windows, we call the linker directly, instead of calling it through
# the driver.
ldflags += [ "--color-diagnostics" ]
@@ -538,7 +544,7 @@ config("compiler") {
- } else {
+ } else if(!is_clang) {
ldflags += [ "-Wl,--color-diagnostics" ]
}
}
@@ -550,7 +556,7 @@ config("compiler") {
# C11/C++11 compiler flags setup.
# ---------------------------
@@ -149,7 +167,7 @@ index 0c8743726..c60704e6d 100644
current_os == "aix") {
if (target_os == "android") {
cxx11_override = use_cxx11_on_android
@@ -642,7 +648,7 @@ config("compiler") {
@@ -654,7 +660,7 @@ config("compiler") {
# should be able to better manage binary size increases on its own.
import_instr_limit = 5
@@ -158,8 +176,8 @@ index 0c8743726..c60704e6d 100644
ldflags += [
"/opt:lldltojobs=all",
"-mllvm:-import-instr-limit=$import_instr_limit",
@@ -689,7 +695,7 @@ config("compiler") {
# Tracked by llvm bug: https://bugs.llvm.org/show_bug.cgi?id=48245
@@ -704,7 +710,7 @@ config("compiler") {
# TODO(https://crbug.com/1211155): investigate why this isn't effective on arm32.
if (!is_android || current_cpu == "arm64") {
cflags += [ "-fwhole-program-vtables" ]
- if (!is_win) {
@@ -167,7 +185,7 @@ index 0c8743726..c60704e6d 100644
ldflags += [ "-fwhole-program-vtables" ]
}
}
@@ -707,7 +713,7 @@ config("compiler") {
@@ -722,7 +728,7 @@ config("compiler") {
if (compiler_timing) {
if (is_clang && !is_nacl) {
cflags += [ "-ftime-trace" ]
@@ -176,7 +194,24 @@ index 0c8743726..c60704e6d 100644
cflags += [
# "Documented" here:
# http://aras-p.info/blog/2017/10/23/Best-unknown-MSVC-flag-d2cgsummary/
@@ -758,7 +764,7 @@ config("compiler") {
@@ -742,12 +748,14 @@ config("compiler") {
# jumps. Turn it off by default and enable selectively for targets where it's
# beneficial.
if (use_lld && !enable_call_graph_profile_sort) {
- if (is_win) {
+ if (is_win && !is_mingw) {
ldflags += [ "/call-graph-profile-sort:no" ]
} else if (!is_apple) {
# TODO(thakis): Once LLD's Mach-O port basically works, implement call
# graph profile sorting for it, add an opt-out flag, and pass it here.
- ldflags += [ "-Wl,--no-call-graph-profile-sort" ]
+ if(!(is_mingw && is_clang)){
+ ldflags += [ "-Wl,--no-call-graph-profile-sort" ]
+ }
}
}
@@ -784,7 +792,7 @@ config("compiler") {
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler. The Windows assembler takes different types of flags
# so only do so for posix platforms.
@@ -185,7 +220,7 @@ index 0c8743726..c60704e6d 100644
asmflags += cflags
asmflags += cflags_c
}
@@ -812,7 +818,7 @@ config("compiler_cpu_abi") {
@@ -838,7 +846,7 @@ config("compiler_cpu_abi") {
ldflags = []
defines = []
@@ -194,7 +229,7 @@ index 0c8743726..c60704e6d 100644
# CPU architecture. We may or may not be doing a cross compile now, so for
# simplicity we always explicitly set the architecture.
if (current_cpu == "x64") {
@@ -1166,7 +1172,7 @@ config("compiler_deterministic") {
@@ -1192,7 +1200,7 @@ config("compiler_deterministic") {
# Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for
# deterministic build. See https://crbug.com/314403
if (!is_official_build) {
@@ -203,7 +238,16 @@ index 0c8743726..c60704e6d 100644
cflags += [
"/wd4117", # Trying to define or undefine a predefined macro.
"/D__DATE__=",
@@ -1327,7 +1333,7 @@ config("default_warnings") {
@@ -1227,7 +1235,7 @@ config("compiler_deterministic") {
asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
}
- if (is_win && use_lld) {
+ if (is_win && use_lld && !is_mingw) {
if (symbol_level == 2 || (is_clang && using_sanitizer)) {
# Absolutize source file paths for PDB. Pass the real build directory
# if the pdb contains source-level debug information and if linker
@@ -1353,7 +1361,7 @@ config("default_warnings") {
cflags_cc = []
ldflags = []
@@ -212,7 +256,7 @@ index 0c8743726..c60704e6d 100644
if (treat_warnings_as_errors) {
cflags += [ "/WX" ]
}
@@ -1537,15 +1543,32 @@ config("default_warnings") {
@@ -1563,15 +1571,34 @@ config("default_warnings") {
# files.
cflags += [ "-Wno-packed-not-aligned" ]
}
@@ -221,13 +265,16 @@ index 0c8743726..c60704e6d 100644
+ cflags += [
+ "-Wno-attributes", # "__decspec(dllimport) inline"
+ "-Wno-format", # PRIu64 llu support on MinGW
+ "-Wno-unused-but-set-variable",
+ "-Wno-stringop-overflow", # False positive overflow error on gcc 10
+
+ ]
+ cflags_cc += [
+ "-Wno-subobject-linkage", # Tests having code in header files
+ ]
+ if(!is_clang) {
+ cflags_cc += [
+ "-Wno-subobject-linkage", # Tests having code in header files
+ ]
+ cflags += [
+ "-Wno-unused-but-set-variable",
+ "-Wno-stringop-overflow", # False positive overflow error on gcc 10
+ ]
+ }
+ }
}
@@ -238,7 +285,6 @@ index 0c8743726..c60704e6d 100644
# Disables.
"-Wno-missing-field-initializers", # "struct foo f = {0};"
"-Wno-unused-parameter", # Unused function parameters.
+ "-Wno-invalid-offsetof", # Use of "conditionally-supported" offsetof in c++17
]
+ if(is_clang){
+ cflags += ["-Wno-range-loop-construct"] # Use of "conditionally-supported" offsetof in c++17
@@ -246,7 +292,28 @@ index 0c8743726..c60704e6d 100644
}
if (is_clang) {
@@ -1630,7 +1653,7 @@ config("default_warnings") {
@@ -1617,12 +1644,16 @@ config("default_warnings") {
# TODO(https://crbug.com/1028110): Evaluate and possible enable.
"-Wno-deprecated-copy",
-
- # TODO(https://crbug.com/1203071): Clean up and enable.
- "-Wno-unused-but-set-parameter",
- "-Wno-unused-but-set-variable",
]
+ if(!is_mingw){ # Clang on MinGW doesn't have these.
+ cflags += [
+ # TODO(https://crbug.com/1203071): Clean up and enable.
+ "-Wno-unused-but-set-parameter",
+ "-Wno-unused-but-set-variable",
+ ]
+ }
+
cflags_c += [
# TODO(https://crbug.com/995993): Clean up and enable.
"-Wno-implicit-fallthrough",
@@ -1642,7 +1673,7 @@ config("default_warnings") {
# part of Chromium.
config("chromium_code") {
@@ -255,7 +322,7 @@ index 0c8743726..c60704e6d 100644
cflags = [ "/W4" ] # Warning level 4.
if (is_clang) {
@@ -1723,7 +1746,7 @@ config("no_chromium_code") {
@@ -1735,7 +1766,7 @@ config("no_chromium_code") {
cflags_cc = []
defines = []
@@ -264,7 +331,7 @@ index 0c8743726..c60704e6d 100644
cflags += [
"/W3", # Warning level 3.
"/wd4800", # Disable warning when forcing value to bool.
@@ -1782,7 +1805,7 @@ config("noshadowing") {
@@ -1798,7 +1829,7 @@ config("noshadowing") {
# Allows turning Run-Time Type Identification on or off.
config("rtti") {
@@ -273,7 +340,7 @@ index 0c8743726..c60704e6d 100644
cflags_cc = [ "/GR" ]
} else {
cflags_cc = [ "-frtti" ]
@@ -1792,7 +1815,7 @@ config("rtti") {
@@ -1808,7 +1839,7 @@ config("rtti") {
config("no_rtti") {
# Some sanitizer configs may require RTTI to be left enabled globally
if (!use_rtti) {
@@ -282,7 +349,16 @@ index 0c8743726..c60704e6d 100644
cflags_cc = [ "/GR-" ]
} else {
cflags_cc = [ "-fno-rtti" ]
@@ -1845,7 +1868,7 @@ config("thin_archive") {
@@ -1850,7 +1881,7 @@ config("thin_archive") {
# archives.
# TODO(crbug.com/1221615): Enable on is_apple if use_lld once that no longer
# confuses lldb.
- if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) {
+ if ((is_posix && !is_nacl && !is_apple) || is_fuchsia || is_mingw) {
arflags = [ "-T" ]
} else if (is_win && use_lld) {
arflags = [ "/llvmlibthin" ]
@@ -1863,7 +1894,7 @@ config("thin_archive") {
# Note: exceptions are disallowed in Google code.
config("exceptions") {
@@ -291,7 +367,7 @@ index 0c8743726..c60704e6d 100644
# Enables exceptions in the STL.
if (!use_custom_libcxx) {
defines = [ "_HAS_EXCEPTIONS=1" ]
@@ -1854,11 +1877,17 @@ config("exceptions") {
@@ -1872,11 +1903,17 @@ config("exceptions") {
} else {
cflags_cc = [ "-fexceptions" ]
cflags_objcc = cflags_cc
@@ -310,7 +386,7 @@ index 0c8743726..c60704e6d 100644
# Disables exceptions in the STL.
# libc++ uses the __has_feature macro to control whether to use exceptions,
# so defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
@@ -1928,7 +1957,7 @@ config("no_shorten_64_warnings") {
@@ -1946,7 +1983,7 @@ config("no_shorten_64_warnings") {
if (is_clang) {
cflags = [ "-Wno-shorten-64-to-32" ]
} else {
@@ -319,7 +395,7 @@ index 0c8743726..c60704e6d 100644
# MSVC does not have an explicit warning equivalent to
# -Wshorten-64-to-32 but 4267 warns for size_t -> int
# on 64-bit builds, so is the closest.
@@ -1968,12 +1997,22 @@ config("no_incompatible_pointer_warnings") {
@@ -1986,12 +2023,22 @@ config("no_incompatible_pointer_warnings") {
# Shared settings for both "optimize" and "optimize_max" configs.
# IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
@@ -344,7 +420,7 @@ index 0c8743726..c60704e6d 100644
if (!is_asan) {
common_optimize_on_cflags += [
# Put data in separate COMDATs. This allows the linker
@@ -2069,7 +2108,7 @@ config("default_stack_frames") {
@@ -2092,7 +2139,7 @@ config("default_stack_frames") {
# Default "optimization on" config.
config("optimize") {
@@ -353,7 +429,7 @@ index 0c8743726..c60704e6d 100644
if (chrome_pgo_phase != 2) {
# Favor size over speed, /O1 must be before the common flags.
# /O1 implies /Os and /GF.
@@ -2104,7 +2143,7 @@ config("optimize") {
@@ -2127,7 +2174,7 @@ config("optimize") {
# Turn off optimizations.
config("no_optimize") {
@@ -362,7 +438,7 @@ index 0c8743726..c60704e6d 100644
cflags = [
"/Od", # Disable optimization.
"/Ob0", # Disable all inlining (on by default).
@@ -2156,7 +2195,7 @@ config("optimize_max") {
@@ -2179,7 +2226,7 @@ config("optimize_max") {
configs = [ "//build/config/nacl:irt_optimize" ]
} else {
ldflags = common_optimize_on_ldflags
@@ -371,7 +447,7 @@ index 0c8743726..c60704e6d 100644
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
@@ -2188,7 +2227,7 @@ config("optimize_speed") {
@@ -2211,7 +2258,7 @@ config("optimize_speed") {
configs = [ "//build/config/nacl:irt_optimize" ]
} else {
ldflags = common_optimize_on_ldflags
@@ -380,7 +456,7 @@ index 0c8743726..c60704e6d 100644
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
@@ -2320,7 +2359,7 @@ config("win_pdbaltpath") {
@@ -2343,7 +2390,7 @@ config("win_pdbaltpath") {
# Full symbols.
config("symbols") {
@@ -389,7 +465,7 @@ index 0c8743726..c60704e6d 100644
if (is_clang) {
cflags = [ "/Z7" ] # Debug information in the .obj files.
} else {
@@ -2372,7 +2411,8 @@ config("symbols") {
@@ -2385,7 +2432,8 @@ config("symbols") {
# build-directory-independent output. pnacl and nacl-clang do support that
# flag, so we can use use -g1 for pnacl and nacl-clang compiles.
# gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang.
@@ -399,7 +475,18 @@ index 0c8743726..c60704e6d 100644
cflags += [ "-g2" ]
}
@@ -2423,7 +2463,7 @@ config("symbols") {
@@ -2419,7 +2467,9 @@ config("symbols") {
# sections (llvm.org/PR34820).
cflags += [ "-ggnu-pubnames" ]
}
- ldflags += [ "-Wl,--gdb-index" ]
+ if(!(is_mingw && is_clang)){
+ ldflags += [ "-Wl,--gdb-index" ]
+ }
}
}
@@ -2438,7 +2488,7 @@ config("symbols") {
# This config guarantees to hold symbol for stack trace which are shown to user
# when crash happens in unittests running on buildbot.
config("minimal_symbols") {
@@ -407,8 +494,8 @@ index 0c8743726..c60704e6d 100644
+ if (is_win && !is_mingw) {
# Functions, files, and line tables only.
cflags = []
ldflags = [ "/DEBUG" ]
@@ -2482,7 +2522,7 @@ config("minimal_symbols") {
@@ -2503,7 +2553,7 @@ config("minimal_symbols") {
# told to not generate debug information and the linker then just puts function
# names in the final debug information.
config("no_symbols") {
@@ -417,7 +504,7 @@ index 0c8743726..c60704e6d 100644
ldflags = [ "/DEBUG" ]
# All configs using /DEBUG should include this:
@@ -2575,6 +2615,11 @@ buildflag_header("compiler_buildflags") {
@@ -2599,6 +2649,11 @@ buildflag_header("compiler_buildflags") {
config("cet_shadow_stack") {
if (enable_cet_shadow_stack && is_win) {
assert(target_cpu == "x64")
@@ -574,43 +661,18 @@ index 428e44ac0..a0d2175ee 100644
assert(defined(invoker.packages),
"Variable |packages| must be defined to be a list in pkg_config.")
diff --git a/config/win/BUILD.gn b/config/win/BUILD.gn
index 813c72c05..b3a2051c1 100644
index 59caa7b42..85b7099e5 100644
--- a/config/win/BUILD.gn
+++ b/config/win/BUILD.gn
@@ -46,7 +46,7 @@ declare_args() {
@@ -47,6 +47,7 @@ declare_args() {
# is applied to all targets. It is here to separate out the logic that is
# Windows-only.
config("compiler") {
- if (current_cpu == "x86") {
+ if (current_cpu == "x86" && !is_mingw) {
+ if(!is_mingw){
if (current_cpu == "x86") {
asmflags = [
# When /safeseh is specified, the linker will only produce an image if it
# can also produce a table of the image's safe exception handlers. This
@@ -57,27 +57,36 @@ config("compiler") {
]
}
- cflags = [
- "/Gy", # Enable function-level linking.
- "/FS", # Preserve previous PDB behavior.
- "/bigobj", # Some of our files are bigger than the regular limits.
- "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
- ]
+ if(!is_mingw) {
+ cflags = [
+ "/Gy", # Enable function-level linking.
+ "/FS", # Preserve previous PDB behavior.
+ "/bigobj", # Some of our files are bigger than the regular limits.
+ "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
+ ]
+ } else {
+ cflags = [
+ "-Wa,-mbig-obj",
+ "-fno-keep-inline-dllexport"
+ ]
+ }
if (is_clang) {
@@ -69,16 +70,16 @@ config("compiler") {
cflags += [ "/Zc:twoPhase" ]
}
@@ -619,7 +681,6 @@ index 813c72c05..b3a2051c1 100644
- # modes.
- cflags_c = [ "/TC" ]
- cflags_cc = [ "/TP" ]
+ if(!is_mingw) {
+ # Force C/C++ mode for the given GN detected file type. This is necessary
+ # for precompiled headers where the same source file is compiled in both
+ # modes.
@@ -634,51 +695,27 @@ index 813c72c05..b3a2051c1 100644
+ # Work around crbug.com/526851, bug in VS 2015 RTM compiler.
+ "/Zc:sizedDealloc-",
+ ]
+ }
if (is_clang) {
# Required to make the 19041 SDK compatible with clang-cl.
@@ -150,7 +159,7 @@ config("compiler") {
ldflags += [ "/lldignoreenv" ]
}
- if (!is_debug && !is_component_build) {
+ if (!is_debug && !is_component_build && !is_mingw) {
# Enable standard linker optimizations like GC (/OPT:REF) and ICF in static
# release builds.
# Release builds always want these optimizations, so enable them explicitly.
@@ -175,17 +184,19 @@ config("compiler") {
ldflags += [ "/PROFILE" ]
}
- # arflags apply only to static_libraries. The normal linker configs are only
- # set for executable and shared library targets so arflags must be set
- # elsewhere. Since this is relatively contained, we just apply them in this
- # more general config and they will only have an effect on static libraries.
- arflags = [
- # "No public symbols found; archive member will be inaccessible." This
- # means that one or more object files in the library can never be
- # pulled in to targets that link to this library. It's just a warning that
- # the source file is a no-op.
- "/ignore:4221",
- ]
+ if(!is_mingw){
+ # arflags apply only to static_libraries. The normal linker configs are only
+ # set for executable and shared library targets so arflags must be set
+ # elsewhere. Since this is relatively contained, we just apply them in this
+ # more general config and they will only have an effect on static libraries.
+ arflags = [
+ # "No public symbols found; archive member will be inaccessible." This
+ # means that one or more object files in the library can never be
+ # pulled in to targets that link to this library. It's just a warning that
+ # the source file is a no-op.
+ "/ignore:4221",
@@ -188,6 +189,16 @@ config("compiler") {
# the source file is a no-op.
"/ignore:4221",
]
+ } else { # is_mingw
+ cflags = [
+ "-Wa,-mbig-obj"
+ ]
+ if(!is_clang) {
+ cflags += [
+ "-fno-keep-inline-dllexport"
+ ]
+ }
+ }
}
# This is included by reference in the //build/config/compiler:runtime_library
@@ -294,29 +305,31 @@ config("sdk_link") {
@@ -296,29 +307,31 @@ config("sdk_link") {
ldflags = [ "/MACHINE:ARM64" ]
}
@@ -732,7 +769,7 @@ index 813c72c05..b3a2051c1 100644
}
}
@@ -324,19 +337,27 @@ config("sdk_link") {
@@ -326,19 +339,27 @@ config("sdk_link") {
# targets who want different library configurations can remove this and specify
# their own.
config("common_linker_setup") {
@@ -772,7 +809,25 @@ index 813c72c05..b3a2051c1 100644
}
}
@@ -373,7 +394,7 @@ config("cfi_linker") {
@@ -347,7 +368,7 @@ config("default_cfg_compiler") {
# This is needed to allow functions to be called by code that is built
# with CFG enabled, such as system libraries.
# The CFG guards are only emitted if |win_enable_cfg_guards| is enabled.
- if (is_clang) {
+ if (is_clang && !is_mingw) {
if (win_enable_cfg_guards) {
cflags = [ "/guard:cf" ]
} else {
@@ -362,7 +383,7 @@ config("disable_guards_cfg_compiler") {
# Emit table of address-taken functions for Control-Flow Guard (CFG).
# This is needed to allow functions to be called by code that is built
# with CFG enabled, such as system libraries.
- if (is_clang) {
+ if (is_clang && !is_mingw) {
cflags = [ "/guard:cf,nochecks" ]
}
}
@@ -375,7 +396,7 @@ config("cfi_linker") {
# ASan and CFG leads to slow process startup. Chromium's test runner uses
# lots of child processes, so this means things are really slow. Disable CFG
# for now. https://crbug.com/846966
@@ -781,7 +836,7 @@ index 813c72c05..b3a2051c1 100644
# Turn on CFG bitmap generation and CFG load config.
ldflags = [ "/guard:cf" ]
}
@@ -464,20 +485,22 @@ config("delayloads_not_for_child_dll") {
@@ -466,20 +487,22 @@ config("delayloads_not_for_child_dll") {
# See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of
# what each value does.
config("default_crt") {
@@ -816,7 +871,7 @@ index 813c72c05..b3a2051c1 100644
}
}
}
@@ -518,42 +541,54 @@ config("static_crt") {
@@ -541,42 +564,58 @@ config("static_crt") {
if (current_cpu == "x64") {
# The number after the comma is the minimum required OS version.
# 5.02 = Windows Server 2003.
@@ -835,7 +890,9 @@ index 813c72c05..b3a2051c1 100644
config("console") {
- ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ]
+ if(is_mingw){
+ cflags = [ "-mconsole" ]
+ if(!is_clang) {
+ cflags = [ "-mconsole" ]
+ }
+ ldflags = [ "-Wl,--subsystem,console:$subsystem_version_suffix" ]
+ } else {
+ ldflags = [ "/SUBSYSTEM:CONSOLE,$subsystem_version_suffix" ]
@@ -844,7 +901,9 @@ index 813c72c05..b3a2051c1 100644
config("windowed") {
- ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
+ if(is_mingw){
+ cflags = [ "-mwindows" ]
+ if(!is_clang) {
+ cflags = [ "-mwindows" ]
+ }
+ ldflags = [ "-Wl,--subsystem,windows:$subsystem_version_suffix" ]
+ } else {
+ ldflags = [ "/SUBSYSTEM:WINDOWS,$subsystem_version_suffix" ]
@@ -891,7 +950,7 @@ index 813c72c05..b3a2051c1 100644
}
}
@@ -565,6 +600,9 @@ config("unicode") {
@@ -588,6 +627,9 @@ config("unicode") {
"_UNICODE",
"UNICODE",
]
@@ -901,7 +960,7 @@ index 813c72c05..b3a2051c1 100644
}
# Lean and mean ----------------------------------------------------------------
@@ -585,3 +623,21 @@ config("lean_and_mean") {
@@ -608,3 +650,21 @@ config("lean_and_mean") {
config("nominmax") {
defines = [ "NOMINMAX" ]
}
@@ -1025,10 +1084,10 @@ index 39aef4d1e..7e83b058a 100644
if __name__ == "__main__":
sys.exit(main())
diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni
index 9418f5cea..4484c2e76 100644
index a303d472b..789bc930a 100644
--- a/toolchain/gcc_toolchain.gni
+++ b/toolchain/gcc_toolchain.gni
@@ -59,6 +59,7 @@ if (enable_resource_allowlist_generation) {
@@ -56,6 +56,7 @@ if (enable_resource_allowlist_generation) {
# - cc
# - cxx
# - ld
@@ -1036,7 +1095,7 @@ index 9418f5cea..4484c2e76 100644
#
# Optional parameters that control the tools:
#
@@ -111,7 +112,9 @@ template("gcc_toolchain") {
@@ -108,7 +109,9 @@ template("gcc_toolchain") {
assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value")
assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value")
@@ -1047,17 +1106,14 @@ index 9418f5cea..4484c2e76 100644
# This define changes when the toolchain changes, forcing a rebuild.
# Nothing should ever use this define.
if (defined(invoker.rebuild_define)) {
@@ -269,15 +272,19 @@ template("gcc_toolchain") {
@@ -279,15 +282,20 @@ template("gcc_toolchain") {
asm = asm_prefix + invoker.cc
ar = invoker.ar
ld = "$goma_ld${invoker.ld}"
ld = link_prefix + invoker.ld
- if (defined(invoker.readelf)) {
- readelf = invoker.readelf
- } else {
- readelf = "readelf"
- }
- if (defined(invoker.nm)) {
- nm = invoker.nm
+ if(!is_mingw){
+ if (defined(invoker.readelf)) {
+ readelf = invoker.readelf
@@ -1069,13 +1125,17 @@ index 9418f5cea..4484c2e76 100644
+ } else {
+ nm = "nm"
+ }
} else {
}
- if (defined(invoker.nm)) {
- nm = invoker.nm
- } else {
- nm = "nm"
+ else {
+ rc = invoker.rc
}
if (defined(invoker.dwp)) {
dwp_switch = " --dwp=\"${invoker.dwp}\""
@@ -285,6 +292,7 @@ template("gcc_toolchain") {
@@ -295,6 +303,7 @@ template("gcc_toolchain") {
dwp_switch = ""
}
@@ -1083,7 +1143,7 @@ index 9418f5cea..4484c2e76 100644
if (defined(invoker.shlib_extension)) {
default_shlib_extension = invoker.shlib_extension
} else {
@@ -362,6 +370,16 @@ template("gcc_toolchain") {
@@ -372,6 +381,16 @@ template("gcc_toolchain") {
outputs = [ "$object_subdir/{{source_name_part}}.o" ]
}
@@ -1100,7 +1160,7 @@ index 9418f5cea..4484c2e76 100644
tool("asm") {
# For GCC we can just use the C compiler to compile assembly.
depfile = "{{output}}.d"
@@ -422,8 +440,6 @@ template("gcc_toolchain") {
@@ -435,8 +454,6 @@ template("gcc_toolchain") {
# .TOC file, overwrite it, otherwise, don't change it.
tocfile = sofile + ".TOC"
@@ -1109,7 +1169,7 @@ index 9418f5cea..4484c2e76 100644
# Generate a map file to be used for binary size analysis.
# Map file adds ~10% to the link time on a z620.
# With target_os="android", libchrome.so.map.gz is ~20MB.
@@ -433,13 +449,30 @@ template("gcc_toolchain") {
@@ -446,13 +463,39 @@ template("gcc_toolchain") {
map_switch = " --map-file \"$map_file\""
}
@@ -1121,9 +1181,14 @@ index 9418f5cea..4484c2e76 100644
}
+ mingw_flags = ""
+ soname_flags = "-Wl,-soname=\"$soname\""
+ if(is_mingw){
+ # Have MinGW linker generate a .def file and a .a import library
+ mingw_flags = " -Wl,--dll -Wl,--output-def=\"$sofile\".def -Wl,--out-implib=\"$sofile\".a "
+ mingw_flags = ""
+ if(!is_clang){
+ mingw_flags += " -Wl,--dll "
+ }
+ mingw_flags += " -Wl,--output-def=\"$sofile\".def -Wl,--out-implib=\"$sofile\".a "
+ readelf = ""
+ if (defined(invoker.readelf)) {
+ readelf = "${invoker.readelf} "
@@ -1132,18 +1197,22 @@ index 9418f5cea..4484c2e76 100644
+ if (defined(invoker.nm)) {
+ readelf = "${invoker.nm} "
+ }
+ if(is_clang) {
+ # Clang on Windows does not support the -soname flag.
+ soname_flags = ""
+ }
+ } else {
+ assert(defined(readelf), "to solink you must have a readelf")
+ assert(defined(nm), "to solink you must have an nm")
+ }
+
+ link_command = "$ld -shared -Wl,-soname=\"$soname\" ${mingw_flags} {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\""
+ link_command = "$ld -shared ${soname_flags} ${mingw_flags} {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\""
+
# This needs a Python script to avoid using a complex shell command
# requiring sh control structures, pipelines, and POSIX utilities.
# The host might not have a POSIX shell and utilities (e.g. Windows).
diff --git a/toolchain/win/BUILD.gn b/toolchain/win/BUILD.gn
index a8137526d..d512605e2 100644
index c3def9ece..ef44fefb6 100644
--- a/toolchain/win/BUILD.gn
+++ b/toolchain/win/BUILD.gn
@@ -10,6 +10,7 @@ import("//build/toolchain/cc_wrapper.gni")
@@ -1177,7 +1246,7 @@ index a8137526d..d512605e2 100644
}
if (host_os == "win") {
@@ -532,3 +535,29 @@ if (target_os == "winuwp") {
@@ -537,3 +540,26 @@ if (target_os == "winuwp") {
}
}
}
@@ -1185,19 +1254,16 @@ index a8137526d..d512605e2 100644
+template("mingw_toolchain") {
+ gcc_toolchain("mingw_" + target_name) {
+ forward_variables_from(invoker, "*")
+ cc = "gcc"
+ cxx = "g++"
+ ar = "ar"
+ cc = getenv("CC")
+ cxx = getenv("CXX")
+ ar = getenv("AR")
+ ld = cxx
+ if(is_mingw){
+ rc = "windres"
+ }
+ rc = "windres"
+ strip = "strip"
+ executable_extension = ".exe"
+ toolchain_args = {
+ current_cpu = target_name
+ current_os = "win"
+ is_clang = false
+ }
+ }
+}
@@ -1208,10 +1274,10 @@ index a8137526d..d512605e2 100644
+mingw_toolchain("x86") {
+}
diff --git a/util/lastchange.py b/util/lastchange.py
index 874870ad5..a4fc0be8d 100644
index 02a36642b..78934f1b0 100644
--- a/util/lastchange.py
+++ b/util/lastchange.py
@@ -191,7 +191,10 @@ def GetGitTopDirectory(source_dir):
@@ -192,7 +192,10 @@ def GetGitTopDirectory(source_dir):
Returns:
The output of "git rev-parse --show-toplevel" as a string
"""

View File

@@ -1,15 +1,5 @@
From 32c7b1cd351061bb4baa2af4f480b1e68997bd9c Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Fri, 14 Aug 2020 09:34:44 +0530
Subject: [PATCH 3/3] Do not remove output file after compilation
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
---
build/build_linux.ninja.template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/build_linux.ninja.template b/build/build_linux.ninja.template
index ab117fb..27339a7 100644
index ab117fb4..27339a7f 100644
--- a/build/build_linux.ninja.template
+++ b/build/build_linux.ninja.template
@@ -5,7 +5,7 @@ rule cxx
@@ -21,6 +11,39 @@ index ab117fb..27339a7 100644
description = AR $out
rule link
--
2.27.0
diff --git a/build/gen.py b/build/gen.py
index 922bf46f..522d4e43 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -306,6 +306,7 @@ def WriteGNNinja(path, platform, host, options):
cxx = os.environ.get('CXX', 'g++')
ld = os.environ.get('LD', 'g++')
ar = os.environ.get('AR', 'ar')
+ msystem = os.environ.get('MSYSTEM', '')
else:
cxx = os.environ.get('CXX', 'clang++')
ld = cxx
@@ -375,7 +376,8 @@ def WriteGNNinja(path, platform, host, options):
])
if platform.is_linux() or platform.is_mingw() or platform.is_msys():
- ldflags.append('-Wl,--as-needed')
+ if msystem != 'CLANG32' and msystem != 'CLANG64':
+ ldflags.append('-Wl,--as-needed')
if not options.no_static_libstdcpp:
ldflags.append('-static-libstdc++')
@@ -389,9 +391,12 @@ def WriteGNNinja(path, platform, host, options):
'-Wno-unused-variable',
'-Wno-format', # Use of %llx, which is supported by _UCRT, false positive
'-Wno-strict-aliasing', # Dereferencing punned pointer
- '-Wno-cast-function-type', # Casting FARPROC to RegDeleteKeyExPtr
'-std=gnu++17',
])
+ if msystem != 'CLANG32' and msystem != 'CLANG64':
+ cflags.extend([
+ '-Wno-cast-function-type', # Casting FARPROC to RegDeleteKeyExPtr
+ ])
else:
# This is needed by libc++.
libs.append('-ldl')

View File

@@ -5,7 +5,7 @@ SRCEXT='.src.tar.zst'
_realname=v8
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=9.0.257.17
pkgver=9.1.269.39
pkgrel=1
pkgdesc="Fast and modern Javascript engine (mingw-w64)"
arch=('any')
@@ -13,16 +13,18 @@ mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://v8.dev"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-ninja")
depends=("${MINGW_PACKAGE_PREFIX}-zlib"
depends=("${MINGW_PACKAGE_PREFIX}-libssp"
"${MINGW_PACKAGE_PREFIX}-zlib"
"${MINGW_PACKAGE_PREFIX}-icu")
source=("bare-clones/gn::git+https://gn.googlesource.com/gn#tag=5da62d5e9d0f10cb8ece7c30563a6a214c78b68d"
"https://github.com/v8/v8/archive/refs/tags/${pkgver}.zip"
"bare-clones/build::git+https://chromium.googlesource.com/chromium/src/build.git#commit=acacc4cc0668cb4dc7f44a3f4430635f438d7478"
"bare-clones/build::git+https://chromium.googlesource.com/chromium/src/build.git#commit=fd86d60f33cbc794537c4da2ef7e298d7f81138e"
"bare-clones/zlib::git+https://chromium.googlesource.com/chromium/src/third_party/zlib.git#commit=156be8c52f80cde343088b4a69a80579101b6e67"
"bare-clones/common::git+https://chromium.googlesource.com/chromium/src/base/trace_event/common.git#commit=dab187b372fc17e51f5b9fad8201813d0aed5129"
"bare-clones/googletest::git+https://chromium.googlesource.com/external/github.com/google/googletest.git#commit=10b1902d893ea8cc43c69541d70868f91af3646b"
"bare-clones/jinja2::git+https://chromium.googlesource.com/chromium/src/third_party/jinja2.git#commit=b41863e42637544c2941b574c7877d3e1f663e25"
"bare-clones/markupsafe::git+https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git#commit=8f45f5cfa0009d2a70589bcda0349b8cb2b72783"
"bare-clones/clang::git+https://chromium.googlesource.com/chromium/src/tools/clang.git#commit=ba668f13d135f1d01faf9b03c9a05f5877ac3f51"
"0000-add-mingw-main-code-changes.patch"
"0001-add-mingw-toolchain.patch"
"0002-gn-ninja-deletes-objs-workaround.patch"
@@ -32,16 +34,17 @@ source=("bare-clones/gn::git+https://gn.googlesource.com/gn#tag=5da62d5e9d0f10cb
"v8_libplatform.pc"
"v8.pc")
sha256sums=('SKIP'
'03dadee15a911aeb356c04e291e634ec7b99d5c206bdc733b3c560937f6af454'
'3a56c32da93f4007a72093fbdeec0046ed4625021613600df896fe315bf80ddb'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'f07e9391edd5fd25b061d1bc34bf5c56c45076b186fcc3176d4c7e8166eeed09'
'63d759de8bad9b8ac8879f8e69c24e62bf71fe14396cbdd190d48cabf8335800'
'b831576af25b275fca72851ec275c9d21bee0be29b4eb973a3e2a2580deac003'
'SKIP'
'54a2a05c9a7753d45665baff33a233c215c598e9f035ac6368c5de4d83073cd0'
'63f35c12168fcb5f025db2cb3a4bc693cb4546ce561dc95e45d10c1579daf786'
'4d3bac3c43a7e26fa74f0f6e787e609953c36a9e37e097d5df8f16fc795c289c'
'c10169e7a34e212b1a2bf0eaf45131485719f32a7c34d9a666b692f05a2aa830'
'b99874ea904724911528a5530c14f3051c358805bd36df9d205df31458ebf8b9'
'fbddbe4849b623afb320472aab316c9a08b54182161b6b4911cb7ef7d65e2b0e'
@@ -52,7 +55,6 @@ prepare() {
echo "Preparing GN source"
cd "${srcdir}"/gn
git apply ${srcdir}/0002-gn-ninja-deletes-objs-workaround.patch
python build/gen.py --out-path=out/${CARCH} --platform=mingw
echo "Patching v8 source"
cd "${srcdir}"/v8-${pkgver}
@@ -77,8 +79,8 @@ prepare() {
ln -sf "${srcdir}"/icu.gn "${srcdir}"/v8-${pkgver}/third_party/icu/BUILD.gn
echo "Soft linking extra repos"
mkdir -p ${srcdir}/v8-${pkgver}/base/trace_event
rm -rf ${srcdir}/v8-${pkgver}/base/trace_event/common
mkdir -p "${srcdir}"/v8-${pkgver}/base/trace_event
rm -rf "${srcdir}"/v8-${pkgver}/base/trace_event/common
ln -sf "${srcdir}"/common ${srcdir}/v8-${pkgver}/base/trace_event
rm -rf "${srcdir}"/v8-${pkgver}/third_party/googletest/src
ln -sf "${srcdir}"/googletest "${srcdir}"/v8-${pkgver}/third_party/googletest/src
@@ -86,6 +88,8 @@ prepare() {
ln -sf "${srcdir}"/jinja2 "${srcdir}"/v8-${pkgver}/third_party
rm -rf "${srcdir}"/v8-${pkgver}/third_party/markupsafe
ln -sf "${srcdir}"/markupsafe "${srcdir}"/v8-${pkgver}/third_party
rm -rf "${srcdir}"/v8-${pkgver}/tools/clang
ln -sf "${srcdir}"/clang "${srcdir}"/v8-${pkgver}/tools
_cflags=""
case ${CARCH} in
@@ -129,13 +133,33 @@ build() {
_is_debug=true
;;
esac
case ${MSYSTEM} in
CLANG64|CLANG32)
export CXX=clang++
export CC=clang
export LD=clang++
export AR=llvm-ar
_is_clang=true
_compiler_specific_args="clang_use_chrome_plugins=false"
;;
*)
export CXX=g++
export CC=gcc
export LD=g++
export AR=ar
_is_clang=false
_compiler_specific_args=""
;;
esac
export DEPOT_TOOLS_WIN_TOOLCHAIN=0
cd "${srcdir}"/gn
python build/gen.py --out-path=out/${CARCH} --platform=mingw
ninja -C out/${CARCH}
cd "${srcdir}"/v8-${pkgver}
"${srcdir}"/gn/out/${CARCH}/gn gen "${PWD}/out/${BUILDTYPE}-${CARCH}" --args="is_debug=${_is_debug} is_component_build=true target_cpu=\"${_arch}\" is_clang=false use_custom_libcxx=false v8_enable_verify_heap=false icu_use_data_file=false enable_iterator_debugging=${_is_debug} v8_use_external_startup_data=true"
# v8_enable_system_instrumentation=false is required because MinGW does not provide TraceLoggingProvider.h yet, remove once it does.
"${srcdir}"/gn/out/${CARCH}/gn gen "${PWD}/out/${BUILDTYPE}-${CARCH}" --args="is_debug=${_is_debug} is_component_build=true target_cpu=\"${_arch}\" is_clang=${_is_clang} use_custom_libcxx=false v8_enable_verify_heap=false icu_use_data_file=false enable_iterator_debugging=${_is_debug} ${_compiler_specific_args} v8_use_external_startup_data=true v8_enable_system_instrumentation=false"
ninja -C "${PWD}/out/${BUILDTYPE}-${CARCH}" :v8_libbase :v8_libplatform :v8 :d8 :torque :torque-language-server :mksnapshot
}