Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support using clang in mingw64 environment on Windows #4

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
set(WTF_CPU_S390X 1)
else ()
message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
# message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
set(WTF_CPU_X86_64 1)
endif ()

# -----------------------------------------------------------------------------
Expand Down
16 changes: 14 additions & 2 deletions Source/JavaScriptCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,19 @@ list(APPEND JavaScriptCore_HEADERS
)

if (WIN32)
set(OFFLINE_ASM_BACKEND "X86_WIN, X86_64_WIN, C_LOOP_WIN")
if (MSVC)
if (ENABLE_C_LOOP)
set(OFFLINE_ASM_BACKEND "X86_64_WIN, C_LOOP_WIN")
else ()
set(OFFLINE_ASM_BACKEND "X86_64_WIN")
endif ()
else ()
if (ENABLE_C_LOOP)
set(OFFLINE_ASM_BACKEND "X86_64, C_LOOP")
else ()
set(OFFLINE_ASM_BACKEND "X86_64")
endif ()
endif ()
else ()
if (WTF_CPU_X86)
set(OFFLINE_ASM_BACKEND "X86")
Expand Down Expand Up @@ -1349,7 +1361,7 @@ if (USE_VERSION_STAMPER)
VERBATIM)
endif ()

if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND !WIN32)
Tyler-IN marked this conversation as resolved.
Show resolved Hide resolved
set_target_properties(JavaScriptCore PROPERTIES
INTERPROCEDURAL_OPTIMIZATION 0
LINK_FLAGS "-Wl,-dead_strip"
Expand Down
4 changes: 3 additions & 1 deletion Source/JavaScriptCore/assembler/AssemblerBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once
Expand Down Expand Up @@ -253,8 +253,10 @@ namespace JSC {

~LocalWriter()
{
#if !defined(NDEBUG)
ASSERT(m_index - m_initialIndex <= m_requiredSpace);
ASSERT(m_buffer.m_index == m_initialIndex);
#endif
ASSERT(m_storageBuffer == m_buffer.m_storage.buffer());
m_buffer.m_index = m_index;
}
Expand Down
10 changes: 5 additions & 5 deletions Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"
Expand All @@ -31,7 +31,7 @@
#include "ProbeContext.h"
#include <wtf/InlineASM.h>

#if COMPILER(MSVC)
#if OS(WINDOWS) //COMPILER(MSVC)
#include <intrin.h>
#endif

Expand Down Expand Up @@ -340,7 +340,7 @@ asm (
);
#endif

#if COMPILER(MSVC)
#if COMPILER(MSVC) && !defined(__GNUC__)
extern "C" __declspec(naked) void ctiMasmProbeTrampoline()
{
__asm {
Expand Down Expand Up @@ -745,7 +745,7 @@ asm (
//
// Specifically, the saved stack pointer register will point to the stack
// position before we push the Probe::State frame. The saved rip will point to
// the address of the instruction immediately following the probe.
// the address of the instruction immediately following the probe.

void MacroAssembler::probe(Probe::Function function, void* arg)
{
Expand All @@ -769,7 +769,7 @@ MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUID(unsigned level)
MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUIDEx(unsigned level, unsigned count)
{
CPUID result { };
#if COMPILER(MSVC)
#if OS(WINDOWS) //COMPILER(MSVC)
__cpuidex(bitwise_cast<int*>(result.data()), level, count);
#else
__asm__ (
Expand Down
Loading