0

I NEED to compile my sources files with the options

clang++ ... -flto -fno-fat-lto-objects foo.cpp

this generates following output

warning: optimization flag '-fno-fat-lto-objects' is not supported

Does somebody know an additional flag or something like that, which can be passed to the compiler and which suppress this warning?

Thanks!

ge45mue
  • 677
  • 8
  • 23
  • 4
    Why do you need to compile it with this option if the compiler does not support it? Why do you expect that it would do something if you add that option? – t.niese Mar 01 '19 at 20:14
  • Yes I could remove the flag, but this flag is added automatically by an process and I don't want to change something in this setup – ge45mue Mar 01 '19 at 20:16
  • 1
    You could make a thunk `myclang++` script that looks at each argument and throws out the bad apple, then invokes clang++ with the rest of the arguments. – Eljay Mar 01 '19 at 20:17
  • E.g. for unused arguments I can add -Qunused-paramters and clang supress/quiets this warning. I search the same for the not supported optimization flag warning. – ge45mue Mar 01 '19 at 20:19
  • I am not aware of any CLang flag which would make it silently swallow an option it doesn't understand, nor do I think having such a flag would be a generally good idea. You can use a wrapper script, though. – SergeyA Mar 01 '19 at 20:20
  • https://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i – ge45mue Mar 01 '19 at 20:25
  • Possible duplicate of [How to silence unused command line argument error with clang without disabling it?](https://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i) – t.niese Mar 02 '19 at 07:19

2 Answers2

0

-Wno-ignored-optimization-argument option should work. See -Wignored-optimization-argument for details:

This diagnostic is enabled by default.

Diagnostic text:

warning: optimization flag ‘A’ is not supported for target ‘B’ warning: optimization flag ‘A’ is not supported

Jingguo Yao
  • 7,320
  • 6
  • 50
  • 63
  • Generally, answers are much more helpful if they include an explanation of what the code or commands are intended to do, and why that solves the problem. – geertjanvdk Jan 24 '21 at 09:12
  • This flag does not work for me. I use clang-tidy as a cmake co_compile job for a GCC build so that I need to suppress this flag. – The Shmoo Jan 21 '22 at 09:25
-2

Please kindly follow the below patch, try to modify again. Tested kernel 5.15, worked successfully.

--- a/Makefile
+++ b/Makefile
@@ -958,7 +958,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
gary Feng
  • 1
  • 1
  • It's not clear how adding `-fno-inline-functions-called-once` would solve the issue of an optimization flag not being supported. Additionally, the "patch" provided is completely arbitrary and would not apply for the author unless they had the exact same Makefile. Please do not post diff patch answers like this, and consider writing answers with some details about _why_ the fix provided addresses the problem asked. – Human-Compiler May 25 '22 at 22:08