blob: 046f58d706d913cce6c8a3aa5e416ce409e6d1f1 [file] [log] [blame] [edit]
diff --git a/BUILD.gn b/BUILD.gn
index a9ab6783fa..5e144b24e0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -444,6 +444,11 @@ config("internal_config") {
if (is_component_build) {
defines += [ "BUILDING_V8_SHARED" ]
}
+ # Newer versions of gcc don't seem to trigger this warning,
+ # so remove this once it is no longer necesary
+ if(is_linux && !is_clang){
+ cflags = ["-Wno-invalid-offsetof"]
+ }
}
# Should be applied to all targets that write trace events.
@@ -942,17 +947,25 @@ config("toolchain") {
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
if (is_win) {
- # Ensure no surprising artifacts from 80bit double math with x86.
- cflags += [ "/arch:SSE2" ]
+ if(!is_mingw){
+ # Ensure no surprising artifacts from 80bit double math with x86.
+ cflags += [ "/arch:SSE2" ]
+ } else {
+ cflags += [ "-msse2" ]
+ }
}
}
if (v8_current_cpu == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ]
if (is_win) {
- # Increase the initial stack size. The default is 1MB, this is 2MB. This
- # applies only to executables and shared libraries produced by V8 since
- # ldflags are not pushed to dependants.
- ldflags += [ "/STACK:2097152" ]
+ if(!is_mingw){
+ # Increase the initial stack size. The default is 1MB, this is 2MB. This
+ # applies only to executables and shared libraries produced by V8 since
+ # ldflags are not pushed to dependants.
+ ldflags += [ "/STACK:2097152" ]
+ } else {
+ ldflags += [ "-Wl,--stack,2097152" ]
+ }
}
}
if (is_android && v8_android_log_stdout) {
@@ -1008,7 +1021,7 @@ config("toolchain") {
}
if (v8_no_inline) {
- if (is_win) {
+ if (is_win && !is_mingw) {
cflags += [ "/Ob0" ]
} else {
cflags += [
@@ -1032,7 +1045,7 @@ config("toolchain") {
}
}
- if (is_win) {
+ if (is_win && !is_mingw) {
cflags += [
"/wd4245", # Conversion with signed/unsigned mismatch.
"/wd4267", # Conversion with possible loss of data.
@@ -1054,11 +1067,11 @@ config("toolchain") {
]
}
- if (!is_clang && is_win) {
+ if (!is_clang && !is_mingw && is_win) {
cflags += [ "/wd4506" ] # Benign "no definition for inline function"
}
- if (!is_clang && !is_win) {
+ if (!is_clang && (!is_win || is_mingw)) {
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") {
defines += [ "_CRT_RAND_S" ] # for rand_s()
- libs = [
- "dbghelp.lib",
- "winmm.lib",
- "ws2_32.lib",
- ]
+ if(!is_mingw){
+ libs = [
+ "dbghelp.lib",
+ "winmm.lib",
+ "ws2_32.lib",
+ ]
- if (v8_enable_system_instrumentation) {
- libs += [ "advapi32.lib" ] # Needed for TraceLoggingProvider.h
- }
+ if (v8_enable_system_instrumentation) {
+ libs += [ "advapi32.lib" ] # Needed for TraceLoggingProvider.h
+ }
- data_deps += [ "//build/win:runtime_libs" ]
+ data_deps += [ "//build/win:runtime_libs" ]
+ } else {
+ libs = [
+ "dbghelp",
+ "winmm",
+ "ws2_32",
+ ]
+ }
}
if (v8_current_cpu == "mips" || v8_current_cpu == "mips64") {
@@ -4606,7 +4627,7 @@ v8_component("v8_libplatform") {
# TODO(skyostil): Switch TraceEventListener to protozero.
"//third_party/perfetto/protos/perfetto/trace:lite",
]
- } else if (is_win) {
+ } else if (is_win && !is_mingw) {
sources -= [ "src/libplatform/tracing/recorder-default.cc" ]
sources += [ "src/libplatform/tracing/recorder-win.cc" ]
}
@@ -4652,7 +4673,7 @@ v8_source_set("v8_cppgc_shared") {
"src/heap/cppgc/sanitizers.h",
]
- if (is_clang || !is_win) {
+ if (is_clang || is_mingw || is_linux) {
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") {
} else if (current_cpu == "riscv64") {
sources += [ "src/heap/base/asm/riscv64/push_registers_asm.cc" ]
}
- } else if (is_win) {
+ } else if (is_win && !is_mingw) {
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) {
configs = [ ":internal_config" ]
+ if(is_mingw) {
+ configs += [
+ "//build/config/compiler:strip_debug",
+ ]
+ }
+
deps = [
":v8_base_without_compiler",
":v8_compiler_for_mksnapshot",
@@ -5202,10 +5229,18 @@ if (is_component_build) {
public_deps = [
":v8_base",
+ ":v8_initializers",
":v8_snapshot",
]
- configs = [ ":internal_config" ]
+ configs = [
+ ":internal_config",
+ ]
+ if(is_mingw) {
+ configs += [
+ "//build/config/compiler:strip_debug",
+ ]
+ }
public_configs = [ ":external_config" ]
}
@@ -5225,7 +5260,16 @@ if (is_component_build) {
":v8_snapshot",
]
- configs = [ ":internal_config" ]
+ configs = [
+ ":internal_config",
+ ]
+ if(is_mingw) {
+ configs += [
+ "//build/config/win:export_all_symbols",
+ "//build/config/compiler:strip_debug",
+ ]
+ }
+
public_configs = [ ":external_config" ]
}
diff --git a/include/v8.h b/include/v8.h
index 7cb19bbede..b7b16d004c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -31,6 +31,11 @@
#include "v8-version.h" // NOLINT(build/include_directory)
#include "v8config.h" // NOLINT(build/include_directory)
+#if defined(__MINGW32__) || defined(__MINGW64__)
+// MinGW header files do not implicitly include windows.h
+struct _EXCEPTION_POINTERS;
+#endif
+
// We reserve the V8_* prefix for macros defined in V8 public API and
// assume there are no name conflicts with the embedder's code.
diff --git a/include/v8config.h b/include/v8config.h
index acd34d7a1f..50b2213029 100644
--- a/include/v8config.h
+++ b/include/v8config.h
@@ -129,7 +129,7 @@ path. Add it with -I<path> to the command line
#elif defined(__QNXNTO__)
# define V8_OS_POSIX 1
# define V8_OS_QNX 1
-#elif defined(_WIN32)
+#elif defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__)
# define V8_OS_WIN 1
#endif
@@ -463,7 +463,12 @@ path. Add it with -I<path> to the command line
// V8_NODISCARD Foo() { ... };
// [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
#if V8_HAS_CPP_ATTRIBUTE_NODISCARD
+#if defined(__MINGW32__) || defined(__MINGW64__)
+// Work around MinGW not supporting the __declspec(dllexport) [[nodiscard]] combination
+#define V8_NODISCARD __attribute__((warn_unused_result))
+#else
#define V8_NODISCARD [[nodiscard]]
+#endif
#else
#define V8_NODISCARD /* NOT SUPPORTED */
#endif
diff --git a/src/base/bits.h b/src/base/bits.h
index b137f73936..3bb4ceb7b6 100644
--- a/src/base/bits.h
+++ b/src/base/bits.h
@@ -12,8 +12,10 @@
#include "src/base/macros.h"
#if V8_CC_MSVC
#include <intrin.h>
+#elif defined(__MINGW32__)
+#include <x86intrin.h>
#endif
-#if V8_OS_WIN32
+#if V8_OS_WIN
#include "src/base/win32-headers.h"
#endif
diff --git a/src/base/export-template.h b/src/base/export-template.h
index 861cfe4027..90c41f7097 100644
--- a/src/base/export-template.h
+++ b/src/base/export-template.h
@@ -153,7 +153,12 @@
EXPORT_TEMPLATE_TEST(DEFAULT, );
EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default"))));
+#if defined(__MINGW32__) || defined(__MINGW64__)
+// On MingW MSVC_HACK breaks.
+EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllexport));
+#else
EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
+#endif
EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef EXPORT_TEMPLATE_TEST
diff --git a/src/base/platform/platform-win32.cc b/src/base/platform/platform-win32.cc
index 7f6c0e97d2..a0eedf5511 100644
--- a/src/base/platform/platform-win32.cc
+++ b/src/base/platform/platform-win32.cc
@@ -4,21 +4,14 @@
// Platform-specific code for Win32.
-// Secure API functions are not available using MinGW with msvcrt.dll
-// on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to
-// disable definition of secure API functions in standard headers that
-// would conflict with our own implementation.
-#ifdef __MINGW32__
-#include <_mingw.h>
-#ifdef MINGW_HAS_SECURE_API
-#undef MINGW_HAS_SECURE_API
-#endif // MINGW_HAS_SECURE_API
-#endif // __MINGW32__
-
#include <limits>
#include "src/base/win32-headers.h"
+#if defined(__MINGW32__) || defined(__MINGW64__)
+// REMOVE ONCE mingw functions.h file is fixed
+#undef __deref
+#endif
#include "src/base/bits.h"
#include "src/base/lazy-instance.h"
#include "src/base/macros.h"
@@ -33,71 +26,6 @@
#include <crtdbg.h> // NOLINT
#endif // defined(_MSC_VER)
-// Extra functions for MinGW. Most of these are the _s functions which are in
-// the Microsoft Visual Studio C++ CRT.
-#ifdef __MINGW32__
-
-
-#ifndef __MINGW64_VERSION_MAJOR
-
-#define _TRUNCATE 0
-#define STRUNCATE 80
-
-inline void MemoryFence() {
- int barrier = 0;
- __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier));
-}
-
-#endif // __MINGW64_VERSION_MAJOR
-
-
-int localtime_s(tm* out_tm, const time_t* time) {
- tm* posix_local_time_struct = localtime_r(time, out_tm);
- if (posix_local_time_struct == nullptr) return 1;
- return 0;
-}
-
-
-int fopen_s(FILE** pFile, const char* filename, const char* mode) {
- *pFile = fopen(filename, mode);
- return *pFile != nullptr ? 0 : 1;
-}
-
-int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count,
- const char* format, va_list argptr) {
- DCHECK(count == _TRUNCATE);
- return _vsnprintf(buffer, sizeOfBuffer, format, argptr);
-}
-
-
-int strncpy_s(char* dest, size_t dest_size, const char* source, size_t count) {
- CHECK(source != nullptr);
- CHECK(dest != nullptr);
- CHECK_GT(dest_size, 0);
-
- if (count == _TRUNCATE) {
- while (dest_size > 0 && *source != 0) {
- *(dest++) = *(source++);
- --dest_size;
- }
- if (dest_size == 0) {
- *(dest - 1) = 0;
- return STRUNCATE;
- }
- } else {
- while (dest_size > 0 && count > 0 && *source != 0) {
- *(dest++) = *(source++);
- --dest_size;
- --count;
- }
- }
- CHECK_GT(dest_size, 0);
- *dest = 0;
- return 0;
-}
-
-#endif // __MINGW32__
-
namespace v8 {
namespace base {
diff --git a/src/base/platform/time.cc b/src/base/platform/time.cc
index c399c52cb2..c0f80761eb 100644
--- a/src/base/platform/time.cc
+++ b/src/base/platform/time.cc
@@ -787,13 +787,13 @@ ThreadTicks ThreadTicks::Now() {
#endif
#elif V8_OS_MACOSX
return ThreadTicks(ComputeThreadTicks());
-#elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
- defined(V8_OS_ANDROID)
- return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
#elif V8_OS_SOLARIS
return ThreadTicks(gethrvtime() / Time::kNanosecondsPerMicrosecond);
#elif V8_OS_WIN
return ThreadTicks::GetForThread(::GetCurrentThread());
+#elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
+ defined(V8_OS_ANDROID)
+ return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
#else
UNREACHABLE();
#endif
diff --git a/src/base/win32-headers.h b/src/base/win32-headers.h
index 82555463c0..08c67bc13a 100644
--- a/src/base/win32-headers.h
+++ b/src/base/win32-headers.h
@@ -38,17 +38,9 @@
#include <mmsystem.h> // For timeGetTime().
#include <signal.h> // For raise().
#include <time.h> // For LocalOffset() implementation.
-#ifdef __MINGW32__
-// Require Windows XP or higher when compiling with MinGW. This is for MinGW
-// header files to expose getaddrinfo.
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x501
-#endif // __MINGW32__
-#if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <dbghelp.h> // For SymLoadModule64 and al.
#include <errno.h> // For STRUNCATE
#include <versionhelpers.h> // For IsWindows8OrGreater().
-#endif // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <limits.h> // For INT_MAX and al.
#include <tlhelp32.h> // For Module32First and al.
@@ -56,9 +48,7 @@
// makes it impossible to have them elsewhere.
#include <winsock2.h>
#include <ws2tcpip.h>
-#ifndef __MINGW32__
#include <wspiapi.h>
-#endif // __MINGW32__
#include <process.h> // For _beginthreadex().
#include <stdlib.h>
@@ -80,5 +70,5 @@
#undef RotateLeft32
#undef RotateRight64
#undef RotateLeft64
-
+#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
--- 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 };
// 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).
-class V8_EXPORT_PRIVATE CodeStubAssembler
+class V8_EXPORT CodeStubAssembler
: public compiler::CodeAssembler,
public TorqueGeneratedExportedMacrosAssembler {
public:
diff --git a/src/codegen/handler-table.cc b/src/codegen/handler-table.cc
index 8aec047d13..12e25a2631 100644
--- a/src/codegen/handler-table.cc
+++ b/src/codegen/handler-table.cc
@@ -219,6 +219,12 @@ int HandlerTable::LookupReturn(int pc_offset) {
difference_type operator-(const Iterator& other) const {
return index - other.index;
}
+#ifdef _GLIBCXX_DEBUG
+ bool operator<=(const Iterator& other) const
+ {
+ return index <= other.index;
+ }
+#endif
HandlerTable* table;
int index;
};
diff --git a/src/common/assert-scope.h b/src/common/assert-scope.h
index 114b4782c9..92acf77aa4 100644
--- a/src/common/assert-scope.h
+++ b/src/common/assert-scope.h
@@ -84,7 +84,7 @@ class CombinationAssertScope;
template <typename Scope>
class V8_NODISCARD CombinationAssertScope<Scope> : public Scope {
public:
- V8_EXPORT_PRIVATE static bool IsAllowed() {
+ static bool IsAllowed() {
// Define IsAllowed() explicitly rather than with using Scope::IsAllowed, to
// allow SFINAE removal of IsAllowed() when it's not defined (under debug).
return Scope::IsAllowed();
@@ -101,12 +101,12 @@ class CombinationAssertScope<Scope, Scopes...>
public:
// Constructor for per-thread scopes.
- V8_EXPORT_PRIVATE CombinationAssertScope() : Scope(), NextScopes() {}
+ CombinationAssertScope() : Scope(), NextScopes() {}
// Constructor for per-isolate scopes.
- V8_EXPORT_PRIVATE explicit CombinationAssertScope(Isolate* isolate)
+ explicit CombinationAssertScope(Isolate* isolate)
: Scope(isolate), NextScopes(isolate) {}
- V8_EXPORT_PRIVATE static bool IsAllowed() {
+ static bool IsAllowed() {
return Scope::IsAllowed() && NextScopes::IsAllowed();
}
diff --git a/src/common/globals.h b/src/common/globals.h
index d9d502aa51..ea7e54e21d 100644
--- a/src/common/globals.h
+++ b/src/common/globals.h
@@ -1348,7 +1348,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 {
- enum {
+ enum : uint32_t {
kSignedSmallFlag = 1 << 0,
kOtherNumberFlag = 1 << 1,
kBooleanFlag = 1 << 2,
@@ -1362,7 +1362,7 @@ class CompareOperationFeedback {
};
public:
- enum Type {
+ enum Type : uint32_t {
kNone = 0,
kBoolean = kBooleanFlag,
@@ -1375,7 +1375,7 @@ class CompareOperationFeedback {
kNumberOrOddball = kNumber | kOddball,
kInternalizedString = kInternalizedStringFlag,
- kString = kInternalizedString | kOtherStringFlag,
+ kString = kInternalizedString | kOtherNumberFlag,
kReceiver = kReceiverFlag,
kReceiverOrNullOrUndefined = kReceiver | kNullOrUndefined,
diff --git a/src/compiler/node-cache.h b/src/compiler/node-cache.h
index 8e1d3d4eae..c55d8329de 100644
--- a/src/compiler/node-cache.h
+++ b/src/compiler/node-cache.h
@@ -29,7 +29,7 @@ class Node;
// nodes such as constants, parameters, etc.
template <typename Key, typename Hash = base::hash<Key>,
typename Pred = std::equal_to<Key> >
-class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) NodeCache final {
+class V8_EXPORT_PRIVATE NodeCache final {
public:
explicit NodeCache(Zone* zone) : map_(zone) {}
~NodeCache() = default;
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
+++ b/src/heap/paged-spaces-inl.h
@@ -19,7 +19,7 @@ namespace internal {
// -----------------------------------------------------------------------------
// PagedSpaceObjectIterator
-HeapObject PagedSpaceObjectIterator::Next() {
+inline HeapObject PagedSpaceObjectIterator::Next() {
do {
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
--- a/src/heap/paged-spaces.h
+++ b/src/heap/paged-spaces.h
@@ -45,7 +45,7 @@ class V8_EXPORT_PRIVATE PagedSpaceObjectIterator : public ObjectIterator {
// Advance to the next object, skipping free spaces and other fillers and
// skipping the special garbage section of which there is one per space.
// Returns nullptr when the iteration has ended.
- inline HeapObject Next() override;
+ HeapObject Next() override;
private:
// Fast (inlined) path of next().
diff --git a/src/objects/feedback-vector.cc b/src/objects/feedback-vector.cc
index a77ea5d265..0cddb92a02 100644
--- a/src/objects/feedback-vector.cc
+++ b/src/objects/feedback-vector.cc
@@ -114,9 +114,9 @@ Handle<FeedbackMetadata> FeedbackMetadata::New(LocalIsolate* isolate,
return metadata;
}
-template Handle<FeedbackMetadata> FeedbackMetadata::New(
+template V8_EXPORT Handle<FeedbackMetadata> FeedbackMetadata::New(
Isolate* isolate, const FeedbackVectorSpec* spec);
-template Handle<FeedbackMetadata> FeedbackMetadata::New(
+template V8_EXPORT Handle<FeedbackMetadata> FeedbackMetadata::New(
LocalIsolate* isolate, const FeedbackVectorSpec* spec);
bool FeedbackMetadata::SpecDiffersFrom(
diff --git a/src/objects/fixed-array-inl.h b/src/objects/fixed-array-inl.h
index a91f89784f..5ecf7e3372 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) {
return get(isolate, index).IsTheHole(isolate);
}
-void FixedArray::set(int index, Smi value) {
+inline V8_EXPORT_PRIVATE void FixedArray::set(int index, Smi value) {
DCHECK_NE(map(), GetReadOnlyRoots().fixed_cow_array_map());
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
--- a/src/objects/fixed-array.h
+++ b/src/objects/fixed-array.h
@@ -130,7 +130,7 @@ class FixedArray
inline bool is_the_hole(Isolate* isolate, int index);
// Setter that doesn't need write barrier.
- inline void set(int index, Smi value);
+ inline V8_EXPORT_PRIVATE void set(int index, Smi value);
// Setter with explicit barrier mode.
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
--- a/src/objects/ordered-hash-table.h
+++ b/src/objects/ordered-hash-table.h
@@ -7,8 +7,12 @@
#include "src/base/export-template.h"
#include "src/common/globals.h"
+#if defined(_M_IX86) && defined(_MSC_VER)
+#include "src/objects/fixed-array-inl.h"
+#else
#include "src/objects/fixed-array.h"
#include "src/objects/internal-index.h"
+#endif
#include "src/objects/js-objects.h"
#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
--- 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)
STATIC_ASSERT(kSystemPointerSize != 4 || sizeof(HeapGraphEdge) == 12);
STATIC_ASSERT(kSystemPointerSize != 8 || sizeof(HeapGraphEdge) == 24);
STATIC_ASSERT(kSystemPointerSize != 4 || sizeof(HeapEntry) == 32);
-#if V8_CC_MSVC
+#if V8_CC_MSVC || defined(__MINGW32__) || defined(__MINGW64__)
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
+++ b/src/snapshot/snapshot-utils.cc
@@ -5,7 +5,7 @@
#include "src/snapshot/snapshot-utils.h"
#include "src/sanitizer/msan.h"
-#include "third_party/zlib/zlib.h"
+#include "zlib.h"
namespace v8 {
namespace internal {
diff --git a/src/trap-handler/handler-inside-win.cc b/src/trap-handler/handler-inside-win.cc
index e5ce133a6b..110efe78de 100644
--- a/src/trap-handler/handler-inside-win.cc
+++ b/src/trap-handler/handler-inside-win.cc
@@ -25,7 +25,7 @@
#include "src/trap-handler/handler-inside-win.h"
-#include <windows.h>
+#include "src/base/win32-headers.h"
#include "src/trap-handler/trap-handler-internal.h"
#include "src/trap-handler/trap-handler.h"
diff --git a/src/trap-handler/handler-inside-win.h b/src/trap-handler/handler-inside-win.h
index 6db28149e7..6d0219c79f 100644
--- a/src/trap-handler/handler-inside-win.h
+++ b/src/trap-handler/handler-inside-win.h
@@ -5,7 +5,7 @@
#ifndef V8_TRAP_HANDLER_HANDLER_INSIDE_WIN_H_
#define V8_TRAP_HANDLER_HANDLER_INSIDE_WIN_H_
-#include <windows.h>
+#include "src/base/win32-headers.h"
#include "src/base/macros.h"
diff --git a/src/trap-handler/handler-outside-win.cc b/src/trap-handler/handler-outside-win.cc
index 09673c8ccc..2d221a802d 100644
--- a/src/trap-handler/handler-outside-win.cc
+++ b/src/trap-handler/handler-outside-win.cc
@@ -19,7 +19,7 @@
//
// For the code that runs in the trap handler itself, see handler-inside.cc.
-#include <windows.h>
+#include "src/base/win32-headers.h"
#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
--- a/src/wasm/function-body-decoder-impl.h
+++ b/src/wasm/function-body-decoder-impl.h
@@ -2006,7 +2006,7 @@ class WasmDecoder : public Decoder {
}
// TODO(clemensb): This is only used by the interpreter; move there.
- V8_EXPORT_PRIVATE std::pair<uint32_t, uint32_t> StackEffect(const byte* pc) {
+ std::pair<uint32_t, uint32_t> StackEffect(const byte* pc) {
WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
// Handle "simple" opcodes with a fixed signature first.
const FunctionSig* sig = WasmOpcodes::Signature(opcode);
diff --git a/test/cctest/BUILD.gn b/test/cctest/BUILD.gn
index e63fe5ed35..2f39d3efb0 100644
--- a/test/cctest/BUILD.gn
+++ b/test/cctest/BUILD.gn
@@ -35,6 +35,12 @@ v8_executable("cctest") {
"../..:v8_tracing_config",
":cctest_config",
]
+ if(is_mingw) {
+ configs += [
+ "//build/config/compiler:strip_debug",
+ ]
+ }
+
ldflags = []
@@ -475,17 +481,28 @@ v8_source_set("cctest_sources") {
}
if (is_win) {
- # This warning is benignly triggered by the U16 and U32 macros in
- # bytecode-utils.h.
- # C4309: 'static_cast': truncation of constant value
- cflags += [ "/wd4309" ]
-
- # MSVS wants this for gay-{precision,shortest}.cc.
- cflags += [ "/bigobj" ]
-
- if (symbol_level == 2) {
- sources += [ "test-v8windbg.cc" ]
- deps += [ "../../tools/v8windbg:v8windbg_test" ]
+ if(is_mingw) {
+ # Buffer overrun warning... intended?
+ cflags += [
+ "-Wno-array-bounds",
+ "-Wno-stringop-truncation"
+ ]
+ } else {
+ # This warning is benignly triggered by the U16 and U32 macros in
+ # bytecode-utils.h.
+ # C4309: 'static_cast': truncation of constant value
+ cflags += [ "/wd4309" ]
+
+ # Buffer overrun warning... intended?
+ cflags += [ "/wd4789" ]
+
+ # MSVS wants this for gay-{precision,shortest}.cc.
+ cflags += [ "/bigobj" ]
+
+ if (symbol_level == 2) {
+ sources += [ "test-v8windbg.cc" ]
+ deps += [ "../../tools/v8windbg:v8windbg_test" ]
+ }
}
}
diff --git a/test/unittests/BUILD.gn b/test/unittests/BUILD.gn
index 1940dfa77e..b7869e1dbd 100644
--- a/test/unittests/BUILD.gn
+++ b/test/unittests/BUILD.gn
@@ -186,6 +186,12 @@ v8_executable("unittests") {
"../..:external_config",
"../..:internal_config_base",
]
+
+ if(is_mingw) {
+ configs += [
+ "//build/config/compiler:strip_debug",
+ ]
+ }
}
v8_source_set("unittests_sources") {
@@ -492,10 +498,12 @@ v8_source_set("unittests_sources") {
"//testing/gtest",
]
- if (is_win) {
+ if (is_win && !is_mingw) {
# This warning is benignly triggered by the U16 and U32 macros in
# bytecode-utils.h.
# C4309: 'static_cast': truncation of constant value
cflags = [ "/wd4309" ]
+ } else if (is_mingw) {
+ cflags = [ "-Wno-pessimizing-move" ]
}
}
diff --git a/test/unittests/wasm/trap-handler-win-unittest.cc b/test/unittests/wasm/trap-handler-win-unittest.cc
index 8ad753469e..193119b4f6 100644
--- a/test/unittests/wasm/trap-handler-win-unittest.cc
+++ b/test/unittests/wasm/trap-handler-win-unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <windows.h>
+#include "src/base/win32-headers.h"
#include "include/v8.h"
#include "src/base/page-allocator.h"
diff --git a/test/unittests/wasm/trap-handler-x64-unittest.cc b/test/unittests/wasm/trap-handler-x64-unittest.cc
index 1d8efdae75..214ea11ee6 100644
--- a/test/unittests/wasm/trap-handler-x64-unittest.cc
+++ b/test/unittests/wasm/trap-handler-x64-unittest.cc
@@ -11,7 +11,7 @@
#include <signal.h>
#include <sys/ucontext.h>
#elif V8_OS_WIN
-#include <windows.h>
+#include "src/base/win32-headers.h"
#endif
#include "testing/gtest/include/gtest/gtest.h"
@@ -246,7 +246,7 @@ class TrapHandlerTest : public TestWithIsolate,
.Call();
EXPECT_TRUE(g_test_handler_executed);
g_test_handler_executed = false;
- if (check_wasm_flag) EXPECT_FALSE(GetThreadInWasmFlag());
+ if (check_wasm_flag) {EXPECT_FALSE(GetThreadInWasmFlag());}
}
bool test_handler_executed() { return g_test_handler_executed; }
diff --git a/third_party/googletest/BUILD.gn b/third_party/googletest/BUILD.gn
index cfa9205547..f3b0051f61 100644
--- a/third_party/googletest/BUILD.gn
+++ b/third_party/googletest/BUILD.gn
@@ -30,7 +30,7 @@ config("gtest_config") {
"src/googletest/include",
]
- if (is_win) {
+ if (is_win && !is_mingw) {
cflags = [ "/wd4800" ] # Unused variable warning.
}
}
diff --git a/tools/BUILD.gn b/tools/BUILD.gn
index 2f8197dd36..9b1e4fabb9 100644
--- a/tools/BUILD.gn
+++ b/tools/BUILD.gn
@@ -15,7 +15,8 @@ group("gn_all") {
"jsfunfuzz:v8_jsfunfuzz",
]
- if (is_win) {
+ # MinGW does not support DbgModel yet
+ if (is_win && !is_mingw) {
data_deps += [ "v8windbg" ]
}
}
diff --git a/tools/debug_helper/BUILD.gn b/tools/debug_helper/BUILD.gn
index 54cd3b7a4c..9c6666871d 100644
--- a/tools/debug_helper/BUILD.gn
+++ b/tools/debug_helper/BUILD.gn
@@ -99,10 +99,12 @@ v8_component("v8_debug_helper") {
"../..:v8_libbase",
"../..:v8_shared_internal_headers",
"../..:v8_tracing",
+ "../..:v8",
]
configs = [ ":internal_config" ]
if (v8_enable_i18n_support) {
+ public_deps = [ "//third_party/icu" ]
configs += [ "//third_party/icu:icu_config" ]
}
diff --git a/tools/v8windbg/BUILD.gn b/tools/v8windbg/BUILD.gn
index 10d06a127f..49654be32c 100644
--- a/tools/v8windbg/BUILD.gn
+++ b/tools/v8windbg/BUILD.gn
@@ -6,7 +6,9 @@ import("../../gni/v8.gni")
config("v8windbg_config") {
# Required for successful compilation of SDK header file DbgModel.h.
- cflags_cc = [ "/Zc:twoPhase-" ]
+ if(!is_mingw){
+ cflags_cc = [ "/Zc:twoPhase-", "/std:c++latest" ]
+ }
include_dirs = [ "../.." ]
}
diff --git a/tools/v8windbg/base/dbgext.h b/tools/v8windbg/base/dbgext.h
index 8b36a8f361..f8d9f0d64e 100644
--- a/tools/v8windbg/base/dbgext.h
+++ b/tools/v8windbg/base/dbgext.h
@@ -9,6 +9,7 @@
#error Unicode not defined
#endif
+#include <new>
#include <DbgEng.h>
#include <DbgModel.h>
#include <Windows.h>
diff --git a/tools/v8windbg/src/v8-debug-helper-interop.h b/tools/v8windbg/src/v8-debug-helper-interop.h
index f7d78c5dd3..1c70e54e7a 100644
--- a/tools/v8windbg/src/v8-debug-helper-interop.h
+++ b/tools/v8windbg/src/v8-debug-helper-interop.h
@@ -5,10 +5,11 @@
#ifndef V8_TOOLS_V8WINDBG_SRC_V8_DEBUG_HELPER_INTEROP_H_
#define V8_TOOLS_V8WINDBG_SRC_V8_DEBUG_HELPER_INTEROP_H_
-#include <wrl/client.h>
-
+#include <new>
+#include <DbgEng.h>
#include <DbgModel.h>
+#include <wrl/client.h>
#include <cstdint>
#include <map>
#include <string>
diff --git a/tools/v8windbg/test/debug-callbacks.h b/tools/v8windbg/test/debug-callbacks.h
index 8855d6ffbc..ed2b0f62e9 100644
--- a/tools/v8windbg/test/debug-callbacks.h
+++ b/tools/v8windbg/test/debug-callbacks.h
@@ -9,6 +9,7 @@
#error Unicode not defined
#endif
+#include <new>
#include <DbgEng.h>
#include <DbgModel.h>
#include <Windows.h>