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

tools: Set the maximum optimization level according to the compiler being used

To avoid this when using clang:

warning: optimization level '-O6' is not supported; using '-O3' instead

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-kaghp8ddvzdsg03putemcq96@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+18 -2
+7 -1
tools/lib/api/Makefile
··· 17 17 LIBFILE = $(OUTPUT)libapi.a 18 18 19 19 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 20 - CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 20 + CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 21 + 22 + ifeq ($(CC), clang) 23 + CFLAGS += -O3 24 + else 25 + CFLAGS += -O6 26 + endif 21 27 22 28 # Treat warnings as errors unless directed not to 23 29 ifneq ($(WERROR),0)
+7 -1
tools/lib/subcmd/Makefile
··· 19 19 LIBFILE = $(OUTPUT)libsubcmd.a 20 20 21 21 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 22 - CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 22 + CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 23 + 24 + ifeq ($(CC), clang) 25 + CFLAGS += -O3 26 + else 27 + CFLAGS += -O6 28 + endif 23 29 24 30 # Treat warnings as errors unless directed not to 25 31 ifneq ($(WERROR),0)
+4
tools/perf/Makefile.config
··· 144 144 endif 145 145 146 146 ifeq ($(DEBUG),0) 147 + ifeq ($(CC), clang) 148 + CFLAGS += -O3 149 + else 147 150 CFLAGS += -O6 151 + endif 148 152 endif 149 153 150 154 ifdef PARSER_DEBUG