From 9414b6b98ed18d4c3b444a233ee181a4ce1b213b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 27 Sep 2018 06:22:04 -0700 Subject: [PATCH] makefile: restore -O2 to clang non-debug builds - clang's list of optimization options makes no mention of strict-overflow or no-strict-overflow, but it silently accepts -fno-strict-overflow and in fact honors it. --- makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 62c797fa..7da00764 100644 --- a/makefile +++ b/makefile @@ -1043,16 +1043,15 @@ ifneq ($(DEBUG),) BUILD_FEATURES = - debugging support else ifneq (,$(findstring clang,$(COMPILER_NAME))$(findstring LLVM,$(COMPILER_NAME))) - CFLAGS_O = -O0 - ifeq (Darwin,$(OSTYPE)) - NO_LTO = 1 - endif + CFLAGS_O = -O2 -fno-strict-overflow + GCC_OPTIMIZERS_CMD = $(GCC) --help + NO_LTO = 1 else NO_LTO = 1 ifeq (Darwin,$(OSTYPE)) - CFLAGS_O += -O4 -fno-strict-overflow -flto -fwhole-program + CFLAGS_O += -O4 -flto -fwhole-program else - CFLAGS_O := -O2 -fno-strict-overflow + CFLAGS_O := -O2 endif endif LDFLAGS_O = @@ -1061,6 +1060,8 @@ else ifeq (,$(GCC_OPTIMIZERS_CMD)) GCC_OPTIMIZERS_CMD = $(GCC) --help=optimizers endif + endif + ifneq (,$(GCC_OPTIMIZERS_CMD)) GCC_OPTIMIZERS = $(shell $(GCC_OPTIMIZERS_CMD)) endif ifneq (,$(findstring $(GCC_VERSION),$(LTO_EXCLUDE_VERSIONS)))