From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2054.outbound.protection.outlook.com [40.107.21.54]) by sourceware.org (Postfix) with ESMTPS id 02CFA3857C4B for ; Mon, 3 Aug 2020 14:22:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 02CFA3857C4B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Alex.Coplan@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=lTYrCG6QMQTltuFrY7YCb2VOT5FGZ7f/QpUJ4u+6QT8=; b=hhFhHHbKYKO92Rf7eWO6Oz4iAG3svalyh5iFVp37C2KoFl7jIu8ACBgMlCyvxlOBeRrHejbFt9cI6MnsqYHeDANONshM6jombWy9EbbxHCfTbOKg2Ln1e/ByPWssVhB9ZUz9orUsKMA1MKSuM94pNzrepEBPd0WFWwXc5c9bVbk= Received: from AM6P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::20) by VI1PR0801MB1934.eurprd08.prod.outlook.com (2603:10a6:800:8a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17; Mon, 3 Aug 2020 14:22:52 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::44) by AM6P191CA0007.outlook.office365.com (2603:10a6:209:8b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Mon, 3 Aug 2020 14:22:52 +0000 X-MS-Exchange-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 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20 via Frontend Transport; Mon, 3 Aug 2020 14:22:51 +0000 Received: ("Tessian outbound 55d887bbc0e0:v63"); Mon, 03 Aug 2020 14:22:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7e45c133b4e54db5 X-CR-MTA-TID: 64aa7808 Received: from a741143fe7bc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AD908164-DDA5-4397-BED4-8FB99344D319.1; Mon, 03 Aug 2020 14:22:46 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a741143fe7bc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 03 Aug 2020 14:22:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D51RNrNW8yBg+A7VH3AGapVodw1yQWGJOZdmovgD+J9xIaICKTFeYl2aa5EX3CYUGkpQp7/T+JcK+MX6NUinCZa5+xJFEzHzBgb3OaAU07W5A3LKhEGoFZi0I3CNqiSd4q4LR3HkwDPjSkIqWljoiub+4L4k7gwFruShvZr2FW/9T4BGhEtWndDVPVj3pgYmJ4tIi53f7P7dnL5DK0pi4wwONeXUoJ/fWs44kC9oo58MIpTtELFkjaLf6FKgBO5vYWrxC1+FeMSP4CuiUKWUU0SAoS8cC6U3uWUTDugU1xBoLzv6YiAYpGb+v0MjGZzD8/4OU0byBNnjsm46t9m89A== 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=lTYrCG6QMQTltuFrY7YCb2VOT5FGZ7f/QpUJ4u+6QT8=; b=f/UWwCJz//dLQAvRYHYwCxuPBOuw6rear3DuSZOlMMoZNzmQoIQx90hT8bC9iVCcngd/O8pvaptVSS2rFZVJ5lBvr/cyZffaRKvfTUq/WiObMnND2wgZlZS/a1gG4hn8i0DzmqBokl83tb0USOnDSxxE3IVMNMYu0rGuKI8CsPIpmcm5sWs94bfP0/MXmdcFfHJe886vujPvULdwKWC6qvGqOyuB4/wfcGoB4WDOjndsd2C2xXCM6LkB3P0h1hZOwJX167wcoHMo1qVIb6KnZr3G0ZrCcoiTPyosilQxw8EQJYNKrJ9c3fLkfiNs36m69/9vdWNsc5SOl1C+O/VQ/w== 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=lTYrCG6QMQTltuFrY7YCb2VOT5FGZ7f/QpUJ4u+6QT8=; b=hhFhHHbKYKO92Rf7eWO6Oz4iAG3svalyh5iFVp37C2KoFl7jIu8ACBgMlCyvxlOBeRrHejbFt9cI6MnsqYHeDANONshM6jombWy9EbbxHCfTbOKg2Ln1e/ByPWssVhB9ZUz9orUsKMA1MKSuM94pNzrepEBPd0WFWwXc5c9bVbk= Authentication-Results-Original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) by VI1PR08MB3920.eurprd08.prod.outlook.com (2603:10a6:803:c2::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16; Mon, 3 Aug 2020 14:22:43 +0000 Received: from VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::b8ed:5041:249f:6770]) by VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::b8ed:5041:249f:6770%2]) with mapi id 15.20.3239.021; Mon, 3 Aug 2020 14:22:43 +0000 Date: Mon, 3 Aug 2020 15:22:41 +0100 From: Alex Coplan To: "H.J. Lu" Cc: Binutils Subject: Re: [PATCH] gas: Fix internal error in S_SET_SEGMENT Message-ID: <20200803142241.jxtqma5ijk3243vg@arm.com> References: <20200722142302.wi2rotbr3hbz57iw@arm.com> Content-Type: multipart/mixed; boundary="n7fnbiup2frpojkg" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-ClientProxiedBy: LO2P265CA0112.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::28) To VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.53) by LO2P265CA0112.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Mon, 3 Aug 2020 14:22:43 +0000 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a4fbaa47-baf4-4815-288f-08d837b8b4cf X-MS-TrafficTypeDiagnostic: VI1PR08MB3920:|VI1PR0801MB1934: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lU427ai9NPljPPswCZ3JBp4wyiCqZnLDpKMS+7xXfnnwe3ua1VW61PtHe5labTSikJrh8gM2xORkhqwmQwV6gDncFFbW+CZw90u+r4rUNxUwdqiY3PXNihWDMov0oDv9M53Hw2zf41wjldD471y58CvIH3WHW0n+eMOsblrlX1L/BLUFaCd+/Qh56NJsTMqtEH6ECEQ78UJ8LFQydeaSVZItPZc2XLG5poMxcrb+8j2NS5p0xvTyjP5FSLSy7wHCgQlmzMrdnWkAi8gLntKXTlaI7ugWoY9LhF1myo9aYfyHiFqA1kbpjRPSxP0UivLOWhcLnO//WvJFpsfImslDVbXdjTXiwX0Blzb+4D/uzoHOb+Bu1kZUgPVyLhcmEH5B X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB4029.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(366004)(1076003)(8886007)(66946007)(66476007)(66556008)(86362001)(8676002)(478600001)(5660300002)(33964004)(83380400001)(52116002)(7696005)(66616009)(6916009)(44144004)(235185007)(21480400003)(2906002)(8936002)(16526019)(2616005)(956004)(186003)(316002)(55016002)(36756003)(4326008)(53546011)(26005)(44832011)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wLUgLI31h2Kbi9BI8KbfPP857Ck8/bJpWnbzHch3Rl+0qcF3EK+M6b0uuvOEXO0AYHjaNT4oOAqw7E/7hVSUg9VMVPyMdIH6XgXEC4MCP71LxHSC3ZCQlTV0Tr+kAHn0huSdW1W0M/Ntm5EwBGEKihTk6Thm0X+ZBtz8eoin1cxjExmF/IaIOK87U8Iig9R8i1Pc2jjcKrThy+OeWKLyLELczTFnE/FZoC1WrPvpLXvOIjnEI8PuWyLRMDBp06Cjm9huW1RzWUrdXozelm5mwt5uZrHg5zRaGgcBfDeVr99zdcOY6WMm8OWKzeA95Nrtp9iIXosgzrAnYPKsNPjzF8aGTgZNJCxAipfGIR+7q8JXKp+33pdgxlnIPOP5LzwpQ4KpI6S7frq3CNl6B2Xkj60TBqW79eLBJHOPJmd9FA1IwJ/S77uPmHZBZ7FjMZ5Sl54CanZwHLYgLE1y0AVO+KGIQQODyCNbAe+BbB/LqrUuzY7PvT6e8vXdUT9O0OKbdwd+qCLY1V7qQpXx0nij6Ju6y7mq+kR8ZwP36fWcNDIsfOeMLjhD06rRX8u8ZSlP1z5dFwg0GL5cPdQUuqA4ZLKjyXICjoCtn7kvJvRBHXLOA6DyXt4WoZmYIQ+b42zSjKNgjbIp1V1RSIyXIPZzzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3920 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 11b8cf34-4356-4499-0af1-08d837b8afcf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PLglUUf0aERJF2cNxYysj04WlQ7eh4h0TDW7/Ul5PEviUfdB38bCGtnGiahxsIDCjzaPrZhg1qPnmqUB3ekpHPseOC3h/USTR50p0WycVRWvKdRByLvF3ncnaGeI4YH/9Mwluv7Z8N7DBbReUq5dbrwarY4vR3T+htZIyXtNUOs65YRhsvGClXxOSqV2AG+xM+94hpEA6+Uz/4rD5ZSZrKBntahDeXbz6Lpfy4Ikb+mIMCjjZNuDecVpl24p1c/13vgNqXVnAEcFWgviZI5e2WJIcHvoJcz5LdSFscXjCSGI3DgM6YYY7smRAXV0mkyAvR634yrBW5vRyUJHfpi8x0A24OOrDciEqYMyDRdJwVp6DwAYcUdBusMHdwT0PBrxLO8CITChoadNWOz7XAWEZHklB1fabjXOoNn2vWn8VSY= 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:(4636009)(136003)(39860400002)(376002)(396003)(346002)(46966005)(336012)(86362001)(36906005)(2906002)(82310400002)(6862004)(36756003)(356005)(81166007)(53546011)(8886007)(33964004)(44144004)(7696005)(26005)(21480400003)(47076004)(186003)(16526019)(8936002)(70206006)(4326008)(82740400003)(44832011)(66616009)(8676002)(956004)(2616005)(83380400001)(235185007)(1076003)(316002)(5660300002)(478600001)(55016002)(70586007)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2020 14:22:51.8841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4fbaa47-baf4-4815-288f-08d837b8b4cf 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-AuthSource: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1934 X-Spam-Status: No, score=-15.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: Mon, 03 Aug 2020 14:22:57 -0000 --n7fnbiup2frpojkg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi H.J, Sorry for the delay; just got back from some time off. > -----Original Message----- > From: H.J. Lu > Sent: 22 July 2020 15:40 > To: Alex Coplan > Cc: Binutils > Subject: Re: [PATCH] gas: Fix internal error in S_SET_SEGMENT > > > gas/ChangeLog: > > > > 2020-07-22 Alex Coplan > > > > * config/obj-elf.c (obj_elf_change_section): When > > repurposing an existing symbol, ensure that we set sy_value as > > per other (fresh) section symbols. > > * testsuite/gas/aarch64/section-symbol-redef.d: New test. > > * testsuite/gas/aarch64/section-symbol-redef.s: Input for test. > > > > Why are tests arm specific? Can you put them to ELF tests? Thanks for pointing this out. I wasn't sure if there was a suitably-generic place for these to go, but it seems that the ELF test directory is the right place. See the updated patch attached. The test has been tweaked to fix the indentation for targets that assume anything in the first column is a label, and to skip on targets that either don't support assignment (bfin) or require attributes for sections (h8300). Is the updated version OK for master? Thanks, Alex --- gas/ChangeLog: 2020-08-03 Alex Coplan * config/obj-elf.c (obj_elf_change_section): When repurposing an existing symbol, ensure that we set sy_value as per other (fresh) section symbols. * testsuite/gas/elf/elf.exp: Add new test. * testsuite/gas/elf/section-symbol-redef.d: New test. * testsuite/gas/elf/section-symbol-redef.s: Input for test. --n7fnbiup2frpojkg Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="patch_v2.txt" diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index de22b5a1da8..c11a1da2295 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -759,7 +759,14 @@ obj_elf_change_section (const char *name, /* Add a symbol for this section to the symbol table. */ secsym = symbol_find (name); if (secsym != NULL) - symbol_set_bfdsym (secsym, sec->symbol); + { + /* We could be repurposing an undefined symbol here: make sure we + reset sy_value to look like other section symbols in order to avoid + trying to incorrectly resolve this section symbol later on. */ + static const expressionS expr = { .X_op = O_constant }; + symbol_set_value_expression (secsym, &expr); + symbol_set_bfdsym (secsym, sec->symbol); + } else symbol_table_insert (section_symbol (sec)); } diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 86b304ae34f..8cd61b36754 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -303,6 +303,7 @@ if { [is_elf_format] } then { run_dump_test "strtab" run_dump_test "bignums" + run_dump_test "section-symbol-redef" load_lib gas-dg.exp dg-init diff --git a/gas/testsuite/gas/elf/section-symbol-redef.d b/gas/testsuite/gas/elf/section-symbol-redef.d new file mode 100644 index 00000000000..88807a196a7 --- /dev/null +++ b/gas/testsuite/gas/elf/section-symbol-redef.d @@ -0,0 +1,6 @@ +#readelf: -x myseg +#skip: bfin-*-* +#skip: h8300-* + +Hex dump of section .*: + 0x0+ 2a\s+\* diff --git a/gas/testsuite/gas/elf/section-symbol-redef.s b/gas/testsuite/gas/elf/section-symbol-redef.s new file mode 100644 index 00000000000..87e65699b48 --- /dev/null +++ b/gas/testsuite/gas/elf/section-symbol-redef.s @@ -0,0 +1,3 @@ + myseg=not_defined_here + .section myseg + .byte 42 --n7fnbiup2frpojkg--