]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Experimental support for LTO builds, by passing lto=y to make
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 21 Oct 2016 18:16:09 +0000 (19:16 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 May 2017 16:00:33 +0000 (17:00 +0100)
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 <andrew.cooper3@citrix.com>
build/common.mk

index 982e43e2848dfbf18c4c5fb14211911b5f5d00a7..2cfe38679cb04ee82450ac56565ee968ecc1af31 100644 (file)
@@ -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