Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: Drop nonsensical -O6

-O6 is very much not-a-thing. Really, this should've been dropped
entirely in 49b3cd306e60b9d8 ("tools: Set the maximum optimization level
according to the compiler being used") instead of just passing it for
not-Clang.

Just collapse it down to -O3, instead of "-O6 unless Clang, in which case
-O3".

GCC interprets > -O3 as -O3. It doesn't even interpret > -O3 as -Ofast,
which is a good thing, given -Ofast has specific (non-)requirements for
code built using it. So, this does nothing except look a bit daft.

Remove the silliness and also save a few lines in the Makefiles accordingly.

Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Jesper Juhl <jesperjuhl76@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/4f01524fa4ea91c7146a41e26ceaf9dae4c127e4.1725821201.git.sam@gentoo.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Sam James and committed by
Arnaldo Carvalho de Melo
eb9b9a6f 89c0a55e

+2 -16
-4
tools/lib/api/Makefile
··· 31 31 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC 32 32 33 33 ifeq ($(DEBUG),0) 34 - ifeq ($(CC_NO_CLANG), 0) 35 34 CFLAGS += -O3 36 - else 37 - CFLAGS += -O6 38 - endif 39 35 endif 40 36 41 37 ifeq ($(DEBUG),0)
+1 -3
tools/lib/subcmd/Makefile
··· 38 38 39 39 ifeq ($(DEBUG),1) 40 40 CFLAGS += -O0 41 - else ifeq ($(CC_NO_CLANG), 0) 42 - CFLAGS += -O3 43 41 else 44 - CFLAGS += -O6 42 + CFLAGS += -O3 45 43 endif 46 44 47 45 # Treat warnings as errors unless directed not to
-4
tools/lib/symbol/Makefile
··· 31 31 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu11 -U_FORTIFY_SOURCE -fPIC 32 32 33 33 ifeq ($(DEBUG),0) 34 - ifeq ($(CC_NO_CLANG), 0) 35 34 CFLAGS += -O3 36 - else 37 - CFLAGS += -O6 38 - endif 39 35 endif 40 36 41 37 ifeq ($(DEBUG),0)
+1 -5
tools/perf/Makefile.config
··· 233 233 234 234 ifeq ($(DEBUG),0) 235 235 CORE_CFLAGS += -DNDEBUG=1 236 - ifeq ($(CC_NO_CLANG), 0) 237 - CORE_CFLAGS += -O3 238 - else 239 - CORE_CFLAGS += -O6 240 - endif 236 + CORE_CFLAGS += -O3 241 237 else 242 238 CORE_CFLAGS += -g 243 239 CXXFLAGS += -g