Source: mozjs60 Version: 60.2.3-3 Severity: normal Tags: patch upstream User: debian-ri...@lists.debian.org Usertags: riscv64
Hi, mozjs60 currently fails to build on the riscv64 architecture as it can be seen on the following build log excerpt: | Reexecuting in the virtualenv | checking for vcs source checkout... no | checking for a shell... /bin/sh | checking for host system type... | ERROR: Unknown CPU type: riscv64 | make[1]: *** [debian/rules:99: override_dh_auto_configure] Error 1 | make[1]: Leaving directory '/<<PKGBUILDDIR>>' | make: *** [debian/rules:68: binary-arch] Error 2 | dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2 The full build log is available there: https://buildd.debian.org/status/fetch.php?pkg=mozjs60&arch=riscv64&ver=60.2.3-3&stamp=1555195397&raw=0 The attached patch adds the missing support for riscv64. It would be nice if you can include it in the next upload. Thanks, Aurelien
diff -Nru mozjs60-60.2.3/debian/patches/riscv64-support.patch mozjs60-60.2.3/debian/patches/riscv64-support.patch --- mozjs60-60.2.3/debian/patches/riscv64-support.patch 1970-01-01 01:00:00.000000000 +0100 +++ mozjs60-60.2.3/debian/patches/riscv64-support.patch 2019-07-23 23:42:00.000000000 +0200 @@ -0,0 +1,75 @@ +--- a/build/moz.configure/init.configure ++++ b/build/moz.configure/init.configure +@@ -676,6 +676,9 @@ + elif cpu == 'sh4': + canonical_cpu = 'sh4' + endianness = 'little' ++ elif cpu.startswith('riscv64'): ++ canonical_cpu = 'riscv64' ++ endianness = 'little' + elif allow_unknown: + canonical_cpu = cpu + endianness = 'unknown' +--- a/mfbt/tests/TestPoisonArea.cpp ++++ b/mfbt/tests/TestPoisonArea.cpp +@@ -160,6 +160,14 @@ + #elif defined __aarch64__ + #define RETURN_INSTR 0xd65f03c0 /* ret */ + ++#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 ++#if defined(__riscv_compressed) ++#define RETURN_INSTR 0x8082 /* ret */ ++#define RETURN_INSTR_TYPE uint16_t ++#else ++#define RETURN_INSTR 0x00008067 /* ret */ ++#endif ++ + #elif defined __ia64 + struct ia64_instr { uint32_t mI[4]; }; + static const ia64_instr _return_instr = +--- a/python/mozbuild/mozbuild/configure/constants.py ++++ b/python/mozbuild/mozbuild/configure/constants.py +@@ -50,6 +50,7 @@ + 'mips64': 64, + 'ppc': 32, + 'ppc64': 64, ++ 'riscv64': 64, + 's390': 32, + 's390x': 64, + 'sh4': 32, +@@ -89,6 +90,7 @@ + ('mips64', '__mips64'), + ('mips32', '__mips__'), + ('sh4', '__sh__'), ++ ('riscv64', 'defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64'), + )) + + assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES) +--- a/js/src/jit/AtomicOperations.h ++++ b/js/src/jit/AtomicOperations.h +@@ -387,6 +387,8 @@ + # include "jit/none/AtomicOperations-feeling-lucky.h" + #elif defined(__s390__) || defined(__s390x__) + # include "jit/none/AtomicOperations-feeling-lucky.h" ++#elif defined(__riscv) ++# include "jit/none/AtomicOperations-feeling-lucky.h" + #else + # error "No AtomicOperations support provided for this platform" + #endif +--- a/js/src/jit/none/AtomicOperations-feeling-lucky.h ++++ b/js/src/jit/none/AtomicOperations-feeling-lucky.h +@@ -79,6 +79,14 @@ + # define GNUC_COMPATIBLE + #endif + ++#ifdef __riscv ++# define GNUC_COMPATIBLE ++# ifdef __riscv_xlen == 64 ++# define HAS_64BIT_ATOMICS ++# define HAS_64BIT_LOCKFREE ++# endif ++#endif ++ + // The default implementation tactic for gcc/clang is to use the newer + // __atomic intrinsics added for use in C++11 <atomic>. Where that + // isn't available, we use GCC's older __sync functions instead. diff -Nru mozjs60-60.2.3/debian/patches/series mozjs60-60.2.3/debian/patches/series --- mozjs60-60.2.3/debian/patches/series 2019-04-13 20:40:04.000000000 +0200 +++ mozjs60-60.2.3/debian/patches/series 2019-07-23 23:42:00.000000000 +0200 @@ -22,3 +22,4 @@ enddianness.patch jsproperty-endian.patch tests-Skip-a-test-on-s390x.patch +riscv64-support.patch