Add support for RISC-V (riscv64)

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
David Abdurachmanov 2018-06-22 09:54:35 +02:00
parent d7a8119db0
commit fec684f07b
Signed by: davidlt
GPG Key ID: 7108702C938B13C1
2 changed files with 127 additions and 3 deletions

View File

@ -15,7 +15,7 @@
Name: qt5-%{qt_module} Name: qt5-%{qt_module}
Version: 5.212.0 Version: 5.212.0
Release: 0.23.%{?prerel}%{?dist} Release: 0.23.%{?prerel}.0.riscv64%{?dist}
Summary: Qt5 - QtWebKit components Summary: Qt5 - QtWebKit components
License: LGPLv2 and BSD License: LGPLv2 and BSD
@ -37,6 +37,9 @@ Patch2: qtwebkit-5.212.0_cmake_cmp0071.patch
# Patch to fix for missing source file. # Patch to fix for missing source file.
Patch3: qtwebkit-5.212.0_fix_missing_sources.patch Patch3: qtwebkit-5.212.0_fix_missing_sources.patch
# Enable RISC-V (riscv64)
Patch4: qtwebkit-5.212.0-alpha2-add-riscv.patch
# disable ES6 Proxy # disable ES6 Proxy
Patch31: 0031-Disable-ES6-Proxy-object.patch Patch31: 0031-Disable-ES6-Proxy-object.patch
@ -130,7 +133,7 @@ BuildArch: noarch
# Decrease debuginfo even on ix86 because of: # Decrease debuginfo even on ix86 because of:
# https://bugs.webkit.org/show_bug.cgi?id=140176 # https://bugs.webkit.org/show_bug.cgi?id=140176
%ifarch s390 s390x %{arm} %{ix86} ppc %{power64} %{mips} %ifarch s390 s390x %{arm} %{ix86} ppc %{power64} %{mips} riscv64
# Decrease debuginfo verbosity to reduce memory consumption even more # Decrease debuginfo verbosity to reduce memory consumption even more
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif %endif
@ -143,6 +146,11 @@ BuildArch: noarch
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags} -fpermissive" ; export CXXFLAGS ; CXXFLAGS="${CXXFLAGS:-%optflags} -fpermissive" ; export CXXFLAGS ;
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;}
%ifarch riscv64
export LDFLAGS="${LDFLAGS} -latomic"
%endif
# We cannot use default cmake macro here as it overwrites some settings queried # We cannot use default cmake macro here as it overwrites some settings queried
# by qtwebkit cmake from qmake # by qtwebkit cmake from qmake
cmake -DPORT=Qt \ cmake -DPORT=Qt \
@ -151,7 +159,7 @@ cmake -DPORT=Qt \
-DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \ -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
%ifarch s390 s390x ppc %{power64} %ifarch s390 s390x ppc %{power64} riscv64
-DENABLE_JIT=OFF \ -DENABLE_JIT=OFF \
%endif %endif
%ifarch s390 s390x ppc %{power64} %ifarch s390 s390x ppc %{power64}
@ -232,6 +240,9 @@ sed -i "s,Libs: -L%{_qt5_libdir}/qt5/../ -lQt5WebKitWidgets,Libs: -L%{_qt5_libdi
%changelog %changelog
* Fri Jun 22 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> - 5.212.0-0.23.alpha2.0.riscv64
- add support for RISC-V (riscv64)
* Wed Jun 20 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.212.0-0.23.alpha2 * Wed Jun 20 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.212.0-0.23.alpha2
- rebuild (qt5) - rebuild (qt5)

View File

@ -0,0 +1,113 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f9bab8..d5aa2ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,6 +86,8 @@ elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
set(WTF_CPU_S390 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
set(WTF_CPU_S390X 1)
+elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
+ set(WTF_CPU_RISCV64 1)
else ()
message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
endif ()
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index 1957446..96255d6 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -1289,6 +1289,7 @@ elseif (WTF_CPU_MIPS)
elseif (WTF_CPU_SH4)
elseif (WTF_CPU_X86)
elseif (WTF_CPU_X86_64)
+elseif (WTF_CPU_RISCV64)
if (MSVC AND ENABLE_JIT)
add_custom_command(
OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
diff --git a/Source/ThirdParty/brotli/dec/port.h b/Source/ThirdParty/brotli/dec/port.h
index 19b457c..be1b2ad 100644
--- a/Source/ThirdParty/brotli/dec/port.h
+++ b/Source/ThirdParty/brotli/dec/port.h
@@ -66,6 +66,10 @@
#define BROTLI_TARGET_POWERPC64
#endif
+#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+#define BROTLI_TARGET_RISCV64
+#endif
+
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define BROTLI_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#else
@@ -180,7 +184,7 @@ static inline void BrotliDump(const char* f, int l, const char* fn) {
#elif defined(BROTLI_BUILD_32_BIT)
#define BROTLI_64_BITS 0
#elif defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8) || \
- defined(BROTLI_TARGET_POWERPC64)
+ defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64)
#define BROTLI_64_BITS 1
#else
#define BROTLI_64_BITS 0
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index 3f2069e..d4e02a8 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -176,6 +176,11 @@
#define WTF_CPU_X86_SSE2 1
#endif
+/* CPU(RISCV64) - RISCV64 */
+#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+#define WTF_CPU_RISCV64 1
+#endif
+
/* CPU(ARM64) - Apple */
#if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__)
#define WTF_CPU_ARM64 1
@@ -712,7 +717,8 @@
|| CPU(S390X) \
|| CPU(MIPS64) \
|| CPU(PPC64) \
- || CPU(PPC64LE)
+ || CPU(PPC64LE) \
+ || CPU(RISCV64)
#define USE_JSVALUE64 1
#else
#define USE_JSVALUE32_64 1
diff --git a/Source/WTF/wtf/dtoa/utils.h b/Source/WTF/wtf/dtoa/utils.h
index 889642c..176d590 100644
--- a/Source/WTF/wtf/dtoa/utils.h
+++ b/Source/WTF/wtf/dtoa/utils.h
@@ -49,7 +49,7 @@
defined(__ARMEL__) || \
defined(_MIPS_ARCH_MIPS32R2)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA)
+#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA) || CPU(RISCV64)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__)
#if defined(_WIN32)
diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm
index 84b18c7..b64d9d1 100755
--- a/Tools/Scripts/webkitdirs.pm
+++ b/Tools/Scripts/webkitdirs.pm
@@ -1264,6 +1264,11 @@ sub isARM()
return ($Config{archname} =~ /^arm[v\-]/) || ($Config{archname} =~ /^aarch64[v\-]/);
}
+sub isRISCV()
+{
+ return ($Config{archname} =~ /^riscv(|32|64)\-/);
+}
+
sub isX86_64()
{
return (architecture() eq "x86_64") || 0;
@@ -2064,7 +2069,7 @@ sub generateBuildSystemFromCMakeProject
# Compiler options to keep floating point values consistent
# between 32-bit and 64-bit architectures.
determineArchitecture();
- if ($architecture ne "x86_64" && !isARM() && !isCrossCompilation() && !isAnyWindows()) {
+ if ($architecture ne "x86_64" && !isARM() && !isRISCV && !isCrossCompilation() && !isAnyWindows()) {
$ENV{'CXXFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . ($ENV{'CXXFLAGS'} || "");
}