From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 77B2639428DB for ; Sat, 17 Dec 2022 10:29:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77B2639428DB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BH1NgO9000708; Sat, 17 Dec 2022 11:29:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=selector1; bh=SnbWAtLwI+HY4KuM9yhL7Od2iYMhxkiGSfHiF+63B1E=; b=PSJZgMzOIkwzdfybOmiKpMYzsIz5z8kyx44G6mAfDO08Ov4s8IrrXHjV+E+24tCyltqF c8O6UCHUJTMQeGzM6+DUA4i04zjL8rR9MMLkeR2+k78Mo1QlAVan31+EhLVyPuO+NnSd WpW3LC5RY9fAXMESaPRMggckx5YUhCPyZGrYM2QBTAxEvprQakGLPC2V2Ssi+UsF4M57 PL6o/olqpGh8ET5ZvdBDIP7nYGuT3iUvTsGT2VO6H25awl+wAdHblNnJxLFd2P/fOO83 /8QSqgFluZR1f+3RfJImaDS7c1xaCplbYQviqPRJcfCbO7dH3tSMV7i+9UUxacFuUwwa Fg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3mh42p1mfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Dec 2022 11:29:03 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6B494100038; Sat, 17 Dec 2022 11:28:58 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4730621A226; Sat, 17 Dec 2022 11:28:58 +0100 (CET) Received: from jkgcxl0004.jkg.st.com (10.210.54.218) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.13; Sat, 17 Dec 2022 11:28:55 +0100 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= To: CC: , =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Subject: [PATCH] bfd: Discard region regardless of warning flag Date: Sat, 17 Dec 2022 11:28:42 +0100 Message-ID: <20221217102842.3645997-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.210.54.218] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-17_04,2022-12-15_02,2022-06-22_01 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,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: 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örn 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 != SHN_UNDEF && isym->st_shndx < SHN_LORESERVE && isec->output_section == 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; } -- 2.25.1