Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp558792ybz; Fri, 24 Apr 2020 05:25:22 -0700 (PDT) X-Google-Smtp-Source: APiQypI0MYUYF8BKU5W4b7NYxzs7FiULfTLHEKTCNtXNhtIV0FyshVbsgn20N3sDbZkCIlHIbb0C X-Received: by 2002:a05:6402:1597:: with SMTP id c23mr7203006edv.353.1587731121909; Fri, 24 Apr 2020 05:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587731121; cv=none; d=google.com; s=arc-20160816; b=EDW+2ZBRKdAdvBHBg7fiSRJhD/SVxH/0Yuq0nwp2XarebqWVWt9hTtHZ0t7cFVvyVd oaD3pfK7r3/Fy4uPHK5Cn4xckwKVCnxcPCgFEeaqLaCVt2PO2wR+xmvqnLNhwS+R3IHp xtAlXYlr7bV/eGXGqdNe0yHwvwMb1FSUCN93Oha1MwOuOkyOXIYK9kHL4aBacxDhwgp9 kjamycYqn9bWYPM04680DeQ4TgP2UatsPAzbAFVOVOQ0/IGdbmJOHiyUEk0K5J4/LeG4 6N+8tn8/cUxBZ2B77MOLCcOkQ11vBRlj2MSOWufl4lKLsFVKZEOWgKZr91JEyYAKTF8v j+xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fe/DussEgDrtFMoY1H4b05ycA/Ef08Lpwdo21w6hSWw=; b=qqWcuVrtKW2zV7WkeePZZJGE7e57Zq5T6w+RdEoe9qW70a9dWC2dzCNQCrLAfpXH7S bzwSTglcW2G4A+Y4vKUtJ/W991FBZ3ttjmqHSNO5OS+jWGQaw5wxXgT55M9UxwfXt09p OkrF9IL7GRM0Hl7q2IvyI8OxJNktFiM5z7PfhHLz9qeIFn7slImY123stxtu6sIY/Qw6 /iwspQXyww1MbfouIVqfjemmdKqD7t1Uvwyg4zv30ViSpedmojQUF3xO8UTfavtqFGKw D5GOSC9MdkzrnoefYQSlrtjdPrNzIq5aXF5TxzhkF3vSeDatnG5xKBr6ZqDsd1v0OGZQ eubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WpyVTfU1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si2880132edu.287.2020.04.24.05.24.58; Fri, 24 Apr 2020 05:25:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WpyVTfU1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727825AbgDXMXN (ORCPT + 99 others); Fri, 24 Apr 2020 08:23:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbgDXMXL (ORCPT ); Fri, 24 Apr 2020 08:23:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 360F8215A4; Fri, 24 Apr 2020 12:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587730991; bh=XjxUPLmaZfpR/Y4FaTxgXOpZTIC1gf1eeU66oXHFRZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WpyVTfU1AbUoqDXzPyz4z+HNYjXtfMcZCGu2BbZ/MuLEFshUnImZh78XXgkY9D1gY b6o2IYDeDBNSqVxYUYsc0aiM4cLt7U9X8c/yLaP1pz2A8B8ZeyVoUmEWvV9yhwr4V1 sILqsqp/mk8AIe7lZHciHn7uF/fmTnnZFBHurwlI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fangrui Song , Ilie Halip , Mark Rutland , Catalin Marinas , Sasha Levin , linux-arm-kernel@lists.infradead.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 5.6 29/38] arm64: Delete the space separator in __emit_inst Date: Fri, 24 Apr 2020 08:22:27 -0400 Message-Id: <20200424122237.9831-29-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424122237.9831-1-sashal@kernel.org> References: <20200424122237.9831-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fangrui Song [ Upstream commit c9a4ef66450145a356a626c833d3d7b1668b3ded ] 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 Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/include/asm/sysreg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index b91570ff9db14..931037500e83c 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -49,7 +49,9 @@ #ifndef CONFIG_BROKEN_GAS_INST #ifdef __ASSEMBLY__ -#define __emit_inst(x) .inst (x) +// The space separator is omitted so that __emit_inst(x) can be parsed as +// either an assembler directive or an assembler macro argument. +#define __emit_inst(x) .inst(x) #else #define __emit_inst(x) ".inst " __stringify((x)) "\n\t" #endif -- 2.20.1