From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by sourceware.org (Postfix) with ESMTPS id 36D22398AC2D for ; Sat, 17 Dec 2022 16:13:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 36D22398AC2D 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-yw1-x1133.google.com with SMTP id 00721157ae682-3c090251d59so74059097b3.4 for ; Sat, 17 Dec 2022 08:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vuM7Ek4J7piUAY4pukZ5PjjugNsOIEPtUM1xGK/d+1s=; b=KKsTu8Lo4PGUMEyoK+X998/IXiaG2w2XH476ZVslSDbqwswtXT/RkfleG+7mda1nXM rFEq6qea4dFZaXZaJyog0ncfLBr5rMQSqihfV8KYq9eUyWPROL2ckzSovEtiT+stYWn+ VuNEu+YaiSW9vpwiiOQGJREmcTRfIESdArzKXUUryKqsrEnKuKyxsstjkTEimlrRrsDN qczpcewZucQEGiS+Q8X8i8hnfc5A82ChS5dZk4QLqFNEqVLlppv+PjEFsq7WXwZb5cL2 uiQlpUfq0GOQPokNTsmER6wcPKDwNmLchLpnEa+iDDVJKQ9oORnGV2joHzehGdgUFcYA uUuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vuM7Ek4J7piUAY4pukZ5PjjugNsOIEPtUM1xGK/d+1s=; b=GrY4bVUiCZpBzoO/KJNMtsptadp5DcwRdvMXcOQSJkMHmT1hL5OEBpc+Zu5Rs5vRZi m6X1aro+xkH4Bp5bWZlvVMyb2XDwFFPDFDCWsZBv0LiLYWxsK9vgL4vXaATbfrNe5/KS 1KAQUUDrum1chmq19heIErnU84nTlSiXv5nNCp+FByznlIxaouVnrvFLMjuxMxvNSgvd ooIlvmMrJw0w2USwtvcpx60X/ta2oaZxbcbiQGBXlF6UB7uU5K5XigaTOg5hwLF5M9GX sQ/Zf0H5Cz6QvT69yO6xe8XZVicb+Z/UyBB5IwkZgk7y7l9En5QILwTyddTIkDkUiJIp 6sPg== X-Gm-Message-State: ANoB5pnmTadwm8op4ZMkfGAzN2/DmZ5Z0SyYK6AShVCr2vEIvVFU3DnD GCc23pu+qNAxwGEUOz9k24RIGm5LzlX6b8HDHl4= X-Google-Smtp-Source: AA0mqf6OFCzR4IptX9jS6clStrSgRfbO024g7VwX2C+qpy/a9Zp8ScQPzIgRcMACRAzjdISDulLOSteJYn9nDlkaPPk= X-Received: by 2002:a81:6fd5:0:b0:402:3dcf:a262 with SMTP id k204-20020a816fd5000000b004023dcfa262mr7519363ywc.31.1671293614578; Sat, 17 Dec 2022 08:13:34 -0800 (PST) MIME-Version: 1.0 References: <20221217102842.3645997-1-torbjorn.svensson@foss.st.com> In-Reply-To: <20221217102842.3645997-1-torbjorn.svensson@foss.st.com> From: Christophe Lyon Date: Sat, 17 Dec 2022 17:13:23 +0100 Message-ID: Subject: Re: [PATCH] bfd: Discard region regardless of warning flag To: =?UTF-8?Q?Torbj=C3=B6rn_SVENSSON?= Cc: binutils@sourceware.org, christophe.lyon@arm.com Content-Type: multipart/alternative; boundary="0000000000003660bd05f0085ea7" X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,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: --0000000000003660bd05f0085ea7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Torbj=C3=B6rn, On Sat, Dec 17, 2022 at 11:29 AM Torbj=C3=B6rn SVENSSON via Binutils < binutils@sourceware.org> wrote: > The discard of the region should be performed regardless if the warning > for the discard is enabled or not. > Without this patch, ld would segfault in bfd_section_removed_from_list, > called in the if-statement right after this block, as the argument > isec->output_section can be NULL. > > Signed-off-by: Torbj=C3=B6rn SVENSSON > --- > bfd/elflink.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/bfd/elflink.c b/bfd/elflink.c > index fc3edef9a05..0368256970b 100644 > --- a/bfd/elflink.c > +++ b/bfd/elflink.c > @@ -11154,12 +11154,12 @@ elf_link_input_bfd (struct elf_final_link_info > *flinfo, bfd *input_bfd) > if (isym->st_shndx !=3D SHN_UNDEF > && isym->st_shndx < SHN_LORESERVE > && isec->output_section =3D=3D NULL > - && flinfo->info->non_contiguous_regions > - && flinfo->info->non_contiguous_regions_warnings) > + && flinfo->info->non_contiguous_regions) > { > - _bfd_error_handler (_("warning: --enable-non-contiguous-regions= " > - "discards section `%s' from '%s'\n"), > - isec->name, bfd_get_filename (isec->owner)); > + if (flinfo->info->non_contiguous_regions_warnings) > + _bfd_error_handler (_("warning: > --enable-non-contiguous-regions " > + "discards section `%s' from '%s'\n"), > + isec->name, bfd_get_filename > (isec->owner)); > continue; > } > > Thanks for catching this, it makes sense indeed. Any change you can add a testcase? Best, Christophe > -- > 2.25.1 > > --0000000000003660bd05f0085ea7--