linux-brain/arch/arm64
Fangrui Song 54530dd3be arm64: Delete the space separator in __emit_inst
[ 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 <ilie.halip@gmail.com>
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/939
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-05-02 17:25:58 +02:00
..
boot arm64: dts: allwinner: h6: Fix PMU compatible 2020-04-17 10:48:50 +02:00
configs arm64: defconfig: Re-enable bcm2835-thermal driver 2020-01-27 14:50:10 +01:00
crypto crypto: arm64/sha2-ce - correct digest for empty data in finup 2019-07-26 09:14:19 +02:00
include arm64: Delete the space separator in __emit_inst 2020-05-02 17:25:58 +02:00
kernel arm64: Silence clang warning on mismatched value/register sizes 2020-04-29 16:31:09 +02:00
kvm arm64: nofpsmid: Handle TIF_FOREIGN_FPSTATE flag cleanly 2020-02-19 19:51:54 +01:00
lib arm64: lib: use C string functions with KASAN enabled 2019-12-01 09:17:01 +01:00
mm arm64: Revert support for execute-only user mappings 2020-01-09 10:19:03 +01:00
net bpf, arm64: use more scalable stadd over ldxr / stxr loop in xadd 2019-07-03 13:14:49 +02:00
xen arm64: mm: Add additional parameter to uaccess_ttbr0_disable 2018-01-17 13:57:49 +01:00
Kconfig arm64: errata: Hide CTR_EL0.DIC on systems affected by Neoverse-N1 #1542419 2020-04-29 16:31:08 +02:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Kconfig.platforms ARM: SoC: late updates 2018-08-25 14:12:36 -07:00
Makefile arm64: makefile fix build of .i file in external module case 2019-12-01 09:17:14 +01:00