Re: powerpc: clang: arch/powerpc/kernel/exceptions-64s.S:2976: Error: junk at end of line: `0b01010'

From: Nathan Chancellor
Date: Tue Jun 06 2023 - 11:32:00 EST


Hi Naresh,

On Tue, Jun 06, 2023 at 01:57:46PM +0530, Naresh Kamboju wrote:
> Linux next-20230606 powerpc build failed.
>
> Regressions found on powerpc:
>
> - build/clang-16-maple_defconfig
> - build/clang-nightly-maple_defconfig
> - build/clang-16-defconfig
> - build/clang-nightly-defconfig
> - build/clang-nightly-cell_defconfig
> - build/clang-16-cell_defconfig
>
> Boot:
> =====
> make --silent --keep-going --jobs=8
> O=/home/tuxbuild/.cache/tuxmake/builds/1/build ARCH=powerpc
> CROSS_COMPILE=powerpc64le-linux-gnu-
> HOSTCC=clang
> CC=clang
> LLVM=1
> LLVM_IAS=0
> LD=powerpc64le-linux-gnu-ld
>
> arch/powerpc/kernel/exceptions-64s.S: Assembler messages:
> arch/powerpc/kernel/exceptions-64s.S:2976: Error: junk at end of line: `0b01010'
> arch/powerpc/kernel/exceptions-64s.S:2996: Error: junk at end of line: `0b01010'
> arch/powerpc/kernel/exceptions-64s.S:3011: Error: junk at end of line: `0b01010'
> arch/powerpc/kernel/exceptions-64s.S:3029: Error: junk at end of line: `0b01010'
> arch/powerpc/kernel/exceptions-64s.S:3049: Error: junk at end of line: `0b01010'
> arch/powerpc/kernel/exceptions-64s.S:3096: Error: junk at end of line: `0b01010'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [scripts/Makefile.build:374: arch/powerpc/kernel/head_64.o] Error 1
> arch/powerpc/kernel/entry_64.S: Assembler messages:
> arch/powerpc/kernel/entry_64.S:174: Error: junk at end of line: `0b01010'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [scripts/Makefile.build:374:
> arch/powerpc/kernel/entry_64.o] Error 1
> make[4]: Target 'arch/powerpc/kernel/' not remade because of errors.
> make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
> arch/powerpc/lib/copyuser_power7.S: Assembler messages:
> arch/powerpc/lib/copyuser_power7.S:305: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/copyuser_power7.S:306: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/copyuser_power7.S:308: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/copyuser_power7.S:309: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/copyuser_power7.S:311: Error: junk at end of line: `0b01010'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [scripts/Makefile.build:374:
> arch/powerpc/lib/copyuser_power7.o] Error 1
> arch/powerpc/lib/copypage_power7.S: Assembler messages:
> arch/powerpc/lib/copypage_power7.S:34: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/copypage_power7.S:35: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/copypage_power7.S:37: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/copypage_power7.S:38: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/copypage_power7.S:40: Error: junk at end of line: `0b01010'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [scripts/Makefile.build:374:
> arch/powerpc/lib/copypage_power7.o] Error 1
> arch/powerpc/lib/memcpy_power7.S: Assembler messages:
> arch/powerpc/lib/memcpy_power7.S:250: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/memcpy_power7.S:251: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/memcpy_power7.S:252: Error: junk at end of line: `0b01000'
> arch/powerpc/lib/memcpy_power7.S:253: Error: junk at end of line: `0b01010'
> arch/powerpc/lib/memcpy_power7.S:255: Error: junk at end of line: `0b01010'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [scripts/Makefile.build:374:
> arch/powerpc/lib/memcpy_power7.o] Error 1
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

Thank you for the report, this is caused by the move of CLANG_FLAGS from
KBUILD_{A,C}FLAGS to KBUILD_CPPFLAGS, as as-option does not contain
KBUILD_CPPFLAGS, so we fail to pass necessary flags to the assembler.
The following diff resolves this particular issue for me, can you test
it to make sure it works for you? I will write up a changelog and sent
along a formal patch later today.

Cheers,
Nathan

diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 437013f8def3..e31f18625fcf 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -32,7 +32,7 @@ try-run = $(shell set -e; \
# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)

as-option = $(call try-run,\
- $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))

# as-instr
# Usage: aflags-y += $(call as-instr,instr,option1,option2)