From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by sourceware.org (Postfix) with ESMTPS id CEF493858D28 for ; Mon, 3 Jul 2023 03:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEF493858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-7672073e7b9so300892385a.0 for ; Sun, 02 Jul 2023 20:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688354596; x=1690946596; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=7v8+xHDdKg50b9lh+6IZK1XEQb8uHb5u9Wlo1jy4qjs=; b=SeXZPvWPlUL+qdXNSK1bWVTx9fffJanc2+wGPGqjbP2aW/Gvq8uyluRMliwlscqftd sahHgGfDlrMikPXzlKVLycRthToWJ9+nawyBuPAGnqoLZrMiddbOBQhKlmQu9A7xfiTF tRlmc3KijFYJzv7gqWV97pAvmf1NLUewZhQM+8o3prY3IOAJNDkqkWuJUsycMlwT71KZ OXRJrdE5XnrVkCG6y/Ct9Rb1byxgj4HU8ZMkN/PiuO7pzGpyuE3mwckELcMWradKmY/Y AdwGfDs9SeRna4JxW8ZkfOa2hWmsK/29JtGK8AcL7LpzosvoOLtNXVyVMqp8yWvexGD1 /GUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688354596; x=1690946596; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7v8+xHDdKg50b9lh+6IZK1XEQb8uHb5u9Wlo1jy4qjs=; b=Bx1vqBw9fcSCGHjB5bVwT4uZhAb+0IzI5ud7VN/sRDUlR6AQV36DoKgXlkrTJaz1zW 1UbQR798mcEomRaeEDe4K5573mLR3jXCYPBcY8R1vEM2Lu3mbWqK3wMVGG22mFvf6W0S VMp5yx8qiGpv/gTt/ONH0u+6Y484bqqu/zlpVccf4rFbArGYatpiomLE8D+/03G32lAe OwlkqHPl+pmG7edmXm80lWvBD+fTjlz6FsN1pQa6V6HyGaU0hyG5hzxPk7nVapvV1IwJ qcASqVcFi32flYi3S2sRQBEx9OH1SfVVYQHsWmZENkVFbVT22vtTDoW1/qhvmUxixnIT 346g== X-Gm-Message-State: AC+VfDxNeJ9NJLQOjL4m0bm+Gw5yHZA7a6EB5bdQ+ARgAoEuSYieTbHm fJmQn0Pohg8/bH9v2o5sVWE482upLliF9gSDst3aLKNnqiE= X-Google-Smtp-Source: ACHHUZ64b6Tn/0NS7LdEVaCN9umAqdmCud6ojY7MX9fdGxnAGT+G8yUKn16ipruMgF2jvzoe8APlTlO6l1gijvNVvj8= X-Received: by 2002:a05:620a:4490:b0:767:4a4:f3cc with SMTP id x16-20020a05620a449000b0076704a4f3ccmr11484766qkp.26.1688354595995; Sun, 02 Jul 2023 20:23:15 -0700 (PDT) MIME-Version: 1.0 From: Julian Waters Date: Mon, 3 Jul 2023 11:22:40 +0800 Message-ID: Subject: Re: [PATCH] Reimplement the .seh_scope directive To: binutils@sourceware.org Content-Type: multipart/alternative; boundary="000000000000f301ba05ff8cafb2" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000f301ba05ff8cafb2 Content-Type: text/plain; charset="UTF-8" A second revision of the patch, with a small bugfix >From 89463e94572a022b55c793d299857f85afadd2ff Mon Sep 17 00:00:00 2001 From: TheShermanTanker Date: Mon, 3 Jul 2023 10:42:18 +0800 Subject: [PATCH] Reimplement the .seh_scope directive --- gas/config/obj-coff-seh.c | 20 ++++++++++++++++++++ gas/config/obj-coff-seh.h | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index 7b4486a..87eed0f 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -388,6 +388,20 @@ obj_coff_seh_handlerdata (int what ATTRIBUTE_UNUSED) switch_xdata (seh_ctx_cur->subsection + 1, seh_ctx_cur->code_seg); } +static void obj_coff_seh_scope (int what) +{ + if (!verify_context_and_target (".seh_scope", seh_kind_x64)) + return; + + segT seg = now_seg; + int subseg = now_subseg; + + seh_ctx_cur->scopes++; + switch_xdata (seh_ctx_cur->subsection + 1, seh_ctx_cur->code_seg); + s_rva (4); + subseg_set(seg, subseg); +} + /* Mark end of current context. */ static void @@ -436,6 +450,8 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED) seh_ctx_cur = XCNEW (seh_context); + seh_ctx_cur->scopes = 0; + seh_ctx_cur->code_seg = now_seg; if (seh_get_target_kind () == seh_kind_x64) @@ -899,6 +915,10 @@ seh_x64_write_function_xdata (seh_context *c) emit_expr (&c->handler, 4); } + if (c->scopes > 0) { + out_four (c->scopes); + } + /* Handler data will be tacked in here by subsections. */ } diff --git a/gas/config/obj-coff-seh.h b/gas/config/obj-coff-seh.h index 8d77bac..7c92921 100644 --- a/gas/config/obj-coff-seh.h +++ b/gas/config/obj-coff-seh.h @@ -57,6 +57,7 @@ .seh_savexmm .seh_pushframe .seh_code + .seh_scope */ /* architecture specific pdata/xdata handling. */ @@ -75,7 +76,8 @@ {"seh_no32", obj_coff_seh_32, 0}, \ {"seh_handler", obj_coff_seh_handler, 0}, \ {"seh_code", obj_coff_seh_code, 0}, \ - {"seh_handlerdata", obj_coff_seh_handlerdata, 0}, + {"seh_handlerdata", obj_coff_seh_handlerdata, 0}, \ + {"seh_scope", obj_coff_seh_scope, 0}, /* Type definitions. */ @@ -128,6 +130,9 @@ typedef struct seh_context int elems_count; int elems_max; seh_prologue_element *elems; + + /* Scope count for x64 .xdata */ + unsigned int scopes; } seh_context; typedef enum seh_kind { @@ -151,6 +156,7 @@ static void obj_coff_seh_proc (int); static void obj_coff_seh_handler (int); static void obj_coff_seh_handlerdata (int); static void obj_coff_seh_code (int); +static void obj_coff_seh_scope (int); #define UNDSEC bfd_und_section_ptr -- 2.35.1.windows.2 --000000000000f301ba05ff8cafb2--