From b9e3fde21a1de61c69e283ab7d756297655a2496 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Tue, 28 Jun 2016 12:30:26 +0100
Subject: [PATCH] qemu-arm: Disable gcc LTO option for nlrthumb.c.

If LTO is enabled for nlrthumb.c then gcc optimises away the nlr_push_tail
function when in fact it is needed.  So disable this option for this file.
---
 qemu-arm/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile
index 31ba6baa2..d09282a1e 100644
--- a/qemu-arm/Makefile
+++ b/qemu-arm/Makefile
@@ -53,6 +53,9 @@ 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
-- 
GitLab