From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10051.outbound.protection.outlook.com [40.107.1.51]) by sourceware.org (Postfix) with ESMTPS id 73955384B0C1 for ; Tue, 21 Apr 2020 13:42:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73955384B0C1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tamar.Christina@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i4Ha3+mJ4T5mwCG2FT7cA67Dkwkk9dEJFRhIMOKxQ7k=; b=AL6gNAeOctlvzQD4B6i7of1/CLeeQrid8lcSGZQ+/iMpT9/Kt7Ggi+2i/NJDY4Ha/QCeA7IQECw7pqfiMFsObDDs/Vr0Thqqw9EtNQOJup3wu7cAioxQstcSqEzDsdSaFmSVmzUxVM7KgU7h1ozefdsmeIiq1R8Bj8WFYS2TAeQ= Received: from AM6P195CA0083.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::24) by HE1PR0801MB1947.eurprd08.prod.outlook.com (2603:10a6:3:4d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Tue, 21 Apr 2020 13:42:02 +0000 Received: from VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86:cafe::81) by AM6P195CA0083.outlook.office365.com (2603:10a6:209:86::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Tue, 21 Apr 2020 13:42:02 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT058.mail.protection.outlook.com (10.152.19.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.18 via Frontend Transport; Tue, 21 Apr 2020 13:42:01 +0000 Received: ("Tessian outbound d63670e9da8f:v53"); Tue, 21 Apr 2020 13:42:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7ea0b4f0c4ab2800 X-CR-MTA-TID: 64aa7808 Received: from 84caa61469fb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B145BD00-1EE6-4833-BF2C-A19A177D93C1.1; Tue, 21 Apr 2020 13:41:55 +0000 Received: from FRA01-PR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 84caa61469fb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 21 Apr 2020 13:41:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=caYJzw/pJ8y6/cnpydPVbUwA4R4Ovvm8nvYWutXsDvUoL6JAGS3s6WUX5mHJL1H0qF/DQsNdVwHQk8Sl8XilbG/CFQhembQsT0idkVzazDX1ailH3htNsHosN/465pvfiJjxg3V1/TbSATk06y3np4cACpB4ibSuZB9R/mjdhjLIDunna1AYRHnW2BMJQ35jT3g3xk2a2l7kifAuHrme/h4fDRqpoMQn14WfhIIol4AQSxKVfDh2T/HnhpAj2/zL5KpfJ9hPc8Dov7U03B1OqcCHUflP21OJoq+OKfak81TgExhGg3tOl+YX8pxSGRRm5lsJwfVpkVmZvgCDMM4/9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i4Ha3+mJ4T5mwCG2FT7cA67Dkwkk9dEJFRhIMOKxQ7k=; b=HuI0wJd3H3q8mDGf8paYVd2AvnC3xyNMX/HdnImLqk1Lq+zoWwosctkoeLYLpqbkb9HDCpAa2npEmMUiX6OpyvJ2loYRKe9MHREgfRvNnJLvzIzr2KmlE6CLvYt1vkwZ0GRZRIepNYp2m8b2G9rc2gnhJJcf7K3HYOZt4/QUST40ftnnyK90HusFSNpvEhstyEu01jx8q29Rqum8+aPK4vs8QPdIuSnNI1Qi4O6QnBSWl8EZ9f3gCfYqmsFwFn5Y1lGNEathhh/V4S2SXVpu2bNgMfM6jvVLmD0RUAWWEK8vUrDSIOe8PdkdJjvHLXoLQoone6i7MTV2uf0b1kivCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i4Ha3+mJ4T5mwCG2FT7cA67Dkwkk9dEJFRhIMOKxQ7k=; b=AL6gNAeOctlvzQD4B6i7of1/CLeeQrid8lcSGZQ+/iMpT9/Kt7Ggi+2i/NJDY4Ha/QCeA7IQECw7pqfiMFsObDDs/Vr0Thqqw9EtNQOJup3wu7cAioxQstcSqEzDsdSaFmSVmzUxVM7KgU7h1ozefdsmeIiq1R8Bj8WFYS2TAeQ= Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; Received: from PR2PR08MB4747.eurprd08.prod.outlook.com (2603:10a6:101:28::10) by PR2PR08MB4730.eurprd08.prod.outlook.com (2603:10a6:101:19::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Tue, 21 Apr 2020 13:41:54 +0000 Received: from PR2PR08MB4747.eurprd08.prod.outlook.com ([fe80::6815:44:81f2:2283]) by PR2PR08MB4747.eurprd08.prod.outlook.com ([fe80::6815:44:81f2:2283%7]) with mapi id 15.20.2921.030; Tue, 21 Apr 2020 13:41:54 +0000 Date: Tue, 21 Apr 2020 14:41:52 +0100 From: Tamar Christina To: binutils@sourceware.org Cc: nd@arm.com, Richard.Earnshaw@arm.com, nickc@redhat.com, ramana.radhakrishnan@arm.com Subject: [PATCH][Binutils][Arm] BFD: Exclude sections with no content from compress check. Message-ID: <20200421134147.GA26729@arm.com> Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LNXP265CA0029.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::17) To PR2PR08MB4747.eurprd08.prod.outlook.com (2603:10a6:101:28::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.54) by LNXP265CA0029.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Tue, 21 Apr 2020 13:41:54 +0000 X-Originating-IP: [217.140.106.54] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a9c9e3bb-452a-4ec9-0648-08d7e5f9c57f X-MS-TrafficTypeDiagnostic: PR2PR08MB4730:|PR2PR08MB4730:|HE1PR0801MB1947: X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-Forefront-PRVS: 038002787A X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR2PR08MB4747.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(396003)(366004)(39860400002)(376002)(136003)(26005)(7696005)(316002)(52116002)(86362001)(4326008)(4743002)(66616009)(2906002)(66476007)(66556008)(478600001)(66946007)(36756003)(8886007)(2616005)(55016002)(956004)(8676002)(44144004)(33964004)(33656002)(81156014)(1076003)(6916009)(16526019)(186003)(44832011)(5660300002)(8936002)(235185007)(2700100001); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LET7SHTyzS+Jq6ZiUxNFRUhsMwqFNtDI/2p71WklEIf+bd5jcJPvblra1U82nF4YlYgSccxz1f9OvdDFmzu+dPbpOOLkjH+4l0clXy/bNdpRIrc1bsxAJqkSFJGGlklxNC3vhYWtmhIuHGbfoWfjLYXLNKOzEoINxLtrCwCZCw/B0bvx86xG9v56RuI2Xce0fUfMt0xFqkxrr9BbCX0Y0IrFJzTIy2EhGcyJ6+GlM/of/Sfjnb4O2EvNxD/HPXfvyFCN6ru4hXToJyawrCUqyiAxiiTAcqS2IgjbSPvBJlehDTftB9fwfZSsPQeFCKrIwZYFFfw35ci8zDZAxFdWdDxbVkm47HyyfrS2/9kZprggZ4ZgoHa8KGsYy11VprYi8RaIcTZtEMWAWWmU373l1Q3nE4kUCbNr3WiIqN8CGvZOuJ5vN4y1JChhcUm9K+HUw4Yiv425HnmZcCRuZHSFITazDWePqy7S8cvnkv49y20iKdl99iJTqjH95E0aAq5g X-MS-Exchange-AntiSpam-MessageData: MAQ55b7c2r8V2tSFcV1yGzLiOx48b9+MV74huaT+yo7Qh7eTH5mwxA7tu1apl0QzeLvtRRGTHvZ/RP0MmUP0odyW3SgY0yBDob21GPSm8/crLdR/r3DbKqpwn21CAPbGcP38qs1Jt2UZUUR8Fd5JMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4730 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(376002)(136003)(39860400002)(396003)(346002)(46966005)(478600001)(47076004)(36906005)(1076003)(4326008)(36756003)(81156014)(81166007)(8936002)(4743002)(2906002)(316002)(82740400003)(33656002)(33964004)(6916009)(8676002)(44832011)(44144004)(8886007)(86362001)(16526019)(186003)(956004)(2616005)(356005)(7696005)(235185007)(70206006)(66616009)(336012)(5660300002)(26005)(55016002)(70586007)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 2ce463e1-b28b-4638-8ee4-08d7e5f9c0d4 X-Forefront-PRVS: 038002787A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HdEBiSqlh1ObAa7cILHpnp76bLfFtDjk/h3rZ9605EzbSE86B+QcHClsr1H4LE63HMozEkpDrS32So1KCx4ffx8G1lGC1MPOdvu8KiOUZ8dskWz+cqK1Oqf+gap6RqhY4PH8CaGIitfc5poqhQpE27INk9B1SVXt6Ym3NsKCvQQMOt+AoP9P0BSGsbTuqqQRq92/Q8xzvL3SMp5+KpQGdiWOZmI8CJ1qVLOwnEyV2K7qYD3maMvsPyOTBfUfyVIZGBuc2AXY0au6R/AWQWdP85Xbf1zEQemxNelS6yPmVEwtBj/YvXekZruEZzGP5xrDJ4E8KD2bcpNRD2llrr6s9pIB40PL59nW1y++BB2BFJ8VNcgd0ymOHUaD1d7V5MKzCLZH5q2j7TDXGftCVxHOEUuxSrsRegPqN/tkIU78XiynXLgwRdD/B+VTPZmPS/i8l5hs4+v2MqBDR0n6DEL4mE6Ff8us08wggGm6G5doLfGPE2x23OBPtW01VJmRuwyXHy09C8XxJpjm6auymRenHpHgLHMAyONek5/wvWkea6w= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2020 13:42:01.8167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9c9e3bb-452a-4ec9-0648-08d7e5f9c57f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1947 X-Spam-Status: No, score=-31.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 13:42:08 -0000 --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi All, The check in bfd_get_full_section_contents is trying to check that we don't allocate more space for a section than the size of the section is on disk. Previously we excluded linker created sections since they didn't have a size on disk. However we also need to exclude sections with no content as well such as the BSS section. Space for these would not have been allocated by the assembler and so the check would incorrectly fail. build on native hardware and regtested on aarch64-none-elf, aarch64-none-elf (32 bit host), aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host), arm-none-eabi, arm-none-eabi (32 bit host), arm-none-linux-gnueabihf, arm-none-linux-gnueabihf (32 bit host) Cross-compiled and regtested on aarch64-none-linux-gnu, aarch64_be-none-linux-gnu, arm-none-eabi, armeb-none-eabi, arm-wince-pe and no issues. Ok for master? and for backport to binutils-2.34? Thanks, Tamar bfd/ChangeLog: 2020-04-21 Tamar Christina * compress.c (bfd_get_full_section_contents): Exclude sections with no content. gas/ChangeLog: 2020-04-21 Tamar Christina * testsuite/gas/arm/pr24753.d: New test. * testsuite/gas/arm/pr24753.s: New test. -- --k1lZvvs/B4yU6o8G Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="rb12947.patch" diff --git a/bfd/compress.c b/bfd/compress.c index ce6bb2beaee689d0eb700f69a08e7eb5fe92ab5c..0f04912cb3723eec77fc3af1a015a1eb8472a9de 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -255,6 +255,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) /* PR 24753: Linker created sections can be larger than the file size, eg if they are being used to hold stubs. */ && (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0 + /* PR 24753: Sections which have no content should also be excluded as + they contain no size on disk. */ + && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) == SEC_HAS_CONTENTS /* The MMO file format supports its own special compression technique, but it uses COMPRESS_SECTION_NONE when loading a section's contents. */ diff --git a/gas/testsuite/gas/arm/pr24753.d b/gas/testsuite/gas/arm/pr24753.d new file mode 100644 index 0000000000000000000000000000000000000000..01990d1ff517c5c39e8d68c084f97ed897e24382 --- /dev/null +++ b/gas/testsuite/gas/arm/pr24753.d @@ -0,0 +1,7 @@ +#skip: *-*-pe *-*-wince *-*-vxworks +#objdump: -d +#name: PR24753: Don't error on sections with no content size mismatch with file + +.*: +file format .*arm.* + +#... diff --git a/gas/testsuite/gas/arm/pr24753.s b/gas/testsuite/gas/arm/pr24753.s new file mode 100644 index 0000000000000000000000000000000000000000..5ba33fd29c7c95f02d422ea4f3f6f4159af91856 --- /dev/null +++ b/gas/testsuite/gas/arm/pr24753.s @@ -0,0 +1,12 @@ +.text +.global _start +_start: + nop + +.section .text2, "ax", %progbits +_func: + nop + +.bss +.fill 0x8000 + --k1lZvvs/B4yU6o8G--