Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215999/?format=api
{ "id": 2215999, "url": "http://patchwork.ozlabs.org/api/patches/2215999/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260325160125.3469231-2-fmzakari@meta.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "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": "<20260325160125.3469231-2-fmzakari@meta.com>", "list_archive_url": null, "date": "2026-03-25T16:01:25", "name": "[1/1] libgcc: Add sdata8 binary search support to _Unwind_Find_FDE", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "892033d9fb3d7271e9ab7caeb8f229e7b3874a45", "submitter": { "id": 92969, "url": "http://patchwork.ozlabs.org/api/people/92969/?format=api", "name": "Farid Zakaria", "email": "fmzakari@meta.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260325160125.3469231-2-fmzakari@meta.com/mbox/", "series": [ { "id": 497470, "url": "http://patchwork.ozlabs.org/api/series/497470/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497470", "date": "2026-03-25T16:01:25", "name": "libgcc: Add sdata8 binary search support to _Unwind_Find_FDE", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497470/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215999/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215999/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=meta.com header.i=@meta.com header.a=rsa-sha256\n header.s=s2048-2025-q2 header.b=Wv46QWiT;\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=meta.com header.i=@meta.com header.a=rsa-sha256\n header.s=s2048-2025-q2 header.b=Wv46QWiT", "sourceware.org;\n dmarc=pass (p=reject dis=none) header.from=meta.com", "sourceware.org; spf=pass smtp.mailfrom=meta.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=67.231.145.42" ], "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 4fgsB31Z3hz1xy3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 03:02:35 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 065A44BB58BB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 16:02:33 +0000 (GMT)", "from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com\n [67.231.145.42])\n by sourceware.org (Postfix) with ESMTPS id 8FB864BA2E2C\n for <gcc-patches@gcc.gnu.org>; Wed, 25 Mar 2026 16:01:39 +0000 (GMT)", "from pps.filterd (m0528007.ppops.net [127.0.0.1])\n by mx0a-00082601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 62PCqkZK1831207\n for <gcc-patches@gcc.gnu.org>; Wed, 25 Mar 2026 09:01:38 -0700", "from mail.thefacebook.com ([163.114.134.16])\n by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 4d41vb27tw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Wed, 25 Mar 2026 09:01:38 -0700 (PDT)", "from localhost (2620:10d:c085:108::150d) by mail.thefacebook.com\n (2620:10d:c08b:78::2ac9) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.35; Wed, 25 Mar\n 2026 16:01:37 +0000" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 065A44BB58BB", "OpenDKIM Filter v2.11.0 sourceware.org 8FB864BA2E2C" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 8FB864BA2E2C", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 8FB864BA2E2C", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774454499; cv=none;\n b=uYg13SetzhzCnCZlFKcHSYG/AaDdcyhEjMydENfDdUtDNNDzv9QbkUA3NdIIoISPdCVoxEKVz4BZIfkqq0Viymg6tBtlZWhIpm3dlJth+LcTaByfumjgYVHeZlv8r8z6vM4BUCUQezQJ6VtnwV992I0CjSigwG2ePIzbl1nLPwA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774454499; c=relaxed/simple;\n bh=R/hjrFi/QaOJlmYXEah68tEr4EeGgg9isY8zLsEOhrw=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=iX7AARmmMHs9+rmjF7g8nu968CvfQLjNDiNR1FO/wQLgRZStfi6xQc9vKMmDLJc0uicDe/YMAUkwzrKri1x76Vlwm9kpE7yLBjKs4BiR2wh6SdEQ5SCy9hQP0HrAHdOISigz1IXhDvJWXmsYgpX00XDRLhyVPaBf67VLtRBnBWw=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc\n :content-transfer-encoding:content-type:date:from:in-reply-to\n :message-id:mime-version:references:subject:to; s=s2048-2025-q2;\n bh=shmV42xFPvU1Zk7T6cUabBdRvCz+YTkfRkcHnTmjmKg=; b=Wv46QWiTie7y\n KNWd7VB+mfs2JjWdhT4uXx+pdzJitfUVShcLZ5wm0rkImI5kK9DWVVkRg9swEWxp\n aaMXmS9+4frEz/pcRcleDIryoz5vQbct2CnRirjlkWatFnUTI2tOBPJ+MQSNg8nb\n tA3ekfvWR47w6WFcYM2+BcU090ZGQyfJGionUDFML/ndrlhUxKvSezcOaPZNvykF\n x0A29xt9WVmK0pbyECOmWDWQEJ5N3i45lXMj6WmkgAWbsCQAJ/k8JKZAVT6hh1U2\n pl1GQP2xy2JfPw2GbGVU1J7rQl2AbYOuRmILsMZFkHnSHooc3jALz/OvFZoUJXeB\n xYW78feSWA==", "From": "Farid Zakaria <fmzakari@meta.com>", "To": "<gcc-patches@gcc.gnu.org>", "CC": "Farid Zakaria <fmzakari@meta.com>", "Subject": "[PATCH 1/1] libgcc: Add sdata8 binary search support to\n _Unwind_Find_FDE", "Date": "Wed, 25 Mar 2026 09:01:25 -0700", "Message-ID": "<20260325160125.3469231-2-fmzakari@meta.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260325160125.3469231-1-fmzakari@meta.com>", "References": "<20260325160125.3469231-1-fmzakari@meta.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[2620:10d:c085:108::150d]", "X-Authority-Analysis": "v=2.4 cv=D8pK6/Rj c=1 sm=1 tr=0 ts=69c406e2 cx=c_pps\n a=CB4LiSf2rd0gKozIdrpkBw==:117 a=CB4LiSf2rd0gKozIdrpkBw==:17\n a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=7x6HtfJdh03M6CCDgxCd:22\n a=4h92JMTCafKA-fb_NiOh:22 a=VabnemYjAAAA:8 a=QVTKVDZU9K70VYf9y7AA:9\n a=gKebqoRLp9LExxC7YDUY:22", "X-Proofpoint-ORIG-GUID": "8uwBHRMuO4kkslIyzXgqx_3efLqTWqH_", "X-Proofpoint-GUID": "8uwBHRMuO4kkslIyzXgqx_3efLqTWqH_", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMzI1MDExNSBTYWx0ZWRfX7+lkk8RNG7+Q\n ZnY0A9ZPMUo0baeoaGWEYDB4K8L2NIdlcMlqWCpopqZLgPGh7PEp7T5GvNltWaEyaLQPg3olCLk\n N2eZ8jANEjG2ZmF2X7owC3XimXR6zhJi6jRAnOuGfYHY5xhfHFT01tcv4HtxmrEvcZ6hWfPWfHR\n qa3WX4we2IeLspohQp9A1i7C/+CMDfp06Ap7YIfS0I71mR47ZGamUOawjMfvVdV1KHTzyPGH4Ky\n tvn1qfeKI5pXccBu1m7y5puSgme+cjaDFP4nR7TrwedQBiti+ZFpMV/z7awKju+M/VAZ7QBqpzn\n jgzdvO+Qrpp71S3Wk+vgKQIMxBf8xCs9+71xcZPlmN0c6VSN5wtigibi9Lio9sgzYx0TVxd2k1C\n hDM9Wg8j+SHVaVxul0iKtC8sesG4I2e4dA2xG6xNLUOFk2i/9ZWTkhi/xZrHc0ZFAzsoYy+HrnR\n +okJs0Xs8/L8fSAJlgA==", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-03-25_04,2026-03-24_01,2025-10-01_01", "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": "The FDE lookup in unwind-dw2-fde-dip.c uses a binary search on the\n.eh_frame_hdr table, but only when the table encoding is\nDW_EH_PE_datarel | DW_EH_PE_sdata4 (8-byte entries). When the\n-large-eh-encoding flag produces DW_EH_PE_datarel | DW_EH_PE_sdata8\n(16-byte entries), the code falls through to linear_search_fdes(),\nregressing FDE lookup from O(log N) to O(N).\n\nAdd support for sdata8 table entries in the binary search path by:\n- Extending the table_enc check to accept DW_EH_PE_sdata8\n- Using a packed union with mode(SI)/mode(DI) fields to read entries\n of either width via TABLE_LOC/TABLE_FDE accessor macros\n- Adjusting the alignment check to use 8-byte alignment for sdata8\n\nlibgcc/ChangeLog:\n\n\t* unwind-dw2-fde-dip.c (find_fde_tail): Support\n\tDW_EH_PE_datarel | DW_EH_PE_sdata8 table encoding in\n\taddition to DW_EH_PE_sdata4 for binary search of\n\t.eh_frame_hdr.\n\nSigned-off-by: Farid Zakaria <fmzakari@meta.com>\n---\n libgcc/unwind-dw2-fde-dip.c | 64 ++++++++++++++++++++++++++++---------\n 1 file changed, 49 insertions(+), 15 deletions(-)", "diff": "diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c\nindex 409fbbf7ef3..488f9b5dd45 100644\n--- a/libgcc/unwind-dw2-fde-dip.c\n+++ b/libgcc/unwind-dw2-fde-dip.c\n@@ -414,11 +414,20 @@ find_fde_tail (_Unwind_Ptr pc,\n \n /* We require here specific table encoding to speed things up.\n Also, DW_EH_PE_datarel here means using PT_GNU_EH_FRAME start\n- as base, not the processor specific DW_EH_PE_datarel. */\n+ as base, not the processor specific DW_EH_PE_datarel.\n+ Both sdata4 (4-byte) and sdata8 (8-byte) table entries are\n+ supported; sdata8 is used by -large-eh-encoding for large\n+ binaries where offsets exceed 2GiB. */\n if (hdr->fde_count_enc != DW_EH_PE_omit\n- && hdr->table_enc == (DW_EH_PE_datarel | DW_EH_PE_sdata4))\n+ && (hdr->table_enc == (DW_EH_PE_datarel | DW_EH_PE_sdata4)\n+\t || hdr->table_enc == (DW_EH_PE_datarel | DW_EH_PE_sdata8)))\n {\n _Unwind_Ptr fde_count;\n+ const int is_sdata8\n+\t= (hdr->table_enc == (DW_EH_PE_datarel | DW_EH_PE_sdata8));\n+ const size_t entry_size = is_sdata8 ? 16 : 8;\n+ const size_t field_size = is_sdata8 ? 8 : 4;\n+ const unsigned int align_mask = is_sdata8 ? 7 : 3;\n \n if (__builtin_expect (hdr->fde_count_enc == DW_EH_PE_udata4, 1))\n \t{\n@@ -437,23 +446,45 @@ find_fde_tail (_Unwind_Ptr pc,\n /* Shouldn't happen. */\n if (fde_count == 0)\n \treturn NULL;\n- if ((((_Unwind_Ptr) p) & 3) == 0)\n+ if ((((_Unwind_Ptr) p) & align_mask) == 0)\n \t{\n-\t struct fde_table {\n-\t signed initial_loc __attribute__ ((mode (SI)));\n-\t signed fde __attribute__ ((mode (SI)));\n-\t };\n-\t const struct fde_table *table = (const struct fde_table *) p;\n+\t const unsigned char *table = p;\n \t size_t lo, hi, mid;\n \t _Unwind_Ptr data_base = (_Unwind_Ptr) hdr;\n \t fde *f;\n \t unsigned int f_enc, f_enc_size;\n \t _Unwind_Ptr range;\n \n+\t /* Read a signed field from the table. For sdata4 entries\n+\t these are mode (SI) (32-bit); for sdata8, mode (DI) (64-bit).\n+\t Use the packed unaligned union from unwind-pe.h types. */\n+\t union table_entry {\n+\t signed s4 __attribute__ ((mode (SI)));\n+\t signed s8 __attribute__ ((mode (DI)));\n+\t } __attribute__ ((__packed__));\n+\n+\t /* Read the initial_loc field at a given table index. */\n+#define TABLE_LOC(i)\t\t\t\t\t\t\\\n+\t (is_sdata8\t\t\t\t\t\t\\\n+\t ? (_Unwind_Ptr) ((const union table_entry *)\t\t\\\n+\t\t\t (table + (i) * entry_size))->s8\t\\\n+\t : (_Unwind_Ptr) ((const union table_entry *)\t\t\\\n+\t\t\t (table + (i) * entry_size))->s4)\n+\n+\t /* Read the fde field at a given table index. */\n+#define TABLE_FDE(i)\t\t\t\t\t\t\\\n+\t (is_sdata8\t\t\t\t\t\t\\\n+\t ? (_Unwind_Ptr) ((const union table_entry *)\t\t\\\n+\t\t\t (table + (i) * entry_size\t\t\\\n+\t\t\t + field_size))->s8\t\t\t\\\n+\t : (_Unwind_Ptr) ((const union table_entry *)\t\t\\\n+\t\t\t (table + (i) * entry_size\t\t\\\n+\t\t\t + field_size))->s4)\n+\n \t mid = fde_count - 1;\n-\t if (pc < table[0].initial_loc + data_base)\n+\t if (pc < TABLE_LOC (0) + data_base)\n \t return NULL;\n-\t else if (pc < table[mid].initial_loc + data_base)\n+\t else if (pc < TABLE_LOC (mid) + data_base)\n \t {\n \t lo = 0;\n \t hi = mid;\n@@ -461,9 +492,9 @@ find_fde_tail (_Unwind_Ptr pc,\n \t while (lo < hi)\n \t\t{\n \t\t mid = (lo + hi) / 2;\n-\t\t if (pc < table[mid].initial_loc + data_base)\n+\t\t if (pc < TABLE_LOC (mid) + data_base)\n \t\t hi = mid;\n-\t\t else if (pc >= table[mid + 1].initial_loc + data_base)\n+\t\t else if (pc >= TABLE_LOC (mid + 1) + data_base)\n \t\t lo = mid + 1;\n \t\t else\n \t\t break;\n@@ -472,7 +503,7 @@ find_fde_tail (_Unwind_Ptr pc,\n \t gcc_assert (lo < hi);\n \t }\n \n-\t f = (fde *) (table[mid].fde + data_base);\n+\t f = (fde *) (TABLE_FDE (mid) + data_base);\n \t f_enc = get_fde_encoding (f);\n \t f_enc_size = size_of_encoded_value (f_enc);\n \n@@ -494,8 +525,8 @@ find_fde_tail (_Unwind_Ptr pc,\n #endif\n \t read_encoded_value_with_base (f_enc & 0x0f, 0,\n \t\t\t\t\t &f->pc_begin[f_enc_size], &range);\n-\t _Unwind_Ptr func = table[mid].initial_loc + data_base;\n-\t if (pc < table[mid].initial_loc + data_base + range)\n+\t _Unwind_Ptr func = TABLE_LOC (mid) + data_base;\n+\t if (pc < TABLE_LOC (mid) + data_base + range)\n \t {\n \t bases->tbase = NULL;\n \t bases->dbase = (void *) dbase;\n@@ -504,6 +535,9 @@ find_fde_tail (_Unwind_Ptr pc,\n \t }\n \t else\n \t return NULL;\n+\n+#undef TABLE_LOC\n+#undef TABLE_FDE\n \t}\n }\n \n", "prefixes": [ "1/1" ] }