Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195758/?format=api
{ "id": 2195758, "url": "http://patchwork.ozlabs.org/api/patches/2195758/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260211191928.988805-2-adhemerval.zanella@linaro.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260211191928.988805-2-adhemerval.zanella@linaro.org>", "list_archive_url": null, "date": "2026-02-11T18:55:28", "name": "[1/5] x86_64: Conditionally define __sfp_handle_exceptions for compiler-rt", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "62be228690ac9e9e906b6ef38dd8e0c39732ba8e", "submitter": { "id": 66065, "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api", "name": "Adhemerval Zanella", "email": "adhemerval.zanella@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260211191928.988805-2-adhemerval.zanella@linaro.org/mbox/", "series": [ { "id": 491898, "url": "http://patchwork.ozlabs.org/api/series/491898/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=491898", "date": "2026-02-11T18:55:31", "name": "Enable glibc build with LLVM compiler-rt and libunwind", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491898/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195758/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195758/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "libc-alpha@sourceware.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "libc-alpha@sourceware.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=riitdcw1;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=riitdcw1", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "sourceware.org; spf=pass smtp.mailfrom=linaro.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::b12a" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fB7Yk2sGnz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 06:20:26 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6EAFC4BA23E1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 19:20:24 +0000 (GMT)", "from mail-yx1-xb12a.google.com (mail-yx1-xb12a.google.com\n [IPv6:2607:f8b0:4864:20::b12a])\n by sourceware.org (Postfix) with ESMTPS id 97E9A4BA2E10\n for <libc-alpha@sourceware.org>; Wed, 11 Feb 2026 19:19:37 +0000 (GMT)", "by mail-yx1-xb12a.google.com with SMTP id\n 956f58d0204a3-64ae2ce2fe1so2540203d50.1\n for <libc-alpha@sourceware.org>; Wed, 11 Feb 2026 11:19:37 -0800 (PST)", "from mandiga.. ([2804:1b3:a7c2:42d3:8bd2:a06b:9b74:4887])\n by smtp.gmail.com with ESMTPSA id\n 956f58d0204a3-64afc9b5932sm2786042d50.21.2026.02.11.11.19.34\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 11 Feb 2026 11:19:35 -0800 (PST)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 6EAFC4BA23E1", "OpenDKIM Filter v2.11.0 sourceware.org 97E9A4BA2E10" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 97E9A4BA2E10", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 97E9A4BA2E10", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770837577; cv=none;\n b=lINpVlWirecxPPs2z1roHT6wATzyylgqfCPZ/fZ29jm6ThSPSRYqzgGhKJs+vZLdiAEANQ67Md7j3tvw6F40+iyg2O+6U0tSAU1w8n8bqdLcuWfFpz1Z5xHshDd7cuo+kW5XSR9EV44uwyAHu1G5Dqjyovx4in63EBCmbbpVTN8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770837577; c=relaxed/simple;\n bh=+7OIwcA6MdVhEmTOaXInrfZw6X9Nz0jOXkIvc033j30=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=xvVtVW7Y0UxRb0j2j3l7qxFzF6j5ZxMzfajtC9c0r+GMruYuBefmB77L/AIobPo4MbWB2FXDo+ZT9UI7JDTb8yZuZts73rGj5G1Q7Li22oU3uDoAJbHfOv9Sn3N4mKKvr2hMfm6w+MjLhaHASaNO/VNbhZKig5E++yTuw3RH8TY=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1770837576; x=1771442376; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=EO2iCsxo3hRcvmXu+0qpJzodJjh6HRrEvIgHAnsl4wo=;\n b=riitdcw1UQpFIHGpYnav9tAv8ha4cLPo+NS8xEnruqVwLySOeWR26sEMoxNnrU1gI1\n 3fjC9Lcfx2iGb0nqEYUEn225o81if/44bqkCtThl9Covi33copepeTg+mrlUxeXaEdYj\n MKUwtswTzXWCfR8v3ZmIstMq7kWXpShO5HRV6GN7m9CeX2Kz7ByuuHySPipq9HvzVmmM\n DJE40QSYjZBwUaVnwfoYtXXcPIr7hHwyxOs4xm8dgCggrcscTolsgNsztLY7sOt+W61j\n /vJHkdLbjy3ArEsidops80dn1QKwA8OasioR0/Urmrch0yP2LXhZUTbt4katx1svgeqy\n X+6Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770837576; x=1771442376;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=EO2iCsxo3hRcvmXu+0qpJzodJjh6HRrEvIgHAnsl4wo=;\n b=Gx25P3jfbcNuGTcebVwsizYjlwwCX+FsQw1SoD4cAfzf5fJxXclYr2Bd8K9RO6iHnX\n ZFQRQbjjenjEr4phdoKcNxwLeGOV5K95syR1rjqfy4f/NA958xNYde7D+c4T9S/IjSiA\n ERtfuusAhJp4v2nBWLghBgG/CShTnPCI3n71cOEJPgU31vaKErCm2SY2jcnCDwrrxnoo\n 53+ywhl218iGRu0St+hoCjIgHPCW5B3VMobBWvPsX6iKZHsCPde0/JJ9jLBaglB9uvpp\n En1AWPobP50kbyeokVuFqj8YqZICBWlKt0MWe8hREk9K74vV0ch+lItameuf46MDcoYd\n Pj3Q==", "X-Gm-Message-State": "AOJu0Yw8GPBSLzKmhy8wS8B9jLlfr33xDO9u7YW+oos2HzKGUTWL8uzV\n LAFrl0ZIjbS3wg/1UNr5QbSXUSy/9t3IzhsiXmNAAgfOWNMwqspxEA5AVPQ2FWDRwAzWlLfyr1Q\n uLQWR+dQ=", "X-Gm-Gg": "AZuq6aKBczeaHt9pSNWzrg9uWfXGzvL2n0m20pK7Gg8sdShV4XrUQYGWJqvgRjwIDzq\n /v6fHBr8z0WX3zOe4hpZEDnlfZHYYEgf09i3kqUDR2cQA6GVrUGbQFEvu8PInevLAF7Rc20jz82\n E8pDZStVs1cSecVIYEFFv3Vdiwd44/lYmXB4zfaQTNwxOlJMg1/Or6X1agWRgDg+zSSrECwB/4/\n 9+lX9SGVYuRGREyBu0CiTmAZHOITxHZebLyFPeK3V3bg195r7NojJiPeRHzQ6YrD+e9hlh1+1Ye\n nbWwx05hQrRyEM5ho01rXREjfGxEJnAA3QkytFEhzk6FqDk9R473Iylo5tCk5RE0uquHK3uSVHo\n wSAzi70BvhAZ7Ei1mZ60+WYIkJQe4kW8b5uy810GqdbekbdLy4I5KpMHob58VtLYxh1akfCt3zM\n Bx5TZ4AIcbtActfFNPCMrD5i4C/P5E3AIoLU4=", "X-Received": "by 2002:a05:690e:1409:b0:64a:db17:3ce6 with SMTP id\n 956f58d0204a3-64bbaa18eecmr383640d50.2.1770837576435;\n Wed, 11 Feb 2026 11:19:36 -0800 (PST)", "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>", "To": "libc-alpha@sourceware.org", "Cc": "Sam James <sam@gentoo.org>, Collin Funk <collin.funk1@gmail.com>,\n \"H . J . Lu\" <hjl.tools@gmail.com>", "Subject": "[PATCH 1/5] x86_64: Conditionally define __sfp_handle_exceptions for\n compiler-rt", "Date": "Wed, 11 Feb 2026 15:55:28 -0300", "Message-ID": "<20260211191928.988805-2-adhemerval.zanella@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260211191928.988805-1-adhemerval.zanella@linaro.org>", "References": "<20260211191928.988805-1-adhemerval.zanella@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libc-alpha@sourceware.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>", "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>", "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>", "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>", "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org" }, "content": "The LLVM compiler-rt builtins library does not currently provide an\nimplementation for __sfp_handle_exceptions. On x86_64, this causes\nunresolved symbol errors when building glibc in environments that\nexclude libgcc.\n\nThis patch implements __sfp_handle_exceptions specifically for x86_64,\nbridging the gap for non-GNU compiler runtimes.\n\nThe implementation is used conditionally, only if the compiler does\nnot already provide the symbol.\n\nNB: the implementation is based on libgcc and raises bosh SSE and i387\n exceptions (different that the one from 460ee50de054396cc9791ff4)\n---\n config.h.in | 3 ++\n configure | 82 ++++++++++++++++++++++++++++++++\n configure.ac | 13 +++++\n sysdeps/x86/fpu/Makefile | 5 +-\n sysdeps/x86/fpu/sfp-exceptions.c | 74 ++++++++++++++++++++++++++++\n 5 files changed, 176 insertions(+), 1 deletion(-)\n create mode 100644 sysdeps/x86/fpu/sfp-exceptions.c", "diff": "diff --git a/config.h.in b/config.h.in\nindex 2cd8c90eb6..125532ec6b 100644\n--- a/config.h.in\n+++ b/config.h.in\n@@ -228,6 +228,9 @@\n /* Set to 1 if 64 bit atomics are supported. */\n #undef HAVE_64B_ATOMICS\n \n+/* Define to 1 if compiler runtime provides __sfp_handle_exceptions */\n+#undef HAVE_SFP_HANDLE_EXCEPTIONS\n+\n /*\n \f */\n \ndiff --git a/configure b/configure\nindex 0cd2269859..2b9425232e 100755\n--- a/configure\n+++ b/configure\n@@ -9368,6 +9368,88 @@ printf \"%s\\n\" \"$libc_cv_have_libgcc_s\" >&6; }\n config_vars=\"$config_vars\n have-libgcc_s = $libc_cv_have_libgcc_s\"\n \n+# Check if compiler runtime library provides __sfp_handle_exceptions\n+\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: checking for __sfp_handle_exceptions support\" >&5\n+printf %s \"checking for __sfp_handle_exceptions support... \" >&6; }\n+if test ${libc_cv_sfp_handle_exceptions+y}\n+then :\n+ printf %s \"(cached) \" >&6\n+else case e in #(\n+ e)\n+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n+/* end confdefs.h. */\n+\n+int\n+main (void)\n+{\n+void __sfp_handle_exceptions (int); __sfp_handle_exceptions (0)\n+ ;\n+ return 0;\n+}\n+_ACEOF\n+if ac_fn_c_try_link \"$LINENO\"\n+then :\n+ libc_cv_sfp_handle_exceptions=yes\n+else case e in #(\n+ e) libc_cv_sfp_handle_exceptions=no ;;\n+esac\n+fi\n+rm -f core conftest.err conftest.$ac_objext conftest.beam \\\n+ conftest$ac_exeext conftest.$ac_ext\n+ ;;\n+esac\n+fi\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: result: $libc_cv_sfp_handle_exceptions\" >&5\n+printf \"%s\\n\" \"$libc_cv_sfp_handle_exceptions\" >&6; }\n+if test \"$TEST_CC\" = \"$CC\"; then\n+ libc_cv_test_sfp_handle_exceptions=$libc_cv_sfp_handle_exceptions\n+else\n+\n+saved_CC=\"$CC\"\n+CC=\"$TEST_CC\"\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: checking for __sfp_handle_exceptions support in testing\" >&5\n+printf %s \"checking for __sfp_handle_exceptions support in testing... \" >&6; }\n+if test ${libc_cv_test_sfp_handle_exceptions+y}\n+then :\n+ printf %s \"(cached) \" >&6\n+else case e in #(\n+ e)\n+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n+/* end confdefs.h. */\n+\n+int\n+main (void)\n+{\n+void __sfp_handle_exceptions (int); __sfp_handle_exceptions (0)\n+ ;\n+ return 0;\n+}\n+_ACEOF\n+if ac_fn_c_try_link \"$LINENO\"\n+then :\n+ libc_cv_test_sfp_handle_exceptions=yes\n+else case e in #(\n+ e) libc_cv_test_sfp_handle_exceptions=no ;;\n+esac\n+fi\n+rm -f core conftest.err conftest.$ac_objext conftest.beam \\\n+ conftest$ac_exeext conftest.$ac_ext\n+ ;;\n+esac\n+fi\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_sfp_handle_exceptions\" >&5\n+printf \"%s\\n\" \"$libc_cv_test_sfp_handle_exceptions\" >&6; }\n+\n+CC=\"$saved_CC\"\n+\n+fi\n+\n+if test $libc_cv_sfp_handle_exceptions = yes; then\n+ printf \"%s\\n\" \"#define HAVE_SFP_HANDLE_EXCEPTIONS 1\" >>confdefs.h\n+\n+fi\n+\n # Support configure.ac under sysdeps.\n \n \ndiff --git a/configure.ac b/configure.ac\nindex 3e4a601c01..39d32ecf7f 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -2134,6 +2134,19 @@ AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [d\n LIBS=\"$old_LIBS\"])\n LIBC_CONFIG_VAR([have-libgcc_s], [$libc_cv_have_libgcc_s])\n \n+# Check if compiler runtime library provides __sfp_handle_exceptions\n+LIBC_TRY_CC_AND_TEST_LINK([for __sfp_handle_exceptions support],\n+ [void __sfp_handle_exceptions (int); __sfp_handle_exceptions (0)],\n+ libc_cv_sfp_handle_exceptions,\n+ [libc_cv_sfp_handle_exceptions=yes],\n+ [libc_cv_sfp_handle_exceptions=no],\n+ libc_cv_test_sfp_handle_exceptions,\n+ [libc_cv_test_sfp_handle_exceptions=yes],\n+ [libc_cv_test_sfp_handle_exceptions=no])\n+if test $libc_cv_sfp_handle_exceptions = yes; then\n+ AC_DEFINE([HAVE_SFP_HANDLE_EXCEPTIONS])\n+fi\n+\n # Support configure.ac under sysdeps.\n AC_SUBST(libc_cv_test_cc_mprefer_vector_width)\n AC_SUBST(test_enable_cet)\ndiff --git a/sysdeps/x86/fpu/Makefile b/sysdeps/x86/fpu/Makefile\nindex 91b2444f3a..d847be5c34 100644\n--- a/sysdeps/x86/fpu/Makefile\n+++ b/sysdeps/x86/fpu/Makefile\n@@ -2,7 +2,10 @@ ifeq ($(subdir),math)\n # sqrtf128 requires soft-fp.\n CPPFLAGS += -I../soft-fp\n \n-libm-support += powl_helper\n+libm-support += \\\n+ powl_helper \\\n+ sfp-exceptions \\\n+ # libm-support\n tests += \\\n test-fenv-clear-sse \\\n test-fenv-sse \\\ndiff --git a/sysdeps/x86/fpu/sfp-exceptions.c b/sysdeps/x86/fpu/sfp-exceptions.c\nnew file mode 100644\nindex 0000000000..385294912b\n--- /dev/null\n+++ b/sysdeps/x86/fpu/sfp-exceptions.c\n@@ -0,0 +1,74 @@\n+/* x86_64 soft-fp exception handling for _Float128.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#ifndef HAVE_SFP_HANDLE_EXCEPTIONS\n+#include <fenv.h>\n+#include <float.h>\n+#include <soft-fp.h>\n+\n+#ifdef __SSE_MATH__\n+# define __math_force_eval_div(x, y) \\\n+ do { asm (\"\" : \"+x\" (x)); asm volatile (\"\" : : \"x\" (x / y)); } while (0)\n+#else\n+# define __math_force_eval_div(x, y) \\\n+ do { asm (\"\" : \"+t\" (x)); asm volatile (\"\" : : \"f\" (x / y)); } while (0)\n+#endif\n+\n+void\n+__sfp_handle_exceptions (int _fex)\n+{\n+ fenv_t temp;\n+\n+ if (_fex & FP_EX_INVALID)\n+ {\n+ float f = 0.0f;\n+ __math_force_eval_div (f, f);\n+ }\n+ if (_fex & FP_EX_DENORM)\n+ {\n+ asm volatile (\"fnstenv\\t%0\" : \"=m\" (temp));\n+ temp.__status_word |= FP_EX_DENORM;\n+ asm volatile (\"fldenv\\t%0\" : : \"m\" (temp));\n+ asm volatile (\"fwait\");\n+ }\n+ if (_fex & FP_EX_DIVZERO)\n+ {\n+ float f = 1.0f, g = 0.0f;\n+ __math_force_eval_div (f, g);\n+ }\n+ if (_fex & FP_EX_OVERFLOW)\n+ {\n+ asm volatile (\"fnstenv\\t%0\" : \"=m\" (temp));\n+ temp.__status_word |= FP_EX_OVERFLOW;\n+ asm volatile (\"fldenv\\t%0\" : : \"m\" (temp));\n+ asm volatile (\"fwait\");\n+ }\n+ if (_fex & FP_EX_UNDERFLOW)\n+ {\n+ asm volatile (\"fnstenv\\t%0\" : \"=m\" (temp));\n+ temp.__status_word |= FP_EX_UNDERFLOW;\n+ asm volatile (\"fldenv\\t%0\" : : \"m\" (temp));\n+ asm volatile (\"fwait\");\n+ }\n+ if (_fex & FP_EX_INEXACT)\n+ {\n+ float f = 1.0f, g = 3.0f;\n+ __math_force_eval_div (f, g);\n+ }\n+}\n+#endif\n", "prefixes": [ "1/5" ] }