From patchwork Fri Apr 28 12:57:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 88639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp908254vqo; Fri, 28 Apr 2023 05:57:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4H9IV/bmJaq0a2gnfIyDLsSW2+EpYVhJcGv5rdlodf70QJNV2prOBv9abcr9VD4vmmm/NL X-Received: by 2002:aa7:db85:0:b0:504:ae7d:9e50 with SMTP id u5-20020aa7db85000000b00504ae7d9e50mr4206729edt.36.1682686676167; Fri, 28 Apr 2023 05:57:56 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z6-20020a50eb46000000b0050849105f39si15656399edp.412.2023.04.28.05.57.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 05:57:56 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=oDrb4XJV; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B8A53858C50 for ; Fri, 28 Apr 2023 12:57:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B8A53858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682686666; bh=+JdByghGjDVW2Ka2n/WeISFqmAS111rgbrjmW9lMY4s=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=oDrb4XJVBHUPX/Eom5+oi3OUWzAMT0JbYV/cRRzFGOdfMV1m0u2C27IcNCMH8CyaH mNGrV6oiYf8ci9hI5iGBqZzbeibsAPJRiiTv4w/4Vmqn+TF2obIUR0cdLXfWsKkOmH /ATcwfk8aCJQl9l9BaGtgITtFOzkPVHAPmDkxDqg= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2059.outbound.protection.outlook.com [40.107.6.59]) by sourceware.org (Postfix) with ESMTPS id F11D03858C31 for ; Fri, 28 Apr 2023 12:57:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F11D03858C31 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XZx04uydravncm6eV+8ggmoGoL9IgMjKr6vUfEGh67QpJHsxQp5n+CEGd/EH8VTHKCSqtJU5Amjk/Jt+y/JNKX+8Z6StY8losVfg8EwCJs/tXid9FPvPKuLKAvCAtt87kVwnOBOBlkgG4Zm17drsizobu2fX85oHFnaIA8a0mIePv6S5sNeZO2rNTU3XAafQZ1zh+21cImsMqnsbkijptvGA7pSbFxAK/mVlBAZ2rku050AR6auPy6UsBNeUaSOjNNvzGwacmt6Ad5Xf4pUUhqjpBTe+Bv05PChOvCQGAOmn8w3NNNjKK7jQnKgZbWgI3py9nIlhFuTBH8HfE9N5iQ== 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=+JdByghGjDVW2Ka2n/WeISFqmAS111rgbrjmW9lMY4s=; b=NUJeYr7qMd7MDM3V+1L517BCkz+YZ1j8VNnk/pj1aCMJ5FNmfHcQLOkxQL9st7PVaA2xHclrWDURio547bjMVSfGalTNppc0dOj+cjGbOElSI0MldPL8ndCalauK11JMVV2E8zzt+VMrdSK2kuS3nY7jFx6AI7jqbDjFv1C970Wi42U/mMPanyCbYZ1zvyyiceuwGyrc3nvt4p4NY3Gi9p03nwYTyUs5e2tOokf9H+rQ+d43bspiMB/j12cbdrFvluIjcKAgH5eQ4Ib3YaEVffVpoKQXwOfbK5ue3vhjeLLTzwr7+M8xOuKbwtGgoyOsPpvTRYj0hLXEJKDjIy4ZuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by VI1PR04MB9980.eurprd04.prod.outlook.com (2603:10a6:800:1d0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.21; Fri, 28 Apr 2023 12:57:33 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::52b2:f58:e19:56ae]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::52b2:f58:e19:56ae%2]) with mapi id 15.20.6340.023; Fri, 28 Apr 2023 12:57:33 +0000 Message-ID: Date: Fri, 28 Apr 2023 14:57:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Content-Language: en-US To: Binutils Cc: Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu Subject: [PATCH] RISC-V: tighten post-relocation-operator separator expectation X-ClientProxiedBy: FR3P281CA0133.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::20) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|VI1PR04MB9980:EE_ X-MS-Office365-Filtering-Correlation-Id: 94f159b1-0e82-4d46-7ee2-08db47e82217 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2tR/8oTS+giylrCyA/byVeXJhQaqGkN8CzsMBsODgMLItkX3cbXycf+yaJjL8qwnDmTJffcybHWz7FDlvzwENzUhiujwB16ePj8a2/sIq2wOv2itKxm6yRxDMxX/hs2nH+RcxP6ItIEfLpALPxK5Pbp5u2LNr9Uh9eEY0JYEtZP8iQ9ve4W5A71C4niPij5r1mABcu+eNWaMcn5ZqP9OgZsrjAN8yQXyrhf/L7qYXooYCP3CvnLlhEc64+AF03cDRx00Qo8rQWQQqkMte9o5G67gQHPvd5p9+br1wAfYXXnidLD9BhfL3mvFq4Tz626vqFbZ7sPzAwONaHz1mbguOdcir/mAtZX92W9+a7bl2db1USHJIsmL0cVf4iuJKAQV3FRcWFuRGVvFTsnl1x/RWaqKue6xm6l4xwSanz3aEGnhiyFXk0RaGjGJlGE3U3XvB1lWms87I8jSLQxOSSwzcx3sFkszsGXba3RfJWYX/5tDntL4PGRLn0RlwZdUEVW9NOZgYOpP7QEFlOW7aKnVHgy4gKCGy9ZSPO0O58cYndQ5HVLPD3XqdGH6xjebrL+xsN/wLFYDYMAwKz3WLJmDJ0MJeGvEB3L50eAsnqnGK3farUJ+kOsDzlbDz10urzOfpFqlmzS2J0asBokuo4EYRA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(376002)(136003)(396003)(346002)(366004)(39860400002)(451199021)(31686004)(38100700002)(6506007)(41300700001)(6916009)(66946007)(54906003)(316002)(31696002)(86362001)(8676002)(66476007)(66556008)(8936002)(478600001)(36756003)(6486002)(4326008)(26005)(186003)(2906002)(6512007)(2616005)(5660300002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?dksTFWRXRy4vHhsYUl0MHGLEGkE9?= =?utf-8?q?1CBj8na8fB8H0YTvXsuuyucahht/rOh4DmSgSFPjS2jZK0/1VW6czBEqVUc4kOnds?= =?utf-8?q?8u49PRW7K/ue6mVoDSb38LqdmAmsm/TFLF/s9EFlF1fnlJIwkA/UoxmRF3nhwqqMM?= =?utf-8?q?UJO3L8t7jZxZJ5Bd7t6do4DTD4BigW/y5RA50oIkygoGC5Tkbg6IdatZrNui7Hc7i?= =?utf-8?q?Pso4LSjgdNOWsn4gCH2fhrPRLUovBwDp3++0e/xM1MZoZzxqSSe2e2LuLALMfKCtB?= =?utf-8?q?uNEIT/BOktME70uzask/8BOnXkOAZz2z7Nx8sp+BDgdb9uz5uea6yalhy+JEpCmYT?= =?utf-8?q?a4U7eGZjeM/N9qyAY707NAniSRv/SdZ8ApnuCaNn2xbwLjmEthY48QlxWNrrx73V4?= =?utf-8?q?fN/xA2IbrD4DOiYi8RFGhxLc+CWq2MbqYpqG1Cv09TeAzKAJAPa78GmQVAvuDvMEc?= =?utf-8?q?FbmQJrj7rVf9hCaZvggzY0u1slc/i6QPCxOMOqjLhw2zB9UmwHev0FPNHYUBS1MHx?= =?utf-8?q?wylwRIDkqRPl3V+86YMy7ZUf4fCQdFZba/HIUrGrQ/610zk5g50uxm0RmFPcrz04E?= =?utf-8?q?q4H+qh3T6LCLO2gh0z+HFWQ19Ql08s6dLZlbDsXdGICy7xQfol+tHg136P0JFUjx7?= =?utf-8?q?abPEZ/7E3Hy1IR+Jug0krj5uMVagx04Yy6mzERtEUTZrzi9CdmJDCmLlQ0YXoFptK?= =?utf-8?q?iBiIgS0JX3pYAjDAE6Tg4kboXfqf/U+phCV7H0flRGAH2DAXrJBjs4ZWI8lspnmo8?= =?utf-8?q?/Bx8cDDGmkaPiBnrq1D4A0Nly/0YCOKEthLg3wx56VG1dvkZoi5eObnSebmV8Osue?= =?utf-8?q?V7tXeon9iWczmn3yO0uwkS8g3w/HT96DWTgw+tnLfidBk57WDtxXbV86Sxbff5ki5?= =?utf-8?q?bCS6GbNWqXY9fvaQL82Vun2f5wzAJ6nUqLuD+3d0xf7oboGSqV8VetyA3kdNHomjJ?= =?utf-8?q?fPRBnfNppXul6hEaS9fkIqmHUnq8ucY6d46LEYkBpZmePRJPrwKJdiSRO+Aofoknv?= =?utf-8?q?4k9X4zrOnLUet9PtCHTUy6ROGodxq3OfVbJDyUzhtgNhtYx5ozzT5jupefniOt33P?= =?utf-8?q?qxhl+DmvGBftJIH+R0YFK5LwKW2IrKDOfzyfio7/axuKlY36aIQkSQS99KBr/OhrA?= =?utf-8?q?Ngilm+ffl8ZXGRQn4rURQz+nJZuXA7e8ghdjvz3bZcgn20Ti/1C9bWVybLyYdbNxG?= =?utf-8?q?2rQd3zwDGeiW9oUpFik7cIaDaaTyQmK0EQbP+xuiXwYUWlzX3qbn2adCxTA3fA+EU?= =?utf-8?q?/Vi/o+THNw5/NU4sjGoWluwHxW4sv5Ks/T3//dyoEy25OZenlWeY4WSByKlsGlHDC?= =?utf-8?q?fVamcQIL2SAY9SHroBe85qcf2lNhnUK15Ms7ihL/cT78HqQHT9YvP+OR7y56orXHj?= =?utf-8?q?dLm7E5h0tFlsbcAQ6/63TPBBivMDu8/tdc8RK7hRXWWkddWjD3lLC4WxZdIBprMZ3?= =?utf-8?q?1UbhbYBwEqDpTOSzHOSrklXOPL1G+lWjss2HLIq1vlHcR+WnylYTxYvKI/n/B0krZ?= =?utf-8?q?h+rXaH6u0RpU?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94f159b1-0e82-4d46-7ee2-08db47e82217 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2023 12:57:33.5270 (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: uINsl2mc+YaVmGq1nh5M0yzpNmlU48zyJ3o9doqCm0kJUU1f6HJ/3mSWHo9SK5xaU2iFMmITCKG0FktQmTH7Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9980 X-Spam-Status: No, score=-3027.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764424864224110763?= X-GMAIL-MSGID: =?utf-8?q?1764424864224110763?= As per the spec merely a blank isn't okay as a separator, the operand to the relocation function ought to be parenthesized. Enforcing this then also eliminates an inconsistency in that lui t0, %hi sym lui t0, %hi 0x1000 were accepted, but lui t0, %hi +sym lui t0, %hi -0x1000 were not. --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -2200,7 +2200,9 @@ parse_relocation (char **str, bfd_reloc_ { size_t len = 1 + strlen (percent_op->str); - if (!ISSPACE ((*str)[len]) && (*str)[len] != '(') + while (ISSPACE ((*str)[len])) + ++len; + if ((*str)[len] != '(') continue; *str += len; --- a/gas/testsuite/gas/riscv/auipc-parsing.l +++ b/gas/testsuite/gas/riscv/auipc-parsing.l @@ -3,3 +3,5 @@ .*: Error: illegal operands `lui x10,x11' .*: Error: illegal operands `auipc x12,symbol' .*: Error: illegal operands `lui x13,symbol' +.*: Error: illegal operands `auipc x14,%hi symbol' +.*: Error: illegal operands `lui x15,%hi symbol' --- a/gas/testsuite/gas/riscv/auipc-parsing.s +++ b/gas/testsuite/gas/riscv/auipc-parsing.s @@ -4,3 +4,6 @@ # Don't accept a symbol without %hi() for 'u' operands. auipc x12,symbol lui x13,symbol +# Don't accept reloc functions without parentheses. + auipc x14,%hi symbol + lui x15,%hi symbol