From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id EF24D395B47D for ; Wed, 16 Nov 2022 17:04:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EF24D395B47D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-x634.google.com with SMTP id kt23so45646588ejc.7 for ; Wed, 16 Nov 2022 09:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1WPnHymVltXYojmsussnDGF3igd9V1e9ZqO78TWPLTE=; b=bCox2m0zvxTyb8cbGtVtkd/YI/3FqJOcUso7b2RqeuN3wvo9YH/KP05/AOpDyR8DKL 6bMFQEChz+o6AIY2S36lAysA/6eNPf/WRPtE8dDAp/F9lTByNDq83s5l5D3igV37kzQQ 8U9uypjb+NKAlrcZIEmPYPnx0TBTI1s2IEIiwcMnYCxIGpVL110T+XVBWZmi8ek2x9CM tehBPYF/o6Nsyy2f9ViAvf43s2MGspWcjw6B2jlX/ceESS/rtgdet1QnlFxNCxhzw5LF VQVRXTpRcoDfUz9BuL9y0yQtYt7ibq/DX4UaK7GtbJQMcTq1v8DPBRfPT0ozSkoCrcXt dzgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1WPnHymVltXYojmsussnDGF3igd9V1e9ZqO78TWPLTE=; b=wVxGr3WWJXpmrsuPDxmU6JJ8MZXWwDMzcIj+iFci9EMhjt+hZ/KRUjQahbACmJZ+0l o7rdZdoptyxNd0K9PClWOhaf8SPpLUszq+ClrvSzh5J/zuDg8eq00I0QB4dQlexb+FuK CNfYir1D7aImf3cfhsvD5eBkp0/Wm69V6wdWjEWmHoF4G78p5Lli6iYOOoIdlqqhB/vw EzeqkSyEoN4gmaWXnvHozGt9+LQYQb2vEI5ORFBogtzA9g4B4ShP8oEzi/tLiJ0oVqpK 0gJkPmmJdDv9P+9B4UqZ5PirbG54BTxSOJKkN0L2d96mp07HX8wlQtvpAecb2Q/AVha/ P18w== X-Gm-Message-State: ANoB5pngPM+PVwJQZr8EaAwT+eT5H7eFOj/DavALa6ZxUDq5qZmaWepm gYWbo3fun4TPNjtbuJWVPOslpkhi03Io9A== X-Google-Smtp-Source: AA0mqf54CoufW9/pKhNV/mDFWW2EVrvK5oJa+YN7aQNMy0D8fVWZeXUbYShklSVKA5SRhBNd8cyyRQ== X-Received: by 2002:a17:907:8b8d:b0:7ae:937f:2c38 with SMTP id tb13-20020a1709078b8d00b007ae937f2c38mr18662218ejc.201.1668618239806; Wed, 16 Nov 2022 09:03:59 -0800 (PST) Received: from [172.31.227.58] ([94.230.145.250]) by smtp.gmail.com with ESMTPSA id ml21-20020a170906cc1500b0078d22b0bcf2sm6984023ejb.168.2022.11.16.09.03.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Nov 2022 09:03:59 -0800 (PST) Message-ID: <22f1fa23-8d3d-dedf-e7fd-2f3a0ecf9928@linaro.org> Date: Wed, 16 Nov 2022 18:03:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: aarch64-pe can't fill 16 bytes in section .text To: Alan Modra Cc: Nick Clifton , binutils@sourceware.org References: <1fc98550-06e7-284e-3f1c-dda991bdd0e5@redhat.com> <584ecd9c-7876-8e2f-4610-8b51cab366b8@linaro.org> Content-Language: en-US From: Zac Walker In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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: Thanks Alan, Do you think my SUB_SEGMENT_ALIGN patch is still needed. I didn't merge it yet because I wanted to do more testing with your fix. Zac --- gas/config/tc-aarch64.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index 2d514ff610..0ea73021f2 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -191,7 +191,10 @@ struct aarch64_frag_type goto LABEL; \ } +/* COFF sub section alignment calculated using the write.c implementation. */ +#ifndef OBJ_COFF #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0 +#endif #define DWARF2_LINE_MIN_INSN_LENGTH 4 -- 2.25.1 On 11/15/22 22:53, Alan Modra wrote: > 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 > >