diff mbox series

[1/9] Kbuild: only pass -fno-inline-functions-called-once for gcc

Message ID 20230811140327.3754597-2-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series Kbuild: warning options cleanup and more warnings | expand

Commit Message

Arnd Bergmann Aug. 11, 2023, 2:03 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

clang ignores the -fno-inline-functions-called-once option, but warns
when building with -Wignored-optimization-argument enabled:

clang: error: optimization flag '-fno-inline-functions-called-once' is not supported [-Werror,-Wignored-optimization-argument]

Move it back to using cc-option for this one.

Fixes: 7d73c3e9c514 ("Makefile: remove stale cc-option checks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nathan Chancellor Aug. 11, 2023, 2:14 p.m. UTC | #1
On Fri, Aug 11, 2023 at 04:03:19PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> clang ignores the -fno-inline-functions-called-once option, but warns
> when building with -Wignored-optimization-argument enabled:
> 
> clang: error: optimization flag '-fno-inline-functions-called-once' is not supported [-Werror,-Wignored-optimization-argument]
> 
> Move it back to using cc-option for this one.
> 
> Fixes: 7d73c3e9c514 ("Makefile: remove stale cc-option checks")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

How can this even be hit with clang, as CONFIG_DEBUG_SECTION_MISMATCH
was changed to depend on GCC in the same commit?

> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index bf5a6100cf66e..991c02f8e9ac0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -967,7 +967,7 @@ endif
>  
>  # We trigger additional mismatches with less inlining
>  ifdef CONFIG_DEBUG_SECTION_MISMATCH
> -KBUILD_CFLAGS += -fno-inline-functions-called-once
> +KBUILD_CFLAGS += $(call cc-option,-fno-inline-functions-called-once)
>  endif
>  
>  # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0).
> -- 
> 2.39.2
>
Arnd Bergmann Aug. 11, 2023, 2:23 p.m. UTC | #2
On Fri, Aug 11, 2023, at 16:14, Nathan Chancellor wrote:
> On Fri, Aug 11, 2023 at 04:03:19PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> clang ignores the -fno-inline-functions-called-once option, but warns
>> when building with -Wignored-optimization-argument enabled:
>> 
>> clang: error: optimization flag '-fno-inline-functions-called-once' is not supported [-Werror,-Wignored-optimization-argument]
>> 
>> Move it back to using cc-option for this one.
>> 
>> Fixes: 7d73c3e9c514 ("Makefile: remove stale cc-option checks")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> How can this even be hit with clang, as CONFIG_DEBUG_SECTION_MISMATCH
> was changed to depend on GCC in the same commit?

Good question, I have not noticed that part, but I'm pretty
sure I keep hitting this issue. I'll drop it from my
series to see if I can reproduce it.

Maybe what happens is that this triggers when changing from
gcc to clang in an output directory, the stake CONFIG_*
symbols are still evaluated while parsing the initial
Makefile but then cause problems.

     Arnd
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index bf5a6100cf66e..991c02f8e9ac0 100644
--- a/Makefile
+++ b/Makefile
@@ -967,7 +967,7 @@  endif
 
 # We trigger additional mismatches with less inlining
 ifdef CONFIG_DEBUG_SECTION_MISMATCH
-KBUILD_CFLAGS += -fno-inline-functions-called-once
+KBUILD_CFLAGS += $(call cc-option,-fno-inline-functions-called-once)
 endif
 
 # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0).