{"id":2224920,"url":"http://patchwork.ozlabs.org/api/patches/2224920/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260419144605.548984-1-ibuclaw@gdcproject.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260419144605.548984-1-ibuclaw@gdcproject.org>","list_archive_url":null,"date":"2026-04-19T14:46:05","name":"[committed] d: Implement @attribute(\"no_split_stack\")","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"302297beef1be5a4d2ace2ebcf3f609ff3cc4bc1","submitter":{"id":46728,"url":"http://patchwork.ozlabs.org/api/people/46728/?format=json","name":"Iain Buclaw","email":"ibuclaw@gdcproject.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260419144605.548984-1-ibuclaw@gdcproject.org/mbox/","series":[{"id":500510,"url":"http://patchwork.ozlabs.org/api/series/500510/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500510","date":"2026-04-19T14:46:05","name":"[committed] d: Implement @attribute(\"no_split_stack\")","version":1,"mbox":"http://patchwork.ozlabs.org/series/500510/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224920/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224920/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gdcproject.org header.i=@gdcproject.org\n header.a=rsa-sha256 header.s=MBO0001 header.b=IGY3BqSc;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gdcproject.org header.i=@gdcproject.org\n header.a=rsa-sha256 header.s=MBO0001 header.b=IGY3BqSc","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=gdcproject.org","sourceware.org; spf=pass smtp.mailfrom=gdcproject.org","server2.sourceware.org;\n arc=none smtp.remote-ip=80.241.56.171"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fzBK06zdpz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 00:46:43 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 59B0A4BA2E35\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 14:46:41 +0000 (GMT)","from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171])\n by sourceware.org (Postfix) with ESMTPS id 7E4444BA23FE\n for <gcc-patches@gcc.gnu.org>; Sun, 19 Apr 2026 14:46:14 +0000 (GMT)","from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4fzBJK4W7Kz9v52;\n Sun, 19 Apr 2026 16:46:09 +0200 (CEST)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 59B0A4BA2E35","OpenDKIM Filter v2.11.0 sourceware.org 7E4444BA23FE"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 7E4444BA23FE","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 7E4444BA23FE","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776609974; cv=none;\n b=xkk5exMwT8jMGdtNPpE7vDl674CVFru0JsHKvi5FhA9U1D32bpd3GD1B/Jlcz+3RJs2nJwpUiaoY289EGLGcTrLLx3V7gWYNFtTomUsrUCMTmQSAVapsV7ddcTP83zuKyxq0H9L8a0OhU7KUa7IuPPsTm5OVAyAnLd4zHf0GnmQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776609974; c=relaxed/simple;\n bh=GSJDYtDwCPVglmL5U3DODzHOinw9W+62c/SCnJAeucY=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=aN9OJRnY8Z/OfTANFPwR1TeQzn0YERD4/h9UU/bDE9UbziMlgZ2Lp6Q0BWhOSB83E/qZjUBAsIZlcdlDv1eyrlJ9zlB+8ioncd7zIy+QDsD/1PsGmGGyljm5P4mhdCVv089dKU3MN9iKkYAsq/opMNi7Zhb1vK0coRl8b9wHBXI=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gdcproject.org;\n s=MBO0001; t=1776609969;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=UReyzKC7eOmNwMRyU/Xzhbb+s7qKTxaLi6VOJwtyZcI=;\n b=IGY3BqScATCNxzTvNsLd8D58Gd70NBtGEUOB4Q5Nd9KY5ZVw6yZG9wMKV5G4aSCJ8WFJ8L\n Hw9VhH7LeoB1LUTzdI/TKUwke5Esc/xyj/PXOAEdqglJ9Ol3srliMV9zaQ3ZVHgQ9F896P\n DyzxQp8ghcd6ZKgoNQHHqaUCf5+hcLRXQaBwVQRLG0TvgyaiZBZ8tQ/Jb8+njrWoF8dcMG\n Sw+ijjysEYuqwaSTsLhZM+dx2Qsr95kz0rcKNdVj/TxvXcjjX3QoG2+wbqGY86quArvj8s\n 6NuNZ7FBJWRbNbpON6uj6wYQLY8811Nt65yUEVaAMsX8xtgIq0ppdzdNKfcRyQ==","From":"Iain Buclaw <ibuclaw@gdcproject.org>","To":"gcc-patches@gcc.gnu.org","Cc":"Iain Buclaw <ibuclaw@gdcproject.org>","Subject":"[committed][PATCH] d: Implement @attribute(\"no_split_stack\")","Date":"Sun, 19 Apr 2026 16:46:05 +0200","Message-ID":"<20260419144605.548984-1-ibuclaw@gdcproject.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Hi,\n\nThis patch adds handler for @gcc.attributes.attribute(\"no_split_stack\")\nand the UDA @gcc.attributes.noSplitStack for compatibility with LDC.\n\nBootstrapped and regtested on x86_64-linux-gnu, committed to mainline.\n\nRegards,\nIain.\n\n--\ngcc/d/ChangeLog:\n\n\t* d-attribs.cc (d_langhook_gnu_attributes): Add no_split_stack\n\tattribute.\n\t(d_handle_no_split_stack_attribute): New function.\n\nlibphobos/ChangeLog:\n\n\t* libdruntime/gcc/attributes.d (noSplitStack): New UDA.\n\ngcc/testsuite/ChangeLog:\n\n\t* gdc.dg/attr_no_split_stack.d: New test.\n---\n gcc/d/d-attribs.cc                         | 20 ++++++++++++++++++++\n gcc/testsuite/gdc.dg/attr_no_split_stack.d | 21 +++++++++++++++++++++\n libphobos/libdruntime/gcc/attributes.d     | 13 +++++++++++++\n 3 files changed, 54 insertions(+)\n create mode 100644 gcc/testsuite/gdc.dg/attr_no_split_stack.d","diff":"diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc\nindex 1e7493e4d03..3f748b7bef3 100644\n--- a/gcc/d/d-attribs.cc\n+++ b/gcc/d/d-attribs.cc\n@@ -81,6 +81,7 @@ static tree d_handle_restrict_attribute (tree *, tree, tree, int, bool *);\n static tree d_handle_used_attribute (tree *, tree, tree, int, bool *);\n static tree d_handle_visibility_attribute (tree *, tree, tree, int, bool *);\n static tree d_handle_no_sanitize_attribute (tree *, tree, tree, int, bool *);\n+static tree d_handle_no_split_stack_attribute (tree *, tree, tree, int, bool *);\n static tree d_handle_simd_attribute (tree *, tree, tree, int, bool *);\n \n /* Helper to define attribute exclusions.  */\n@@ -234,6 +235,8 @@ static const attribute_spec d_langhook_gnu_attributes[] =\n \t     d_handle_cold_attribute, attr_cold_hot_exclusions),\n   ATTR_SPEC (\"no_sanitize\", 1, -1, true, false, false, false,\n \t     d_handle_no_sanitize_attribute, NULL),\n+  ATTR_SPEC (\"no_split_stack\", 0, 0, true, false, false, false,\n+\t     d_handle_no_split_stack_attribute, NULL),\n   ATTR_SPEC (\"register\", 1, 1, true, false, false, false,\n \t     d_handle_register_attribute, NULL),\n   ATTR_SPEC (\"restrict\", 0, 0, true, false, false, false,\n@@ -1441,6 +1444,23 @@ d_handle_no_sanitize_attribute (tree *node, tree name, tree args, int,\n   return NULL_TREE;\n }\n \n+/* Handle a \"no_split_stack\" attribute; arguments as in\n+   struct attribute_spec.handler.  */\n+\n+static tree\n+d_handle_no_split_stack_attribute (tree *node, tree name, tree, int,\n+\t\t\t\t   bool *no_add_attrs)\n+{\n+  if (TREE_CODE (*node) != FUNCTION_DECL)\n+    {\n+      error_at (DECL_SOURCE_LOCATION (*node),\n+\t\t\"%qE attribute applies only to functions\", name);\n+      *no_add_attrs = true;\n+    }\n+\n+  return NULL_TREE;\n+}\n+\n /* Handle a \"register\" attribute; arguments as in\n    struct attribute_spec.handler.  */\n \ndiff --git a/gcc/testsuite/gdc.dg/attr_no_split_stack.d b/gcc/testsuite/gdc.dg/attr_no_split_stack.d\nnew file mode 100644\nindex 00000000000..48f9d8dc402\n--- /dev/null\n+++ b/gcc/testsuite/gdc.dg/attr_no_split_stack.d\n@@ -0,0 +1,21 @@\n+// { dg-do compile }\n+// { dg-require-effective-target split_stack }\n+// { dg-options \"-fsplit-stack -fno-moduleinfo\" }\n+\n+import gcc.attributes;\n+\n+void use(ref int[100]);\n+\n+void split()\n+{\n+    int[100] arr;\n+    use(arr);\n+}\n+\n+@attribute(\"no_split_stack\")\n+void nosplit()\n+{\n+    int[100] arr;\n+    use(arr);\n+}\n+// { dg-final { scan-assembler-times \"__morestack\" 1 } }\ndiff --git a/libphobos/libdruntime/gcc/attributes.d b/libphobos/libdruntime/gcc/attributes.d\nindex 30fc9feb47d..a69cb904009 100644\n--- a/libphobos/libdruntime/gcc/attributes.d\n+++ b/libphobos/libdruntime/gcc/attributes.d\n@@ -697,6 +697,19 @@ enum naked = attribute(\"naked\");\n  */\n alias noSanitize = no_sanitize;\n \n+/**\n+ * Disables split-stack instrumentation for this function, overriding the\n+ * `-fsplit-stack` commandline function.\n+ *\n+ * Examples:\n+ * ---\n+ * import gcc.attributes;\n+ *\n+ * @noSplitStack int user_function() { return 1; }\n+ * ---\n+ */\n+enum noSplitStack = attribute(\"no_split_stack\");\n+\n /**\n  * Sets the optimization strategy for a function.\n  * Valid strategies are \"none\", \"optsize\", \"minsize\". The strategies are\n","prefixes":["committed"]}