Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp687112ybz; Wed, 15 Apr 2020 16:43:53 -0700 (PDT) X-Google-Smtp-Source: APiQypKStGUx+30zQNbhQW5qY2AH7VoJM42Mbhs3ncSwhhq1v72abdQlgOq0ZyLc/JWVeTLLwAye X-Received: by 2002:a05:6402:7d6:: with SMTP id u22mr17201716edy.149.1586994233042; Wed, 15 Apr 2020 16:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586994233; cv=none; d=google.com; s=arc-20160816; b=nQutIBsX8xB8N0UNQuAjVm40Vw4aDNbHeIxFs1kMjSh3o9+llW1d5qRsyY/Kyg4Uw4 EkPCpeFOkJL3XLqyy06bI05pnlp66jPITIaQ2z19VyHcBNPgMFMZX0R9vxoyUjOi0q0P XFP4s12Xxw5S2ekOdExXSrYTTFFichNwKl9nnpEzlLwMg3vaabUKKt3LzN6mJ4eDvAEf QCkrKp+Ka0UbTDbIhlzRZZl8YoB8jWjrZrdNZdEt1nZwoQUBnG7O2fBDvQ8ZO8KaklCW y1vSDT7KQNJVTma8RMGyZveVzQtNe1Lv5/V3B4FTaabklZ7eRNlbCSxVDhnwluU51Nfq +Syw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NHiOx8HuGBIWG4TyDkQM7WGqG/+VYErX1ETDBr5EevQ=; b=c+8qaavh743Uh8Jk6cwJcu2w4tCex0wbgO5RtWZkuDVb6qCwyzFVnFnW0EHeIcbdgO ib2Py4k+4eCOjafpFmmSoYc6cYcCTpb5qE38qwlwrmXWTkPK76uiEI+RcPODbRpbn+rB KwQeE+af511A8hTKAO0km3EQSzngDL4YIbXQmWX6s8PLto8bfs8r6D2Zhwwr3QVu2+uG cFF/tvUWRiW/6w2+WiehJMeYNtmetyyKUA9cS5fP1N+652Oty27chUX4ZLeLxlX8EO5I mTZmH5Fg0990fkeilVsG9uct4KkdymeH5hT2KYAyd0OBJsTD8DneCG0rQAj0+0lFQPOT 4/0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si11087627ejb.358.2020.04.15.16.43.29; Wed, 15 Apr 2020 16:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898057AbgDOMK7 (ORCPT + 99 others); Wed, 15 Apr 2020 08:10:59 -0400 Received: from foss.arm.com ([217.140.110.172]:43860 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441247AbgDOMH4 (ORCPT ); Wed, 15 Apr 2020 08:07:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3931C1063; Wed, 15 Apr 2020 05:07:56 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E1C653F68F; Wed, 15 Apr 2020 05:07:54 -0700 (PDT) Date: Wed, 15 Apr 2020 13:07:52 +0100 From: Catalin Marinas To: Fangrui Song Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Will Deacon , Mark Rutland , Nick Desaulniers , clang-built-linux@googlegroups.com, Ilie Halip , Jian Cai Subject: Re: [PATCH v2] arm64: Delete the space separator in __emit_inst Message-ID: <20200415120752.GD6526@gaia> References: <20200414163255.66437-1-maskray@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200414163255.66437-1-maskray@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 09:32:55AM -0700, Fangrui Song wrote: > In assembly, many instances of __emit_inst(x) expand to a directive. In > a few places __emit_inst(x) is used as an assembler macro argument. For > example, in arch/arm64/kvm/hyp/entry.S > > ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) > > expands to the following by the C preprocessor: > > alternative_insn nop, .inst (0xd500401f | ((0) << 16 | (4) << 5) | ((!!1) << 8)), 4, 1 > > Both comma and space are separators, with an exception that content > inside a pair of parentheses/quotes is not split, so the clang > integrated assembler splits the arguments to: > > nop, .inst, (0xd500401f | ((0) << 16 | (4) << 5) | ((!!1) << 8)), 4, 1 > > GNU as preprocesses the input with do_scrub_chars(). Its arm64 backend > (along with many other non-x86 backends) sees: > > alternative_insn nop,.inst(0xd500401f|((0)<<16|(4)<<5)|((!!1)<<8)),4,1 > # .inst(...) is parsed as one argument > > while its x86 backend sees: > > alternative_insn nop,.inst (0xd500401f|((0)<<16|(4)<<5)|((!!1)<<8)),4,1 > # The extra space before '(' makes the whole .inst (...) parsed as two arguments > > The non-x86 backend's behavior is considered unintentional > (https://sourceware.org/bugzilla/show_bug.cgi?id=25750). > So drop the space separator inside `.inst (...)` to make the clang > integrated assembler work. > > Suggested-by: Ilie Halip > Signed-off-by: Fangrui Song > Reviewed-by: Mark Rutland > Link: https://github.com/ClangBuiltLinux/linux/issues/939 Queued for 5.7. Thanks. -- Catalin