From: Andrew Cooper Date: Fri, 21 Oct 2016 18:16:09 +0000 (+0100) Subject: Experimental support for LTO builds, by passing lto=y to make X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8ebc31bc85546a265aa0dbd26fda88b9b195fa2e;p=people%2Fandrewcoop%2Fxen-test-framework.git Experimental support for LTO builds, by passing lto=y to make This works with Clang 4.0. It is broken with Clang 3.8, as the LTO build ignore -mno-sse and "optimises" SSE instructions back into the binary. Unknown with any other compilers. Signed-off-by: Andrew Cooper --- diff --git a/build/common.mk b/build/common.mk index 982e43e..2cfe386 100644 --- a/build/common.mk +++ b/build/common.mk @@ -17,8 +17,13 @@ $(foreach env,$(64BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_64)) COMMON_FLAGS := -pipe -I$(ROOT)/include -I$(ROOT)/arch/x86/include -MMD -MP +# Experimental LTO support. `make ... lto=y` +COMMON_CFLAGS-$(lto) := -flto +LDFLAGS-$(lto) := -flto -B /usr/lib/gold-ld + COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__ -COMMON_CFLAGS := $(COMMON_FLAGS) -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g +COMMON_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y) +COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g COMMON_CFLAGS += -fno-common -fno-asynchronous-unwind-tables -fno-strict-aliasing COMMON_CFLAGS += -fno-stack-protector -ffreestanding COMMON_CFLAGS += -mno-red-zone -mno-sse