diff --git a/SOURCES/0001-Bump-soname-for-API-ABI-change-due-to-aarch64-portin.patch b/SOURCES/0001-Bump-soname-for-API-ABI-change-due-to-aarch64-portin.patch deleted file mode 100644 index feabf46..0000000 --- a/SOURCES/0001-Bump-soname-for-API-ABI-change-due-to-aarch64-portin.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5a001f30574a6265dbf9b480cd0189169f1b121f Mon Sep 17 00:00:00 2001 -From: Colin Walters -Date: Fri, 27 May 2016 16:14:35 -0400 -Subject: [PATCH] Bump soname for API/ABI change due to aarch64 porting - ---- - js/src/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/js/src/Makefile.in b/js/src/Makefile.in -index 9c58960..1edf9b5 100644 ---- a/js/src/Makefile.in -+++ b/js/src/Makefile.in -@@ -35,7 +35,7 @@ TEST_DIRS += tests - - ifdef JS_STANDALONE - MODULE = js-@MOZJS_MAJOR_VERSION@.@MOZJS_MINOR_VERSION@@MOZJS_ALPHA@ --LIBRARY_NAME = mozjs-@MOZJS_MAJOR_VERSION@.@MOZJS_MINOR_VERSION@@MOZJS_ALPHA@ -+LIBRARY_NAME = mozjs-@MOZJS_MAJOR_VERSION@.@MOZJS_MINOR_VERSION@@MOZJS_ALPHA@.1 - else - LIBRARY_NAME = mozjs - MODULE = js --- -1.8.3.1 - diff --git a/SOURCES/mozjs17-48-bit-VA-fix.patch b/SOURCES/mozjs17-48-bit-VA-fix.patch new file mode 100644 index 0000000..8258a46 --- /dev/null +++ b/SOURCES/mozjs17-48-bit-VA-fix.patch @@ -0,0 +1,106 @@ +From a0c0f32299419359b44ac0f880c1ea9073ae51e1 Mon Sep 17 00:00:00 2001 +From: Zheng Xu +Date: Fri, 02 Sep 2016 17:40:05 +0800 +Subject: [PATCH] Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits are clear. r=ehoogeveen + +There might be 48-bit VA on arm64 depending on kernel configuration. +Manually mmap heap memory to align with the assumption made by JS engine. + +Change-Id: Ic5d2b2fe4b758b3c87cc0688348af7e71a991146 +--- + +diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp +index 5b386a2..38101cf 100644 +--- a/js/src/gc/Memory.cpp ++++ b/js/src/gc/Memory.cpp +@@ -309,6 +309,75 @@ + #endif + } + ++static inline void * ++MapMemory(size_t length, int prot, int flags, int fd, off_t offset) ++{ ++#if defined(__ia64__) ++ /* ++ * The JS engine assumes that all allocated pointers have their high 17 bits clear, ++ * which ia64's mmap doesn't support directly. However, we can emulate it by passing ++ * mmap an "addr" parameter with those bits clear. The mmap will return that address, ++ * or the nearest available memory above that address, providing a near-guarantee ++ * that those bits are clear. If they are not, we return NULL below to indicate ++ * out-of-memory. ++ * ++ * The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual ++ * address space. ++ * ++ * See Bug 589735 for more information. ++ */ ++ void *region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset); ++ if (region == MAP_FAILED) ++ return MAP_FAILED; ++ /* ++ * If the allocated memory doesn't have its upper 17 bits clear, consider it ++ * as out of memory. ++ */ ++ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) { ++ JS_ALWAYS_TRUE(0 == munmap(region, length)); ++ return MAP_FAILED; ++ } ++ return region; ++#elif defined(__aarch64__) ++ /* ++ * There might be similar virtual address issue on arm64 which depends on ++ * hardware and kernel configurations. But the work around is slightly ++ * different due to the different mmap behavior. ++ * ++ * TODO: Merge with the above code block if this implementation works for ++ * ia64 and sparc64. ++ */ ++ const uintptr_t start = (uintptr_t)(0x0000070000000000UL); ++ const uintptr_t end = (uintptr_t)(0x0000800000000000UL); ++ const uintptr_t step = ChunkSize; ++ /* ++ * Optimization options if there are too many retries in practice: ++ * 1. Examine /proc/self/maps to find an available address. This file is ++ * not always available, however. In addition, even if we examine ++ * /proc/self/maps, we may still need to retry several times due to ++ * racing with other threads. ++ * 2. Use a global/static variable with lock to track the addresses we have ++ * allocated or tried. ++ */ ++ uintptr_t hint; ++ void* region = MAP_FAILED; ++ for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) { ++ region = mmap((void*)hint, length, prot, flags, fd, offset); ++ if (region != MAP_FAILED) { ++ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) { ++ if (munmap(region, length)) { ++ MOZ_ASSERT(errno == ENOMEM); ++ } ++ region = MAP_FAILED; ++ } ++ } ++ } ++ return region == MAP_FAILED ? NULL : region; ++#else ++ return mmap(NULL, length, prot, flags, fd, offset); ++#endif ++} ++ + void * + MapAlignedPages(size_t size, size_t alignment) + { +@@ -322,12 +391,12 @@ + + /* Special case: If we want page alignment, no further work is needed. */ + if (alignment == PageSize) { +- return mmap(NULL, size, prot, flags, -1, 0); ++ return MapMemory(size, prot, flags, -1, 0); + } + + /* Overallocate and unmap the region's edges. */ + size_t reqSize = Min(size + 2 * alignment, 2 * size); +- void *region = mmap(NULL, reqSize, prot, flags, -1, 0); ++ void *region = MapMemory(reqSize, prot, flags, -1, 0); + if (region == MAP_FAILED) + return NULL; + diff --git a/SOURCES/mozjs17-aarch64-48bit-va-limits.patch b/SOURCES/mozjs17-aarch64-48bit-va-limits.patch deleted file mode 100644 index 5431361..0000000 --- a/SOURCES/mozjs17-aarch64-48bit-va-limits.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 6e3895edd5ca6fc875e27b3f1fbc2f9a2a0d42d7 Mon Sep 17 00:00:00 2001 -From: Jon Masters -Date: Mon, 16 May 2016 15:40:24 -0400 -Subject: [[RHEL7.3 TEST PATCH]] mozjs17: support 48-bit VA limits in tagged - pointers on AArch64 - -The 64-bit ARM Architecture (AArch64) provides certain bits of -high order VA (Virtual Address) space for tagged pointers, but -these are limited to above 48 bits. mozjs has can existing -assumption that it can use everything above 47 bits itself. - -This is needed to support a 48-bit VA kernel on RHEL(SA)7. - -The patch is from Zheng Xu - -Signed-off-by: Jon Masters ---- - ...64-support-tagged-pointers-48bit-va-limit.patch | 118 +++++++++++++++++++++ - 1 file changed, 118 insertions(+) - create mode 100644 mozjs17-aarch64-support-tagged-pointers-48bit-va-limit.patch - - -diff -urNp mozjs17.0.0_orig/js/src/jsval.h mozjs17.0.0/js/src/jsval.h ---- mozjs17.0.0_orig/js/src/jsval.h 2016-05-16 15:33:42.400203358 -0400 -+++ mozjs17.0.0/js/src/jsval.h 2016-05-16 15:31:21.350657048 -0400 -@@ -35,7 +35,7 @@ JS_BEGIN_EXTERN_C - #endif - - #if JS_BITS_PER_WORD == 64 --# define JSVAL_TAG_SHIFT 47 -+# define JSVAL_TAG_SHIFT 48 - #endif - - /* -@@ -94,7 +94,8 @@ JS_STATIC_ASSERT(sizeof(JSValueTag) == 4 - /* Remember to propagate changes to the C defines below. */ - JS_ENUM_HEADER(JSValueTag, uint32_t) - { -- JSVAL_TAG_MAX_DOUBLE = 0x1FFF0, -+ JSVAL_TAG_DUMMY = 0xFFFFFFFF, /* Make sure the enums cannot fit 16-bits. */ -+ JSVAL_TAG_MAX_DOUBLE = 0xFFF8, - JSVAL_TAG_INT32 = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32, - JSVAL_TAG_UNDEFINED = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED, - JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING, -@@ -150,7 +151,7 @@ typedef uint32_t JSValueTag; - #elif JS_BITS_PER_WORD == 64 - - typedef uint32_t JSValueTag; --#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0x1FFF0)) -+#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0xFFF8)) - #define JSVAL_TAG_INT32 (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32) - #define JSVAL_TAG_UNDEFINED (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED) - #define JSVAL_TAG_STRING (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING) -@@ -188,8 +189,8 @@ typedef uint64_t JSValueShiftedTag; - - #elif JS_BITS_PER_WORD == 64 - --#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL --#define JSVAL_TAG_MASK 0xFFFF800000000000LL -+#define JSVAL_PAYLOAD_MASK 0x0000FFFFFFFFFFFFLL -+#define JSVAL_TAG_MASK 0xFFFF000000000000LL - #define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type))) - #define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64_t)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT) - -@@ -251,8 +252,8 @@ typedef union jsval_layout - #if (!defined(_WIN64) && defined(__cplusplus)) - /* MSVC does not pack these correctly :-( */ - struct { -- uint64_t payload47 : 47; -- JSValueTag tag : 17; -+ uint64_t payload48 : 48; -+ JSValueTag tag : 16; - } debugView; - #endif - struct { -@@ -295,8 +296,8 @@ typedef union jsval_layout - { - uint64_t asBits; - struct { -- JSValueTag tag : 17; -- uint64_t payload47 : 47; -+ JSValueTag tag : 16; -+ uint64_t payload48 : 48; - } debugView; - struct { - uint32_t padding; -@@ -788,7 +789,7 @@ JSVAL_SAME_TYPE_IMPL(jsval_layout lhs, j - { - uint64_t lbits = lhs.asBits, rbits = rhs.asBits; - return (lbits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE && rbits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE) || -- (((lbits ^ rbits) & 0xFFFF800000000000LL) == 0); -+ (((lbits ^ rbits) & 0xFFFF000000000000LL) == 0); - } - - static JS_ALWAYS_INLINE jsval_layout -@@ -810,7 +811,7 @@ JSVAL_TO_PRIVATE_UINT32_IMPL(jsval_layou - static JS_ALWAYS_INLINE JSValueType - JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l) - { -- uint64_t type = (l.asBits >> JSVAL_TAG_SHIFT) & 0xF; -+ uint64_t type = (l.asBits >> JSVAL_TAG_SHIFT) & 0x7; - JS_ASSERT(type > JSVAL_TYPE_DOUBLE); - return (JSValueType)type; - } -diff -urNp mozjs17.0.0_orig/js/src/methodjit/MethodJIT.cpp mozjs17.0.0/js/src/methodjit/MethodJIT.cpp ---- mozjs17.0.0_orig/js/src/methodjit/MethodJIT.cpp 2013-02-11 17:33:23.000000000 -0500 -+++ mozjs17.0.0/js/src/methodjit/MethodJIT.cpp 2016-05-16 15:36:35.044096031 -0400 -@@ -238,8 +238,8 @@ JS_STATIC_ASSERT(offsetof(VMFrame, saved - JS_STATIC_ASSERT(offsetof(VMFrame, scratch) == 0x18); - JS_STATIC_ASSERT(VMFrame::offsetOfFp == 0x38); - --JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF800000000000LL); --JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x00007FFFFFFFFFFFLL); -+JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF000000000000LL); -+JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x0000FFFFFFFFFFFFLL); - - asm ( - ".text\n" -@@ -266,8 +266,8 @@ SYMBOL_STRING(JaegerTrampoline) ":" - CFI(".cfi_offset rbx, -56" "\n") - - /* Load mask registers. */ -- "movq $0xFFFF800000000000, %r13" "\n" -- "movq $0x00007FFFFFFFFFFF, %r14" "\n" -+ "movq $0xFFFF000000000000, %r13" "\n" -+ "movq $0x0000FFFFFFFFFFFF, %r14" "\n" - - /* Build the JIT frame. - * rdi = cx -@@ -947,8 +947,8 @@ extern "C" { - JS_STATIC_ASSERT(offsetof(VMFrame, savedRBX) == 0x68); - JS_STATIC_ASSERT(offsetof(VMFrame, scratch) == 0x18); - JS_STATIC_ASSERT(VMFrame::offsetOfFp == 0x38); --JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF800000000000LL); --JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x00007FFFFFFFFFFFLL); -+JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF000000000000LL); -+JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x0000FFFFFFFFFFFFLL); - - #endif /* _WIN64 */ - --- -2.5.5 - diff --git a/SPECS/mozjs17.spec b/SPECS/mozjs17.spec index a6aff11..78c5341 100644 --- a/SPECS/mozjs17.spec +++ b/SPECS/mozjs17.spec @@ -1,7 +1,7 @@ Summary: JavaScript interpreter and libraries Name: mozjs17 Version: 17.0.0 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv2+ or LGPLv2+ or MPLv1.1 Group: Development/Languages URL: http://www.mozilla.org/js/ @@ -19,15 +19,7 @@ Patch2: mozbug746112-no-decommit-on-large-pages.patch Patch3: 0001-Move-JS_BYTES_PER_WORD-out-of-config.h.patch Patch4: mozjs17-aarch64.patch Patch5: mozjs17-aarch64-support-64K-pages.patch -# This changes the API/ABI, which we're currently only doing for aarch64 -# https://bugzilla.redhat.com/show_bug.cgi?id=1324216 -%ifarch aarch64 -%global fortyeightbitva_patch 1 -%else -%global fortyeightbitva_patch 0 -%endif -Patch6: mozjs17-aarch64-48bit-va-limits.patch -Patch7: 0001-Bump-soname-for-API-ABI-change-due-to-aarch64-portin.patch +Patch6: mozjs17-48-bit-VA-fix.patch %description JavaScript is the Netscape-developed object scripting language used in millions @@ -56,10 +48,7 @@ rm js/src/ctypes/libffi -rf %patch3 -p1 %patch4 -p1 %patch5 -p1 -%if 0%{fortyeightbitva_patch} %patch6 -p1 -%patch7 -p1 -%endif %build chmod a+x configure @@ -89,13 +78,6 @@ rm -f %{buildroot}%{_bindir}/js17 # the pkg-config file. rm -f %{buildroot}%{_bindir}/js17-config -# We do not want the full soname embedded in the .pc file since -# that forces consumers to have architecture-dependent source patches -# to find it. All we want is a forced rebuild. -%if 0%{fortyeightbitva_patch} -mv %{buildroot}%{_libdir}/pkgconfig/mozjs-17.0{.1,}.pc -%endif - %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -109,6 +91,12 @@ mv %{buildroot}%{_libdir}/pkgconfig/mozjs-17.0{.1,}.pc %{_includedir}/js-17.0 %changelog +* Tue Mar 28 2017 Yaakov Selkowitz - 17.0.0-20 +- Switch to upstream aarch64 48bit VA patch + This reverts the previous API/ABI break on aarch64, so dependencies + must be rebuilt again. +- Resolves: #1393548 + * Thu May 26 2016 Colin Walters - 17.0.0-16 - Add patch for aarch64 48bit VA limits This changes the API/ABI only on aarch64, and hence we also bump