linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation
@ 2023-06-06 22:40 Nathan Chancellor
  2023-06-07 11:00 ` Naresh Kamboju
  2023-06-07 13:39 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2023-06-06 22:40 UTC (permalink / raw)
  To: masahiroy
  Cc: naresh.kamboju, ndesaulniers, nicolas, trix, linux-kbuild,
	linux-kernel, llvm, patches, Linux Kernel Functional Testing,
	Nathan Chancellor

After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to
KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
assembly files with clang:

  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)

as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
result of those missing flags, the host target
will be tested during as-option calls and likely fail, meaning necessary
flags may not get added when building assembly files, resulting in
errors like seen above.

Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
This should have been done in commit d5c8d6e0fa61 ("kbuild: Update
assembler calls to use proper flags and language target"), which
switched from using the assembler target to the assembler-with-cpp
target, so flags that affect preprocessing are passed along in all
relevant tests. as-option now mirrors cc-option.

Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 scripts/Makefile.compiler | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)

---
base-commit: feb843a469fb0ab00d2d23cfb9bcc379791011bb
change-id: 20230606-fix-as-option-after-clang_flags-move-be88e993cbaa

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation
  2023-06-06 22:40 [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation Nathan Chancellor
@ 2023-06-07 11:00 ` Naresh Kamboju
  2023-06-07 13:39 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Naresh Kamboju @ 2023-06-07 11:00 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild,
	linux-kernel, llvm, patches, Linux Kernel Functional Testing

On Wed, 7 Jun 2023 at 04:10, Nathan Chancellor <nathan@kernel.org> wrote:
>
> After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to
> KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
> assembly files with clang:
>
>   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)
>
> as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
> KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
> result of those missing flags, the host target
> will be tested during as-option calls and likely fail, meaning necessary
> flags may not get added when building assembly files, resulting in
> errors like seen above.
>
> Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
> This should have been done in commit d5c8d6e0fa61 ("kbuild: Update
> assembler calls to use proper flags and language target"), which
> switched from using the assembler target to the assembler-with-cpp
> target, so flags that affect preprocessing are passed along in all
> relevant tests. as-option now mirrors cc-option.
>
> Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>

This proposed fix patch applied on top of Linux next and
built with clang and build test pass.
https://storage.tuxsuite.com/public/linaro/naresh/builds/2QsEzqEij2M3F1JkQAQfhpIpsXG/

> ---
>  scripts/Makefile.compiler | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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)
>
> ---
> base-commit: feb843a469fb0ab00d2d23cfb9bcc379791011bb
> change-id: 20230606-fix-as-option-after-clang_flags-move-be88e993cbaa
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>

Best regards
Naresh Kamboju

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation
  2023-06-06 22:40 [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation Nathan Chancellor
  2023-06-07 11:00 ` Naresh Kamboju
@ 2023-06-07 13:39 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2023-06-07 13:39 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: naresh.kamboju, ndesaulniers, nicolas, trix, linux-kbuild,
	linux-kernel, llvm, patches, Linux Kernel Functional Testing

On Wed, Jun 7, 2023 at 7:40 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to
> KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
> assembly files with clang:
>
>   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)
>
> as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
> KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
> result of those missing flags, the host target
> will be tested during as-option calls and likely fail, meaning necessary
> flags may not get added when building assembly files, resulting in
> errors like seen above.
>
> Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
> This should have been done in commit d5c8d6e0fa61 ("kbuild: Update
> assembler calls to use proper flags and language target"), which
> switched from using the assembler target to the assembler-with-cpp
> target, so flags that affect preprocessing are passed along in all
> relevant tests. as-option now mirrors cc-option.
>
> Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---

Applied to linux-kbuild.
Thanks.



>  scripts/Makefile.compiler | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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)
>
> ---
> base-commit: feb843a469fb0ab00d2d23cfb9bcc379791011bb
> change-id: 20230606-fix-as-option-after-clang_flags-move-be88e993cbaa
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-07 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 22:40 [PATCH] kbuild: Add KBUILD_CPPFLAGS to as-option invocation Nathan Chancellor
2023-06-07 11:00 ` Naresh Kamboju
2023-06-07 13:39 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).