From 9626662819ebd677106ba2655c4370912bef8588 Mon Sep 17 00:00:00 2001 From: Daniel Tralamazza Date: Fri, 8 Jul 2016 15:46:01 +0200 Subject: [PATCH] qemu-arm: Enable gcc LTO option for nlrthumb.c LTO can't "see" inside naked functions, but we can mark `nlr_push_tail` as used. --- py/nlrthumb.c | 2 +- qemu-arm/Makefile | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/py/nlrthumb.c b/py/nlrthumb.c index a61c73c036..b57d8df464 100644 --- a/py/nlrthumb.c +++ b/py/nlrthumb.c @@ -71,7 +71,7 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) { return 0; // needed to silence compiler warning } -unsigned int nlr_push_tail(nlr_buf_t *nlr) { +__attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr) { nlr_buf_t **top = &MP_STATE_THREAD(nlr_top); nlr->prev = *top; *top = nlr; diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile index d09282a1e8..31ba6baa26 100644 --- a/qemu-arm/Makefile +++ b/qemu-arm/Makefile @@ -53,9 +53,6 @@ OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o)) OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ_TEST += $(BUILD)/tinytest.o -# we can't use LTO for nlrthumb.c because it contains inline assembler -$(PY_BUILD)/nlrthumb.o: CFLAGS += -fno-lto - all: run run: $(BUILD)/firmware.elf