From patchwork Wed Nov 11 08:37:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 103687 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5345.1794386239343748487 for ; Wed, 11 Nov 2026 00:37:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=VNKCjcgQ; spf=pass (domain: gmail.com, ip: 74.125.82.180, mailfrom: raj.khem@gmail.com) Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-3282db206d3so2672170eec.0 for ; Wed, 11 Nov 2026 00:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794386239; x=1794991039; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=a7NbBFqxlsDyz3jYWweT13gx2ksini4w3yXwkgPEafA=; b=VNKCjcgQj3UX9IDZDN8zXYfcBcRBpHl22bMuxcXgcf71oEVje/MbmAz2ogh2Ttuidz BxvwTw7TQKqMCJ3KjS1BXGDvWDRLYW0AMQ9/m+Ve6h7Iai7h/xMyF3UiKxRzWjgY5UvT WQsRi9jHxo5BVE0Q0ruoo1THqT9qUcmRaCs9JjqKimU7KWvz7jdQUKaXfdIqRlZ2Gp12 p5r01SpMPygFFRRb+8BO9u0Tp606t8swSUGqF1fwewN0ETvtX7MMIQQVxEaGJa95oAcR kuLRXYf8Slj6gJtJoSAg4QXPzQT5IYbzCakr6F7M62JSaU8Y90QLrSAiOGZHiymdEJPt 7yfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794386239; x=1794991039; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=a7NbBFqxlsDyz3jYWweT13gx2ksini4w3yXwkgPEafA=; b=Vfv1VVVwn/7t+WQp2pcan9sp1d2AKy1ViB3Ylwax8FWS8Ob0jHct0QqKn3i5z91+h1 7kF1U73K7i9ODueGtmvB4zDHW987Fiy1Fd/sgr1tRDGOFjXPellZPiYij27zj76HOXP4 difLlgsNqxbGV9yDyfI/ugEJv+S3XGpjag+f/WUlXJGf+P/i12PzJs4eXmwJeSYeTFhg H0cxxGQBejYsWBzYFnZSdYRt8Ipxxy+JhJyiPVQxU+RK1UVoQpJQKWMtrhXaGVfjV7k0 O7SVcVLCztUliU7vdQ+28CS+uDt593dUPQgyy3g2fMgCZNpCRqQ70AcAGVBvtK3kvFn9 80rQ== X-Gm-Message-State: APuU4Z9zNUzLKUhjM4xQ/8FXW8zJqYVgy54akA0ZblJnWsjVT4HaOvuP TO1tOJMvmgNI4oOcnpC4yToqKqnW2SaEHp5Z/aCQR+lTfCQLTUD/pPGqoS7pYg1HI2X5fg== X-Gm-Gg: AYBFou1UQExTbHTUb+BEEKMRDVWskWGS22D6JJO0rodikgQtZQq9MyL8+8J4foHEmXK ZfqqSAE/ZYxKq3rgjOaSSbP18Uro7YwvPKDcay2SGUI987xidNhV46I9T08cl2YcitbCfBaq0pf iljaKKEOxngtcsVPzEkxl5+hCOxlIuyddFDep1rFOxtZ2lrMMQBdOEpbp9qmzjNFgOsOl+47A9o aL0LjLqYGBCqDcN1Py+WyB0G11bvvR1LamvoysCHueFb9A1UUHUj7qaZv7bXwzSOUzy1f02DmXC ehc++TVaLGxdcFYV4aW+mAngLB4fN6XdxYa1FQmhCySWsROXLJiYDIpGRh9bkY1EfIO73MBGS9S Xzie+VAnPiPcKZ0Bj8mk3UFPusi9tZVihPBb5jASnGWlGnGMAtJsrNyU49g9Uw7w6cklUUu3I5d sJUvFnfgB8EA4We3mr+2Y5krRlVFBPdXgyIs2ZWceyNnq9H+eiimo9rqOyzd+nVcv7MiwP8Iv/G RHa0gKHg+ypBzaPn/Bmh8oC5nbZunRxMQPFQQIwiBpTM6dI0wRxfuWxO2FQqtRRWb7R9AGQc9hn HenLJCccZ7hjG0lDlMkd0331X3S5HHabtFeDYeoGorbIyuQH0c2fq2XzcP7kctrzRtuohhlUQMp 3LYpjnANJ3Y0Pt16dLY8Bx0Hi6Adfrg0MUNamIRIOvETqz4AQck0fpSNukmUSY1YPl90ZTcD/0q H0yP+MLHZiRupkOSrHKSX5RT4lIbSiJCM5/ppu+1RLRgEIRNUfOuIRzWb0DQR2LbRSvR/ee/pJO V3+PeC/+srbQcOgy1rEpBmTAydRzKNf2onl+2W1O3RfABuCMQ1Jn0xPjLGymdFfhWNwA5VC32+/ jjj9 X-Received: by 2002:a05:693c:88cb:10b0:376:5b99:a816 with SMTP id 5a478bee46e88-37683188c5emr2546041eec.3.1794386238426; Wed, 11 Nov 2026 00:37:18 -0800 (PST) Return-Path: Received: from apollo.tail3ccdd3.ts.net ([147.160.63.35]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3751fe306e3sm14504599eec.7.2026.11.11.00.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 00:37:17 -0800 (PST) From: Khem Raj X-Google-Original-From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj , Khem Raj Subject: [PATCH 1/3] musl: Use FENV_ACCESS pragma instead of maytrap exception behavior Date: Wed, 11 Nov 2026 00:37:09 -0800 Message-ID: <20261111083711.549321-1-khem.raj@oss.qualcomm.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 11 Nov 2026 08:37:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/249968 Upstream review [1] asked whether the real problem is a missing #pragma STDC FENV_ACCESS ON in the affected sources. It is: with the pragma in expm1.c, expm1f.c, hypot.c and hypotf.c, clang stops speculating the floating point operations that raise the spurious exceptions, and libc-test math/expm1, expm1f, hypot, hypotf and sinh pass. Tested natively on aarch64 with clang 23.1.3 and gcc 14.2 for generic, cortex-a57, cortex-a72 and neoverse-n1: those tests now pass with both compilers, and gcc builds are unchanged. The remaining clang only math failure, yn, comes from fma contraction and is already deleted from the libc-test ptest. Replace the configure flag with the source change. [1] https://www.openwall.com/lists/musl/2026/10/28/2 Signed-off-by: Khem Raj AI-Generated: Uses Claude Code --- ...p-exception-behavior-maytrap-when-su.patch | 46 ------------ ..._ACCESS-in-expm1-expm1f-hypot-and-hy.patch | 73 +++++++++++++++++++ meta/recipes-core/musl/musl_git.bb | 2 +- 3 files changed, 74 insertions(+), 47 deletions(-) delete mode 100644 meta/recipes-core/musl/musl/0004-configure-use-ffp-exception-behavior-maytrap-when-su.patch create mode 100644 meta/recipes-core/musl/musl/0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch diff --git a/meta/recipes-core/musl/musl/0004-configure-use-ffp-exception-behavior-maytrap-when-su.patch b/meta/recipes-core/musl/musl/0004-configure-use-ffp-exception-behavior-maytrap-when-su.patch deleted file mode 100644 index dfff81299b..0000000000 --- a/meta/recipes-core/musl/musl/0004-configure-use-ffp-exception-behavior-maytrap-when-su.patch +++ /dev/null @@ -1,46 +0,0 @@ -From fe310a5e2fe6be3c28f800bde383d7df5aac4b49 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 25 Oct 2026 21:54:26 -0700 -Subject: [PATCH] configure: use -ffp-exception-behavior=maytrap when supported - -The math library relies on floating point exception flags being raised -exactly as the C code would raise them. GCC keeps that by default -(-ftrapping-math), but clang assumes floating point exceptions are never -inspected unless told otherwise, and may then evaluate both arms of a -branch and select the result. Built with clang 23 for aarch64, expm1() -computes both y*2.0*0x1p1023 and y*twopk for the k < 0 || k > 56 case -and picks one with fcsel, so the unused multiply raises a spurious -OVERFLOW. libc-test's math/expm1, expm1f, hypot, hypotf and sinh fail -because of that. - --ffp-exception-behavior=maytrap tells clang to avoid transformations -that raise exceptions the original code would not raise. GCC does not -accept the option, so tryflag leaves GCC builds unchanged. - -Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2026/10/28/1] -Signed-off-by: Khem Raj ---- - configure | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/configure b/configure -index bc9fbe48..7e1e1b72 100755 ---- a/configure -+++ b/configure -@@ -355,6 +355,16 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \ - || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; } - tryflag CFLAGS_C99FSE -frounding-math - -+# -+# The math library relies on floating point exception flags being -+# raised exactly as the C code would raise them. GCC does not move -+# floating point operations that may trap across branches by default -+# (-ftrapping-math), but clang assumes exceptions are never inspected -+# unless told otherwise, and may then evaluate both sides of a branch, -+# raising spurious exceptions (e.g. OVERFLOW from expm1, hypot, sinh). -+# -+tryflag CFLAGS_C99FSE -ffp-exception-behavior=maytrap -+ - # - # Semantically we want to insist that our sources follow the - # C rules for type-based aliasing, but most if not all real-world diff --git a/meta/recipes-core/musl/musl/0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch b/meta/recipes-core/musl/musl/0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch new file mode 100644 index 0000000000..594e97a348 --- /dev/null +++ b/meta/recipes-core/musl/musl/0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch @@ -0,0 +1,73 @@ +From 5009e7cdcd11c585f2bdebacf2fb4f8540508efe Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 10 Nov 2026 18:36:03 -0800 +Subject: [PATCH] math: enable FENV_ACCESS in expm1, expm1f, hypot and hypotf + +These functions rely on floating point exception flags being raised +exactly as the C code would raise them, but without FENV_ACCESS the +compiler may assume the flags are never inspected. Clang does, and +speculates floating point operations across branches. Built with +clang 23 for aarch64 (-mcpu=cortex-a57), expm1() computes both +y*2.0*0x1p1023 and y*twopk for the k < 0 || k > 56 case and picks +one with fcsel, so the unused multiply raises a spurious OVERFLOW. +libc-test's math/expm1, expm1f, hypot, hypotf and sinh (via expm1) +fail because of that. + +GCC does not speculate these operations, so GCC builds are unchanged. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2026/11/11/3] +Signed-off-by: Khem Raj +--- + src/math/expm1.c | 1 + + src/math/expm1f.c | 1 + + src/math/hypot.c | 1 + + src/math/hypotf.c | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/src/math/expm1.c b/src/math/expm1.c +index ac1e61e..81d0c80 100644 +--- a/src/math/expm1.c ++++ b/src/math/expm1.c +@@ -105,6 +105,7 @@ + */ + + #include "libm.h" ++#pragma STDC FENV_ACCESS ON + + static const double + o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ +diff --git a/src/math/expm1f.c b/src/math/expm1f.c +index 09a41af..8c7aa18 100644 +--- a/src/math/expm1f.c ++++ b/src/math/expm1f.c +@@ -14,6 +14,7 @@ + */ + + #include "libm.h" ++#pragma STDC FENV_ACCESS ON + + static const float + ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ +diff --git a/src/math/hypot.c b/src/math/hypot.c +index 6071bf1..0efc546 100644 +--- a/src/math/hypot.c ++++ b/src/math/hypot.c +@@ -1,6 +1,7 @@ + #include + #include + #include ++#pragma STDC FENV_ACCESS ON + + #if FLT_EVAL_METHOD > 1U && LDBL_MANT_DIG == 64 + #define SPLIT (0x1p32 + 1) +diff --git a/src/math/hypotf.c b/src/math/hypotf.c +index 2fc214b..91fc086 100644 +--- a/src/math/hypotf.c ++++ b/src/math/hypotf.c +@@ -1,5 +1,6 @@ + #include + #include ++#pragma STDC FENV_ACCESS ON + + float hypotf(float x, float y) + { diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index b53b4be84c..0be24b22f1 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -14,7 +14,7 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ file://0003-tools-version.sh-fall-back-to-VERSION-when-git-descr.patch \ - file://0004-configure-use-ffp-exception-behavior-maytrap-when-su.patch \ + file://0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch \ " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" From patchwork Wed Nov 11 08:37:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 103688 Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5346.1794386243901849698 for ; Wed, 11 Nov 2026 00:37:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=GeMoZXd8; spf=pass (domain: gmail.com, ip: 74.125.82.171, mailfrom: raj.khem@gmail.com) Received: by mail-dy1-f171.google.com with SMTP id 5a478bee46e88-36f8cdd30beso4977689eec.1 for ; Wed, 11 Nov 2026 00:37:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794386243; x=1794991043; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IGTwN3piz8aECWUpe7c8hzhvlJtfopUrPtGWc8F5Q+k=; b=GeMoZXd8b3ifXKIqfR+DdtiKrdrI0zEQ0GQlXciWi423ydZSdoofPL8N2CpVb7J0Ud MqMGULboEzgd3oI41HdH4HFd0TwXkCgCiTgV4Lh6/DIvZjEXQu0UFBmS0QvAll5zvaeE r92+t7I64ti/H3jVfjsyy82L/monXwjRSme3/4XOvZjJW2cxaXhQQdl6ysb2eOGVxpPb /bQyBstXwcyd1YgxfaOcwIrYKGUnQD5DLo/VOZZ/LcYw2c7M2/aEsSPvbIiDlKS1ncSK 19NtMHvizhqaQOoOquiPZQ6Osu64ltg/RAju+g91AvtYEI/omRbVnG6WuK/NVd6A/wNV imRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794386243; x=1794991043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=IGTwN3piz8aECWUpe7c8hzhvlJtfopUrPtGWc8F5Q+k=; b=ez3H3z9sEpSUKjiLoZ3SCr9t6K0eUMDbFtkVKZWybuKjKPfEZPs588qVcxUxmuT/J+ GAMXHPcmlJkVIeP3dwM0l3nfxNQ+8ObGviMsGXITd+FSIEygogs53IVqkVohMEQx7jvd AHo7e2zItrM/HRPyhCrbjGzG/VTMgJtFT6NlpiKaBPPzRL/GU9V4ZvX/oucbVyleVZ9q Kg9YTAf8HkVAA/K7A44avWMtR/ZrhziZQmAPpAqduqynTjiD89I4K3g7rchbOn3t9OEX VPgFdPQwDeS6kiZqu4TI9pMhwY5n1F2NYk8S3q2MurOf9xlgF4S2q6yaIju9M8o1AGa9 VYbg== X-Gm-Message-State: APuU4Z/8ROWEol4NMCnBkhXre5PJpQZM69+r9dcmPII7xZeU/xdmQlow iGAKonGc3AAt5CHR5MqGURtNW5/F7k5H9sNIxEZLXbgLYQ4IkXmPqE+4ZZtSzKGkmoQ2Iw== X-Gm-Gg: AYBFou26WUNgRoTU9esUeyC/Oo1TwzUZaZeDChbDsmBbit6n2ssveJpyy/gmfjRcs09 LWMXTdm+ZpUSb4Hnmt7F/uVvuS3/c6A0ohStM65wE9la4xfPHFxQB5HIrZKyF1K1lZmqfUwb8ub BiTTaS2IMAtWqbutQ3HirEf0m7ulEbWsdcGYQP81uwD08bmA/K8nwEVU3Nbc0UpGXMuOnFIqZks 9jyk0jVAI40IZb9RW9i0DrV4HKOlj6JM9FNasP4uaKU/2zZv6GGt0MWbnXt8293Hv7aVIBIGILL PVFjvAuBFFoejN9qNaFiqgW5+cIl3zYHldq8Wsnwo/Bh6wsi5FfviqgrbkPT8/Q2K04LJ3tMJoM Kau2zasXLgZrCZ3hgZoCBdxE9OTzBv+qcmbgIafvk+Gdze2Pr2LbzEFT7HvbN7Fbj/WmusgT0kV +5zc1NyQXEkzJkKwd+Mguiecc8l/t35xVdnMF23RLdFPjOzVwYYUacj0IQ220ouk0NMVOChzAb2 W2uLLSi/WSNpjWV6rMQbP55GG7h3XZoGHqDMWil+QWNlzXF144qq2p7blRsBrsS3d+RGQzvm2HP BaSz3XqcWibnqJOlTn3Z4cBEJvvNyRbWpsxVAxQ1Fo0T1aqmHkopdyHN1HcYmoUuY7+dMNGPYiZ lOcRTAwmKts3Ap1ruGLzNbIdDr98QLZIN1s7GTxfKGIKUYpqcl+Ej+l7kk3JPqDY5Kyo0SL0qQS 4K/TkPbj4Mf+BqOWbCj+NUM4c1Nm3+Xo9bnUHBKm09KZGGfGP7FWqzKxpMigvChsDqNzGTIMjK8 eT2duV3lZOvu79YhIF6EZhMpPblOL+CYsWH8X5QrxwatdyWX0CIWdabCy2H4c2XWmKGK2Uf1h4W 2FS8 X-Received: by 2002:a05:7301:3f19:b0:36f:3da8:dbc8 with SMTP id 5a478bee46e88-37686d31fa8mr3236805eec.31.1794386243203; Wed, 11 Nov 2026 00:37:23 -0800 (PST) Return-Path: Received: from apollo.tail3ccdd3.ts.net ([147.160.63.35]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3751fe306e3sm14504599eec.7.2026.11.11.00.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 00:37:22 -0800 (PST) From: Khem Raj X-Google-Original-From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj , Khem Raj Subject: [PATCH 2/3] musl: Disable FP contraction in yn Date: Wed, 11 Nov 2026 00:37:10 -0800 Message-ID: <20261111083711.549321-2-khem.raj@oss.qualcomm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261111083711.549321-1-khem.raj@oss.qualcomm.com> References: <20261111083711.549321-1-khem.raj@oss.qualcomm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 11 Nov 2026 08:37:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/249969 clang contracts a*b+c into fma by default, unlike GCC in ISO C mode. That changes the rounding of the yn() forward recurrence, and libc-test math/yn fails with a 3.2 ulp error when musl is built with clang. Turn contraction off in jn.c with #pragma STDC FP_CONTRACT OFF. Tested natively on aarch64 with clang 23.1.3 and gcc 14.2 for generic, cortex-a57, cortex-a72 and neoverse-n1: math/yn passes with both compilers. Signed-off-by: Khem Raj AI-Generated: Uses Claude Code --- ...-math-disable-FP-contraction-in-jn.c.patch | 34 +++++++++++++++++++ meta/recipes-core/musl/musl_git.bb | 1 + 2 files changed, 35 insertions(+) create mode 100644 meta/recipes-core/musl/musl/0005-math-disable-FP-contraction-in-jn.c.patch diff --git a/meta/recipes-core/musl/musl/0005-math-disable-FP-contraction-in-jn.c.patch b/meta/recipes-core/musl/musl/0005-math-disable-FP-contraction-in-jn.c.patch new file mode 100644 index 0000000000..f87f9752e2 --- /dev/null +++ b/meta/recipes-core/musl/musl/0005-math-disable-FP-contraction-in-jn.c.patch @@ -0,0 +1,34 @@ +From 3c36c2969dc3bea32d7e465428f7b2c78787de77 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 10 Nov 2026 20:13:06 -0800 +Subject: [PATCH] math: disable FP contraction in jn.c + +GCC does not contract floating point expressions in ISO C mode +(-std=c99), but clang contracts a*b+c into fma by default. In yn() +that turns the forward recurrence b = (2.0*i/x)*b - a into an fma, +which changes its rounding. Built with clang 23 for aarch64, +libc-test's math/yn then fails with + + yn(6, 0x1.8c5db097f7442p-1) want -0x1.6dbc18f9d5ddep+13 + got -0x1.6dbc18f9d5de1p+13, ulperr -3.219 + +Turn contraction off for this file, as GCC builds already have it. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2026/11/11/4] +Signed-off-by: Khem Raj +--- + src/math/jn.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/math/jn.c b/src/math/jn.c +index 4878a54..b077f02 100644 +--- a/src/math/jn.c ++++ b/src/math/jn.c +@@ -35,6 +35,7 @@ + */ + + #include "libm.h" ++#pragma STDC FP_CONTRACT OFF + + static const double invsqrtpi = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */ + diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 0be24b22f1..ff8a08337c 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -15,6 +15,7 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ file://0003-tools-version.sh-fall-back-to-VERSION-when-git-descr.patch \ file://0004-math-enable-FENV_ACCESS-in-expm1-expm1f-hypot-and-hy.patch \ + file://0005-math-disable-FP-contraction-in-jn.c.patch \ " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" From patchwork Wed Nov 11 08:37:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 103689 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5347.1794386246120278231 for ; Wed, 11 Nov 2026 00:37:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=0e8xrM/5; spf=pass (domain: gmail.com, ip: 74.125.82.182, mailfrom: raj.khem@gmail.com) Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-37071c0f42aso5093901eec.0 for ; Wed, 11 Nov 2026 00:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794386245; x=1794991045; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AnFA6LUxd7/kcUMlrZtCpjAjs7iZOJ57Vb/nH48kiDw=; b=0e8xrM/57Gcadtmn0/jh0v/PA6h8nwTwS8oHsPaNFbhDh3TM4cfMMIF3030SPa3FN1 /8xtWSwoD56twaSyzjoi6lT8fDTORAMwn+r1h3Z/MUzTufAS/JNSp0WZTj5MS2uBpcfO A3QiBDNjzr/nctsMmp45n07eHDwLgRLC2emPCXEUYUTC2h86QnSDEfSFi38isAx9l8Zh +eQMLJkb8MWlqWpNdbPcwPOT+0VsIMfWR63Qj+UNxTzG4LS7kD0zFnRaI0ChIJonwcZ0 Z/ZLABFmGYaou+tqK9TEozSmQXEfeeg21c8MMGo2ndeAmVFhddwDeBaBFfT2rlQk5Q9o qDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794386245; x=1794991045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AnFA6LUxd7/kcUMlrZtCpjAjs7iZOJ57Vb/nH48kiDw=; b=uF3h80nUK9uEWRqJn8cf8H1m/4m5hKK6oltrahBI8x/uVWIlVJVKlSsj6CsG3iaT4v aJQpV8DmVABIU4ClE5o3xX1NfWjnsW5SJv+AbGf+VbRYmnv6vejmmMxNIQJLmaoyhirH qqUz/eaK6w8HRVBCxADSjU9JDtnU5ECRFM3SA978FtpKCO8yLFgqRSQA7UgplxU93q+B 76AMyg903qjX75+dNxLmDsihZuhIl5OoYEQhEDruRS7z780qi5qLyM0QykJlZUNmQ0pn USdDMTH8unqhc/6vobo2vUKwYzrsMxEEV4JBGWluPykWpE2EHZ92X9Upr/Es11pNtMbU waqw== X-Gm-Message-State: APuU4Z+AcqCxJKe6dnZfmiXWOiTLiwE8XQcfStk9wYOalmRZQIbNDlaG 11v7OvK/xoSLJPiEOgiBxHQPNMo85Ki4hYWPG8vMQQygaFn0UGq7hqiYO0hHQHuVJqeQxg== X-Gm-Gg: AYBFou1tMxurivvd8TZQfIdscYROcxIt2o6My9cVwS3J0k8XXbSbp8lUerdwfUzYEa1 4v7iiAPPchz2AMaHuvYIi82NSrgEmxi6zMWtwc+xW5uAStHiIOg3sYQ3qTOjwwUfaBiDrlZFTpr azRUe0/sUtU93rbsAw3uafvErk46PaGbNuj8K0//A6mAmSTwPeayiqTJb07AJSLp9oSVBSWwAB6 1gzvknfbEONP2lrSLVEwzVt0vkAh47fe9tKt6k+7Rq0EakL00smiB1DTXpoiKwt0nDGV8I6WAR9 F9CvkDnzg+k6KyitiBl1GwK6NxK4HLvbefo7mqEbMmBPUCCYyD4U1SzjU3hcmXALQzc/AIpoMlq +plXlCuX5pqX0uC5zxT+v1+3GTRrc6HPP+3+m5dYGKizkCXTg66qcqosxn1eEWfzRUgv+kzvsN3 usx404MNVV4Rladux695UZ9UJZkdPeKlDjGOXAks7hSJI6KOevzBxA4ZOHaJyubBdGhEoS7t/UY FPpgY5RoQv+TwLg3wodasa0pxxOQv3gaESSjzS9vvOy3QjlDbzyB5+XbAeqh9F5YAWwk/4LwfdE xx7VHX+f8OaHZDxKgbMr1vdoDBBm4CTUdGQl2kP2ZFDXS4/c77V77lmF6/wIlJBTcaKu4rHyjx4 AVDOb0lpHPtbczm6vDeQardp3ezMwgXOWNEz67LT47eDJbnOOo76kiQ3jOrrVgs+Azz5b/5sw5l gWxWv7UJdeB2Loti1xyGg9ikSEuhbJKV8+hcoA32PaB6xe0h71RNCqhxmrH06AqL5VrLUa3Vh10 TB+ZpfJ6x4ixaEk8W+G16N/JG4J8Q3RWbuvFFfsd+agwVQKc8alq+kQYNxWLjK+nnx1qwET5Oma RvYl X-Received: by 2002:a05:693c:80cd:b0:36f:202c:48 with SMTP id 5a478bee46e88-37685d728d6mr2740537eec.14.1794386245371; Wed, 11 Nov 2026 00:37:25 -0800 (PST) Return-Path: Received: from apollo.tail3ccdd3.ts.net ([147.160.63.35]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3751fe306e3sm14504599eec.7.2026.11.11.00.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 00:37:24 -0800 (PST) From: Khem Raj X-Google-Original-From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 3/3] libc-test: Re-enable yn test Date: Wed, 11 Nov 2026 00:37:11 -0800 Message-ID: <20261111083711.549321-3-khem.raj@oss.qualcomm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261111083711.549321-1-khem.raj@oss.qualcomm.com> References: <20261111083711.549321-1-khem.raj@oss.qualcomm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 11 Nov 2026 08:37:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/249970 its now fixed in musl Signed-off-by: Khem Raj --- .../0001-math-Delete-failing-tests.patch | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/meta/recipes-core/musl/libc-test/0001-math-Delete-failing-tests.patch b/meta/recipes-core/musl/libc-test/0001-math-Delete-failing-tests.patch index 96ff279fa6..814d7bcb64 100644 --- a/meta/recipes-core/musl/libc-test/0001-math-Delete-failing-tests.patch +++ b/meta/recipes-core/musl/libc-test/0001-math-Delete-failing-tests.patch @@ -15,13 +15,11 @@ Signed-off-by: Khem Raj src/math/fmaf.c | 47 -------------------------------------------- src/math/fmal.c | 52 ------------------------------------------------- src/math/powf.c | 47 -------------------------------------------- - src/math/yn.c | 43 ---------------------------------------- 5 files changed, 236 deletions(-) delete mode 100644 src/math/fma.c delete mode 100644 src/math/fmaf.c delete mode 100644 src/math/fmal.c delete mode 100644 src/math/powf.c - delete mode 100644 src/math/yn.c diff --git a/src/math/fma.c b/src/math/fma.c deleted file mode 100644 @@ -240,52 +238,3 @@ index 4778c2f..0000000 - } - return !!err; -} -diff --git a/src/math/yn.c b/src/math/yn.c -deleted file mode 100644 -index 244dbb8..0000000 ---- a/src/math/yn.c -+++ /dev/null -@@ -1,43 +0,0 @@ --#define _XOPEN_SOURCE 700 --#include --#include --#include "mtest.h" -- --static struct di_d t[] = { --#include "sanity/yn.h" --#include "special/yn.h" --}; -- --int main(void) --{ -- #pragma STDC FENV_ACCESS ON -- double y; -- float d; -- int e, i, err = 0; -- struct di_d *p; -- -- for (i = 0; i < sizeof t/sizeof *t; i++) { -- p = t + i; -- -- if (p->r < 0) -- continue; -- fesetround(p->r); -- feclearexcept(FE_ALL_EXCEPT); -- y = yn(p->i, p->x); -- e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); -- -- if (!checkexcept(e, p->e, p->r)) { -- printf("%s:%d: bad fp exception: %s yn(%lld, %a)=%a, want %s", -- p->file, p->line, rstr(p->r), p->i, p->x, p->y, estr(p->e)); -- printf(" got %s\n", estr(e)); -- err++; -- } -- d = ulperr(y, p->y, p->dy); -- if ((!(p->x < 0) && !checkulp(d, p->r)) || (p->x < 0 && !isnan(y) && y != -inf)) { -- printf("%s:%d: %s yn(%lld, %a) want %a got %a, ulperr %.3f = %a + %a\n", -- p->file, p->line, rstr(p->r), p->i, p->x, p->y, y, d, d-p->dy, p->dy); -- err++; -- } -- } -- return !!err; --}