Bug#1063446: libmozjs-115-dev: cannot call JS::CanonicalizeNaN(double) on mips64el
Hi Simon, On 08/02/2024 21:59, Simon McVittie wrote: On Thu, 08 Feb 2024 at 10:37:33 +, Simon McVittie wrote: Package: libmozjs-115-dev Justification: makes gjs FTBFS (#1063433) I believe mozjs115_115.7.0-3 should fix this. wb-team: Please could someone with wanna-build access schedule gjs on mips64el to be built after the fixed version of mozjs115 becomes available? I believe the correct spelling is: dw gjs_1.78.3-1 . unstable . mips64el . -m 'libmozjs-115-dev (>= 115.7.0-3)' mozjs115 is already built, so I just gave gjs back. Cheers, Emilio
Bug#1063446: libmozjs-115-dev: cannot call JS::CanonicalizeNaN(double) on mips64el
On Thu, 08 Feb 2024 at 10:37:33 +, Simon McVittie wrote: > Package: libmozjs-115-dev > Justification: makes gjs FTBFS (#1063433) I believe mozjs115_115.7.0-3 should fix this. wb-team: Please could someone with wanna-build access schedule gjs on mips64el to be built after the fixed version of mozjs115 becomes available? I believe the correct spelling is: dw gjs_1.78.3-1 . unstable . mips64el . -m 'libmozjs-115-dev (>= 115.7.0-3)' mips team, or mozjs experts: Please could someone look into upstreaming the attached mips-specific patch? Thanks, smcv From: Simon McVittie Date: Thu, 8 Feb 2024 10:36:53 + Subject: Export js::detail::CanonicalizedNaNBits on architectures that use it Otherwise the inline function JS::CanonicalizeNaN(double), which is called by gjs, cannot validly refer to it. Bug-Debian: https://bugs.debian.org/1063446 Signed-off-by: Simon McVittie --- js/public/Value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/public/Value.h b/js/public/Value.h index de8db0f..d934b59 100644 --- a/js/public/Value.h +++ b/js/public/Value.h @@ -445,7 +445,7 @@ constexpr uint64_t CanonicalizedNaNSignificand = 0x8; #endif #if defined(JS_RUNTIME_CANONICAL_NAN) -extern uint64_t CanonicalizedNaNBits; +extern JS_PUBLIC_DATA uint64_t CanonicalizedNaNBits; #else constexpr uint64_t CanonicalizedNaNBits = mozilla::SpecificNaNBits
Bug#1063446: libmozjs-115-dev: cannot call JS::CanonicalizeNaN(double) on mips64el
On Thu, 08 Feb 2024 at 10:37:33 +, Simon McVittie wrote: > Simplified steps to reproduce: > Try to compile the attached, with: > g++ test.cpp -o test $(pkgconf --cflags --libs mozjs-115) Oops, really attached now. > I'm preparing a possible patch (but it will take a long time to test, > because compiling mozjs on mips64el is extremely slow). Untested patch attached. I'm trying to build with this change on eberlin. smcv // Copyright 2024 Simon McVittie // SPDX-License-Identifier: MIT #include #include #include #include int main(int argc, char** argv) { // Smoke-test const char* reason = JS_InitWithFailureDiagnostic(); if (reason) { std::fprintf(stderr, "Fatal error: %s\n", reason); return 1; } JSContext* cx = JS_NewContext(32 * 1024 * 1024); // https://bugs.debian.org/1063446 uint64_t u64; double d = JS::CanonicalizeNaN(0.0/0.0); static_assert(sizeof(u64) == sizeof(d)); memcpy(&u64, &d, sizeof(d)); std::printf("Representation of a canonicalized NaN: %" PRIx64 "\n", u64); JS_DestroyContext(cx); JS_ShutDown(); return 0; } >From ac5a01642f111e88cb80aa54b1ee438b3bc6d07e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 8 Feb 2024 10:36:53 + Subject: [PATCH] Export js::detail::CanonicalizedNaNBits on architectures that use it Otherwise the inline function JS::CanonicalizeNaN(double), which is called by gjs, cannot validly refer to it. Bug-Debian: https://bugs.debian.org/1063446 Signed-off-by: Simon McVittie Gbp-Pq: Name Export-js-detail-CanonicalizedNaNBits-on-architectures-th.patch --- js/public/Value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/public/Value.h b/js/public/Value.h index de8db0fed8..d934b59dd4 100644 --- a/js/public/Value.h +++ b/js/public/Value.h @@ -445,7 +445,7 @@ constexpr uint64_t CanonicalizedNaNSignificand = 0x8; #endif #if defined(JS_RUNTIME_CANONICAL_NAN) -extern uint64_t CanonicalizedNaNBits; +extern JS_PUBLIC_DATA uint64_t CanonicalizedNaNBits; #else constexpr uint64_t CanonicalizedNaNBits = mozilla::SpecificNaNBits
Bug#1063446: libmozjs-115-dev: cannot call JS::CanonicalizeNaN(double) on mips64el
Package: libmozjs-115-dev Version: 115.7.0-2 Severity: serious Tags: upstream Justification: makes gjs FTBFS (#1063433) X-Debbugs-Cc: debian-m...@lists.debian.org User: debian-m...@lists.debian.org Usertags: mips64el Control: block 1063433 by -1 Original steps to reproduce: Try to compile gjs 1.78.3-1 (#1063433), which calls this public API: double JS::CanonicalizeNaN(double) Simplified steps to reproduce: Try to compile the attached, with: g++ test.cpp -o test $(pkgconf --cflags --libs mozjs-115) Expected result: gjs or the simplified test compiles, links and runs successfully Actual result: On amd64 and other architectures, linking succeeds. On mips64el, linking fails: /usr/bin/ld: /tmp/cc41qWiD.o: in function `main': test.cpp:(.text+0x22c): undefined reference to `JS::detail::CanonicalizedNaNBits' I think this is because mozjs has mips-specific code to detect which is the preferred representation of NaN, with the result stored in a global variable that is read by the inline function JS::CanonicalizeNaN(double); but that global variable is not exported, so gjs cannot validly refer to it. I'm preparing a possible patch (but it will take a long time to test, because compiling mozjs on mips64el is extremely slow). smcv