From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 08159393BA76 for ; Tue, 15 Nov 2022 21:53:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 08159393BA76 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-pj1-x102d.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so327669pjd.4 for ; Tue, 15 Nov 2022 13:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Uo2AH0ytPWjBViMnw4JumqZdycq4fSoqNhsvpjIhLYM=; b=PwK9rzD5YOUWBtyRHPK6jAGznyb/DRfxsI9c4JGGMDvOPju8Kprbha5096wQwdG6Rl u3RsLFAfEzQHue/Xn+/PWPJzh43VjKm89fczXcuL2Fn2+V7z/P9UlfXEeJmAJrxDaq3O HI9AbVHSNDT3lx95W7jzcdIpjQqx4Ay+aGs69X5S9ef06CITYikbUdKgCc9GDvcCIvrA NNegf3rY9DWtEN2qaj/VzGVxW4+olxnD5bksjuWAz4rcCu2E3mewjbvfURI3+thIFI7a TU38miYWh7jT7sA8EAIvED9jAoEDodY/H0ENs0Pe/foAICT/R9P3qq6YbbEUONBpKI96 /O4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Uo2AH0ytPWjBViMnw4JumqZdycq4fSoqNhsvpjIhLYM=; b=Y6dTABtZMELJeSDP/y5hbEDiJoMxKSthrlsvh/qkrHStIyDRe0rSlKhEQWvVxFNcSB Be7J0V4rdA2QWW6kjmITE94ddpNwUGKF2byT351eRcoDfWrD0MtumQKuI8rnyxErJRr3 4oandAFvMc55xy3hFK+8ZAWTXweAHam4gq74tMWooaod7fxexJrrB9TPFwIiJUVSJR+W m2JSASAERxCc5x76p2Fde7FVOSTCyujXCQvePhzlh6fgpXfAtuLlDfOEDyC4J9OYYAUk Y0yFOZImT30A659nwWT4NCSu8pOzvgCus8oZFVUD5LktOw5o1mTL1N08+zlwcsMPUu+Y jzQg== X-Gm-Message-State: ANoB5pnYgz0uyDpwqlzd7fhm03ULCIGRUNAT/R3n/q0bld8L//anf528 zz7GlFFeE51M5VTPV5i1JC8= X-Google-Smtp-Source: AA0mqf4CyWSRz7RVOMZuwmWfTAnFbxdnAlZiBF4ztFNGNvRXx+cs1IKW6B0i4LaNsgORagVe77v8og== X-Received: by 2002:a17:902:f60d:b0:186:6019:d49d with SMTP id n13-20020a170902f60d00b001866019d49dmr5853791plg.140.1668549206031; Tue, 15 Nov 2022 13:53:26 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:68c9:a23e:cf1b:b0be]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e5d000b00186fb8f931asm10501373plf.206.2022.11.15.13.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 13:53:25 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 1B43B1142DD4; Wed, 16 Nov 2022 08:23:23 +1030 (ACDT) Date: Wed, 16 Nov 2022 08:23:23 +1030 From: Alan Modra To: Zac Walker Cc: Nick Clifton , binutils@sourceware.org Subject: aarch64-pe can't fill 16 bytes in section .text Message-ID: References: <1fc98550-06e7-284e-3f1c-dda991bdd0e5@redhat.com> <584ecd9c-7876-8e2f-4610-8b51cab366b8@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <584ecd9c-7876-8e2f-4610-8b51cab366b8@linaro.org> X-Spam-Status: No, score=-3035.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: I'm going to fix the underlying coff_frob_section problem too. Without commit b66e671854, this: .p2align 4 nop .p2align 3 nop results in an error when coff_frob_section attempts to pad out the section to a 16-byte boundary. Due to miscalculating the pad pattern repeat count, write.c:write_contents attempts to shove 16 bytes of padding into the remaining 4 bytes of the .text section. * config/obj-coff.c (coff_frob_section): Correct fill count. Don't pad after errors. diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 98c39e43907..9be697fb62e 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -1725,7 +1725,8 @@ coff_frob_section (segT sec) bfd_vma align_power = (bfd_vma) sec->alignment_power + OCTETS_PER_BYTE_POWER; bfd_vma mask = ((bfd_vma) 1 << align_power) - 1; - if (size & mask) + if (!do_not_pad_sections_to_alignment + && (size & mask) != 0) { bfd_vma new_size; fragS *last; @@ -1740,7 +1741,10 @@ coff_frob_section (segT sec) while (fragp->fr_next != last) fragp = fragp->fr_next; last->fr_address = size; - fragp->fr_offset += new_size - size; + if ((new_size - size) % fragp->fr_var == 0) + fragp->fr_offset += (new_size - size) / fragp->fr_var; + else + abort (); } #endif -- Alan Modra Australia Development Lab, IBM