From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.109.102]) by sourceware.org (Postfix) with ESMTPS id B64FE3858412 for ; Mon, 14 Feb 2022 12:49:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B64FE3858412 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2057.outbound.protection.outlook.com [104.47.4.57]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-41-o0XQpqqyMi2_PCM2DIt2yg-1; Mon, 14 Feb 2022 13:49:19 +0100 X-MC-Unique: o0XQpqqyMi2_PCM2DIt2yg-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lK1NkVTf/GiXqvcSet75Pw3MmugmdpPrWU+n7dyGJI08YkCzHpzviqf4W8CbXYxW0jb/5dYygRYSmu0bHKh8WNnsnTGhGCrX/SCA4JHj4c6lWh6z+7vXlMtEfm0hVB8Gex6thBsfCBq4W5SdsTrdJSYJR6K34/IotE7wBRJCcX2KciU8kUpbONHUCI1BttvGQrPS3bOlT+lVrq1ftRVUWMSJ+bJnATRFdESs9B7Y1Z/Ezr/vRh3he+sFw1yuj5p2+pIkziDUCj4cDoy0eM4CAKRQ8K6QksqknNsciOaNCJN819+GV88UZ5KrxNqpD3tbuuHKL4JI/bT8M2j1bZ/Pxw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1CpRbSJq3ihALEFTrYke1Hs8KmO66Vcz97xIjIDqxeI=; b=BSKj5IW4gV/JYjvxePq4PUwQvwfiy0JfHhNicqZzubiS0Blowpvdv5dFTH6TIAGNH77zYax6/osOPEjqTpg3H33gyUDkEg2bK1aWof85SjxglqgbR38pM+3Whtxe3fb/92CpT/Pv6npzbky6y/7X1IyLyBAcS9ho21Y8ARonTzatOtXwrRZrp+knYUtJCROQV34HL7qWF/LeRwQFcSkZ3WU1NlWRFOUo0vMo+udWAZvK2fKCu9tFvMnlXKph0kARUECxkLqeTpgX5powVfUENGxgVv+3d63L8CV1IfvqLPpygYGzHlrsKQbQOOnw9O9RhMflrZ0VrqnlLAHwS5IfvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by AM6PR0402MB3944.eurprd04.prod.outlook.com (2603:10a6:209:1c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18; Mon, 14 Feb 2022 12:49:16 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::d479:b728:345c:bd65]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::d479:b728:345c:bd65%5]) with mapi id 15.20.4975.015; Mon, 14 Feb 2022 12:49:16 +0000 Message-ID: Date: Mon, 14 Feb 2022 13:49:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: RISC-V: mapping symbols vs "unimpl" Content-Language: en-US To: Nelson Chu Cc: Binutils , Andrew Waterman References: From: Jan Beulich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS8PR04CA0180.eurprd04.prod.outlook.com (2603:10a6:20b:331::35) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26d759c7-8b09-4b44-0876-08d9efb8690e X-MS-TrafficTypeDiagnostic: AM6PR0402MB3944:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zTPJAVS6A6re7+JNiIyKDvR8VDbjaEM53JYixTNiT1RsHWQEOj3RO4oT7TzN1p/CHuPcCkqS8qadOJ3NW/dioF7cr8BJWvMVegICM2ClWtatns2Nz5vRGQd8Wk/fvLc+FfhYMGZpgSQ4g7JYWC4ctFcFi1+26JBtt2xvJWmPY1hFYwycwdj803w+0fnjqdM7xvWC3pkyqx0/PdrfEheWEe57VZmco1Lq4eEFaNEh5eHtPKDwctzuE/1w9yvjPfdKElq3kMQ0be+paopNrHDozcvdEdCciZcjFqdR1az07wTY4p1LmYJNdAK1oeeiViMde1GR1/c5gKbFnM+YlQoSdlujbCcWOprcTU/HEsoa5xzt64ynqQDMHG64JBq2T6OoiPu+D9ms3gXz22tge05SeiSrAWYo9zZ/1cPZ2IOtren1ja08RqRp7MQ/7w4wxiLptRzwpJX7t9Ueqt9rKKGIPMcN+zuxbCiVybOe2OeiGSMlGK36K42Zv+r41hR5bn2XoSsN8kNWvyyCkHXYWxnPrhvYh7HMXNqGSfLOgQUEB6j93ASq6zN1g1QRa7rN/T5l+em5u5cCNB5QDFcOcv/Qg0P4RoE5FPOp41ljvFCS2GMKN43Po9qjMA4SEXpCIkkc6kPOOVrIQTZD8Xu79Th9gZ/ep7vEN9lq+jDskLBD0JI8G+sfBI8z7Sk0zdGN+pn9ymtQwGajFDLSCO3bzBFm97GCuRajVEUfTZOjJrqSXmA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5600.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66556008)(66946007)(4326008)(66476007)(8936002)(8676002)(2616005)(2906002)(53546011)(38100700002)(6506007)(6512007)(5660300002)(6916009)(54906003)(83380400001)(26005)(186003)(31696002)(6486002)(36756003)(31686004)(86362001)(316002)(508600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MUxTR2t0WmRKSmVmY2w2aUZqa09GdVJ2d3ppaVN4VDdMNytuSWtvZk96VUU3?= =?utf-8?B?eUhQNFIwRCtmdFJyMnZTZDFYU05IeCtuYUlwUkVKSHFlY3pGRit2cEphVDdi?= =?utf-8?B?cjVRcDJ3S1QycnF2RlRESElnNWlPSUZTU3JBZExtSGNKLzVMRzVwRjBaK25K?= =?utf-8?B?YjA4akliVnVjekJ0MklTYUR1TWdiNzA1dnFDR2FBUnAyQitrbndmMTY3T205?= =?utf-8?B?V1FjOTdEalExaTNGaW12SWNMUkwzZGl5SXNvbHVQT2d0Qko4Y0RUa1l1Yngw?= =?utf-8?B?KytubDZPSEl3SlNnMWh0UEF4a2FrUmNtb1JlN3Z1d2NOZzd5TW1QZ2xxRDZY?= =?utf-8?B?alMyUzNBM2lKS3lqOVVzTVFieTNrM3I1cFhUODJieDQ2ZnIyb3M4VjBPU3dt?= =?utf-8?B?Ykozei9UV3pzTDVOZFhCZHJPRjgwR29ERG1TNWdYZ0lJemFGUlQzMWcweTNn?= =?utf-8?B?MFJQTGEwbTMrbUJ4UnlhSk10S0xwYlZrcGtyVTk5dzFrOU80aXpORzhML0tu?= =?utf-8?B?RnppeHI1eG0xYnJKaEJ5eS9JaEFQbXoyVWQvWThCNVQ5dVQrbTBCSTJUQ2hN?= =?utf-8?B?UWgzTlE0Q3dQeFZscGZ6ZitsR0Y1NkNVWEU5MXFqTUFzNnRkTlV1NTQrQlBz?= =?utf-8?B?V2JJdHorUzNPeTZwdTJ0VU9XN1JVR2FLbmNlWWM3Q1lXWHNrNWtkaUdWOExD?= =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TDZyenpZVGVlbHJV?= =?utf-8?B?VEU4YmNsazdlZkhNUVpJRnVGQVpqeWFoSmNmeG42UklNMDJxQkoxdWI3QUtX?= =?utf-8?B?NjhQalhVbEVVK1dGcFhrU0VZWmRwMHVyT1hHRmk5OXhMcTRyQWpYOHZkZU9k?= =?utf-8?B?aFBGRXFjdDlDSnRIQ0xaSzBRaEI5NFcwTjdrb3Vtb0E3bjhqd0tIYk1XRHpz?= =?utf-8?B?MXdQN1dRNXg4czdrVm5WUG42dk9iZTNBM3o5TC9JUlpObnYrZFhBZWdEY2hB?= =?utf-8?B?a0ZUeGNES0Z6amZMSTFIRUdDS2Z5MWV2aUlNanhoNWJFazdtWlpNWFpFY3Vl?= =?utf-8?B?TStBNFcxTDJwczZ0b3dNWUNjWXVubHlrWUdnTHE1UW9GalJtN2ttWGh5blBq?= =?utf-8?B?a0N1QW80TjVaaFY4R2xRQjZ6eTdQZTZuSlF6VHU4bGVaWnEveEpDcnN2Ym1h?= =?utf-8?B?M1ViQXFrUlgveFg0N0dpRVNXK1pOVWRmYk1Ib1pYM2JlVGhJUzBjb0VWQm01?= =?utf-8?B?U25ackZtYzJLV1ZNSmZsRHFrczgrMGY0a1VrblhFOHg4ekMwaTNTZHJUQlBB?= =?utf-8?Q?RxY+k1j5YbBFi/SPe15bySI=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26d759c7-8b09-4b44-0876-08d9efb8690e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 12:49:16.7683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: P5IHzrIYBhkeWKyedEVB6AMDuO6ORu4K2dXpBnxA+0WuPVoIRr3+eRVEG8+7bNwJ6GyOoyUL697pZxDwDkPtSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3944 X-Spam-Status: No, score=-3032.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 14 Feb 2022 12:49:23 -0000 On 14.02.2022 12:24, Nelson Chu wrote: > On Mon, Feb 14, 2022 at 6:35 PM Andrew Waterman wrote: >> On Mon, Feb 14, 2022 at 12:27 AM Jan Beulich via Binutils >> wrote: >>> Do you have any suggestion how to encode a spec-conforming "unimpl", >>> which I want to be part of my own disassembler's test cases (in >>> particular the 0xffff0000 form)? Since the commit introducing the >>> mapping symbols refers to Arm, I'd like to point out that their .insn >>> equivalents allow to encode entirely arbitrary instruction forms. But >>> of course I understand that RISC-V's insn length encoding scheme is >>> somewhat in conflict with this. > > We are used to checking if the instruction is valid or not for the > .insn directive. So this made me think - maybe we should allow .insn > to encode any instruction, including illegal formats, just like what > Arm/AArch do as you mentioned. > >>> Two further remarks: Even ".insn ci ..." cannot be used, not even for >>> forms with the high 16 bits not all set (which again the main opcode >>> restriction would get in the way of): Already just temporarily >>> enabling RVC causes the RVC bit to be set in the ELF header flags. >>> Yet with that bit set 0xffff0000 is actually a 16-bit insn 0x0000 >>> followed by a wider insn with the low 16 bits all set. IOW this >>> conflicts with the spec's wording of "minimal length insn with the >>> low 16 bits all zero". > > For now you probably can write 0xffff0000 by two .insn directives. > For example, .insn 0x0 + .insn 0xffff, and then you should get > something like, > > Disassembly of section .text: > > 0000000000000000 <.text>: > 0: 0000 unimp > 2: ffff .2byte 0xffff > > Anyway, this is just a workaround. I will find relevant people to > discuss whether the .insn directive should be allowed to encode an > illegal format. Hmm, interesting. I wasn't aware of these alternative forms of .insn. But I wonder in how far I can actually rely on the present behavior: ".insn 0xffff" emitting a 16-bit value does not really form a valid 16-bit insn. I'd rather expect the "value conflicts with instruction length" in this case. And if a 16-bit insn is emitted, I'd expect a check for RVC being enabled, which in turn would have led to RVC being recorded in the header (creating the same problem as mentioned before again). But yes, for the immediate purpose with 2.38, "utilizing" its shortcomings, I should be able to use this approach. Looking at riscv_ip_hardcode() I also notice that .insn 8, 0x3f wrongly triggers that very error, due to the undefined behavior of the shift in this case. Jan