From 9cf054fe964d47db5de33542992c47d38b1bead8 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Mon, 3 Nov 2014 11:50:01 +0100 Subject: [PATCH 1/2] make: optionally add gcc lto flags This commit enables building using link time optimization when specifying "LTO=yes" in the application's Makefile. --- Makefile.cflags | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.cflags b/Makefile.cflags index ba94fa89c9..eccfb6b33f 100644 --- a/Makefile.cflags +++ b/Makefile.cflags @@ -41,3 +41,9 @@ endif # Unwanted flags for c++ CXXUWFLAGS += -std=% + +ifeq ($(LTO),yes) + LTOFLAGS = -flto -ffat-lto-objects + CFLAGS += ${LTOFLAGS} + LINKFLAGS += ${LTOFLAGS} +endif From 9fffd99493f5a97018f2244e274b7ec9984e67de Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 28 Nov 2014 18:22:50 +0100 Subject: [PATCH 2/2] stm32f1: mark interrupt vector table as __attribute__((used)) Enables gcc LTO for stm32f1 based boards --- cpu/stm32f1/startup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32f1/startup.c b/cpu/stm32f1/startup.c index 2eea683c81..0e13583593 100644 --- a/cpu/stm32f1/startup.c +++ b/cpu/stm32f1/startup.c @@ -188,7 +188,7 @@ void isr_dma2_ch4_5(void) __attribute__ ((weak, alias("dummy_handler"))); /* interrupt vector table */ -__attribute__ ((section(".vectors"))) +__attribute__ ((section(".vectors"))) __attribute__((used)) const void *interrupt_vector[] = { /* Stack pointer */ (void*) (&_estack), /* pointer to the top of the empty stack */