Message ID | CACVBkZ+kM2xcpwk5zHQ4bqDV7dbPjZ6cMU9tR-h62+tDTgi3Tw@mail.gmail.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2200613wru; Mon, 7 Nov 2022 09:53:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM45R4lDnGlcvV3bOP/F0a1YECzbO9VWhhduf/tAbD0iMZ1pUf0f4MiqcUXOGgzR4n4hD7TP X-Received: by 2002:aa7:c6c8:0:b0:460:e19b:ec12 with SMTP id b8-20020aa7c6c8000000b00460e19bec12mr51549815eds.209.1667843638443; Mon, 07 Nov 2022 09:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843638; cv=none; d=google.com; s=arc-20160816; b=JEQc5Db6nJZfS8kdKQWXsIQzsmqfwohTsrlsqkufjR7MBJ0ndEqjBOuxnlWFOeKGXE 8jem07dH/iLZtoTJQqK6AEUAxT+QbUz2N0KE+s5alhTXPmGF3JMX2bohArGRvanGBx7G NuFgiWz5LXlqGVwQlSeCPIoxNlbQO9cwTnmBmUIVlsDz86K3OxD4XZuA/IAgqR/fyFeW UinFhWC42pgRPQovMjInyB+TXipGyThgmua05SXBSHZqbe0CpIVXAA9Xvv9XGSraOZdI QY1a6uz7Z0CXY1eVrylugRtpTrK6YfROnxYIhRLt0R8Y9FzqaWEPFOQ2l+Q8sUZTc564 hi1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=3N3e+IxKCevM2ZnwhFNENTG3y77hS9NZwXvrfmFUCn4=; b=bPWA3uKFR4uD5Zv7VyGWW86z2hxp343m2uCC0ywR+bVrp8q5I0bJQEmygJghsJ56U0 w4VfyVU9S7hLeRkqU+uVrpYl3VnIW6prdQCTs4EO/YWYme/bv79R+DUMoZPKdDw2RSbX rPemvs/TiKHQn6AYy9RiNozsV+8vIigisAMEXFMQ+x8gkq7ze7IO0zDhRIpIXk6HRvx8 lAvA4XzyI2edzcw7uxDZTrchBmo4hlgxwvgKmU8a+I1k7m6nsaCk+tdzDlWmF1IKBKF6 zYW9iPcyFEHRmf6mjHJMih4F8TxSy5ugpEI63prHDjXqHKIj9vCqz9bfliqcURATMgBz Y6Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=pSiWAkF4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ht11-20020a170907608b00b00777be437681si10671119ejc.984.2022.11.07.09.53.58 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 09:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=pSiWAkF4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8188C3858403 for <ouuuleilei@gmail.com>; Mon, 7 Nov 2022 17:53:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8188C3858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667843637; bh=3N3e+IxKCevM2ZnwhFNENTG3y77hS9NZwXvrfmFUCn4=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pSiWAkF4yoH73v4bsvQ/Wq7V5xG6qKRZ/CucwgkkILPJFHC7Jddjo5bXIn1CZTl4Z jMCm9LUGnTD4ugDAtoitO7T+fyaq1wNcRseyOXVZyBQI+q8ulc4oVB4VyvpMqamt1o UmPATVmKBzNHaWO1dnt/rZSOlBO1/3kjpggH9+8k= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by sourceware.org (Postfix) with ESMTPS id CBC603858D26 for <binutils@sourceware.org>; Mon, 7 Nov 2022 17:53:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CBC603858D26 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-13ba86b5ac0so13545994fac.1 for <binutils@sourceware.org>; Mon, 07 Nov 2022 09:53:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3N3e+IxKCevM2ZnwhFNENTG3y77hS9NZwXvrfmFUCn4=; b=dbosrCpvS0smsc2CQFJSk3A73VJxD46oN7Y27CcRzJpKrn53B60xuE4TqZ+WiGa71P tb5Si2icL128TP4A1qAweCM5A/o/br3cY6izp3rJ0JV9Kqx2UYIZZYtA8xKnMivhJ/Kl 2/AmHUQxZ6nNsUB1Qx8gCxxyuJjNtmj3ONlLnhfX57dK4FxP/ShXqJm2KUzLnpI3zE1i 110ogRosjSl4PQon8GZVVZyg/XDTqKPMXRLYk+7Jv6bLfRyvN/I7JFybUAT9ioly7Vz5 Y4xX7VeRr1/48Cz6OF847f3YUL16zyCNfVWTvYGMy4twiNowLTjb2X+S7Pi0egO+GcTj lrAw== X-Gm-Message-State: ACrzQf1MH8PCh51ddINBfgpWDZ9AfSQ/PWDaIiJvxBov5ctQCz0xMgVr x2rLCwulgeLLTxjEvjJBPnyWIP+0718e4a9XVjOiuLY0+HhF0Q== X-Received: by 2002:a05:6870:f627:b0:13b:b20d:5c6d with SMTP id ek39-20020a056870f62700b0013bb20d5c6dmr580210oab.250.1667843626913; Mon, 07 Nov 2022 09:53:46 -0800 (PST) MIME-Version: 1.0 Date: Mon, 7 Nov 2022 18:53:35 +0100 Message-ID: <CACVBkZ+kM2xcpwk5zHQ4bqDV7dbPjZ6cMU9tR-h62+tDTgi3Tw@mail.gmail.com> Subject: [PATCH] GAS fix section alignment for aarch64-pe To: binutils@sourceware.org Content-Type: multipart/mixed; boundary="000000000000ec766a05ece51a94" X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Zac Walker via Binutils <binutils@sourceware.org> Reply-To: Zac Walker <zac.walker@linaro.org> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748860811332397470?= X-GMAIL-MSGID: =?utf-8?q?1748860811332397470?= |
Series |
GAS fix section alignment for aarch64-pe
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | warning | Git am fail log |
Commit Message
Zac Walker
Nov. 7, 2022, 5:53 p.m. UTC
For the aarch64-pe target, section alignment for various values of '.align' causes writing of coff files to fail. This patch performs aligning in md_section_align as opposed to the original approach in aarch64_handle_align. The change is specific to the aarch64-pe target. Thanks, Zac --- gas/config/tc-aarch64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) of an rs_align_code fragment. @@ -8353,7 +8362,11 @@ aarch64_handle_align (fragS * fragP) if (noop_size) memcpy (p, aarch64_noop, noop_size); + +/* COFF sections may have unaligned fr_var and then be aligned in md_section_align */ +#ifndef OBJ_COFF fragP->fr_var = noop_size; +#endif } /* Perform target specific initialisation of a frag.
Comments
On Mon, Nov 07, 2022 at 06:53:35PM +0100, Zac Walker via Binutils wrote: > For the aarch64-pe target, section alignment for various values of > '.align' causes writing of coff files to fail. > This patch performs aligning in md_section_align as opposed to the > original approach in aarch64_handle_align. The change is specific to > the aarch64-pe target. This can't be correct since HANDLE_ALIGN and md_section_align perform quite different functions. I don't think you should be changing aarch64_handle_align. For example: .text .p2align 4 nop .p2align 3 nop The second p2align needs to continue emitting nops. (Also, please fix your email client to *not* format lines. Wrapping lines and changing white space breaks patches.)
Hi Alan, Thanks for the feedback. You are correct - looks like I was over-focused on getting the write method working for various failing tests. Your example is useful to show missing noops. From what I can see the changes to md_section_align seem necessary for COFF but unrelated to the write issue. (Assuming the fix is HANDLE_ALIGN specific.) I will re-work the patch and do more testing. Might take a few days. Also, I will double check my email settings. Every email client I have tried (except git send-email) seems to break formatting one way or another. Cheers, Zac -----Original Message----- From: Alan Modra <amodra@gmail.com> Sent: 07 November 2022 23:58 To: Zac Walker <zac.walker@linaro.org> Cc: binutils@sourceware.org Subject: Re: [PATCH] GAS fix section alignment for aarch64-pe On Mon, Nov 07, 2022 at 06:53:35PM +0100, Zac Walker via Binutils wrote: > For the aarch64-pe target, section alignment for various values of > '.align' causes writing of coff files to fail. > This patch performs aligning in md_section_align as opposed to the > original approach in aarch64_handle_align. The change is specific to > the aarch64-pe target. This can't be correct since HANDLE_ALIGN and md_section_align perform quite different functions. I don't think you should be changing aarch64_handle_align. For example: .text .p2align 4 nop .p2align 3 nop The second p2align needs to continue emitting nops. (Also, please fix your email client to *not* format lines. Wrapping lines and changing white space breaks patches.) -- Alan Modra Australia Development Lab, IBM
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index f6fa158583..44ad510209 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -8290,13 +8290,22 @@ md_estimate_size_before_relax (fragS * fragp, segT segtype ATTRIBUTE_UNUSED) return 4; } -/* Round up a section size to the appropriate boundary. */ - +/* Round up a COFF section size not needed for ELF */ +#ifdef OBJ_COFF +valueT +md_section_align (segT segment, valueT size) +{ + int align = bfd_section_alignment (segment); + valueT mask = ((valueT) 1 << align) - 1; + return (size + mask) & ~mask; +} +#else /* !OBJ_COFF */ valueT md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) { return size; } +#endif /* !OBJ_COFF */ /* This is called from HANDLE_ALIGN in write.c. Fill in the contents