Skip to content

Commit 9626662

Browse files
tralamazzadpgeorge
authored andcommitted
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.
1 parent 7711d87 commit 9626662

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

py/nlrthumb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
7171
return 0; // needed to silence compiler warning
7272
}
7373

74-
unsigned int nlr_push_tail(nlr_buf_t *nlr) {
74+
__attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr) {
7575
nlr_buf_t **top = &MP_STATE_THREAD(nlr_top);
7676
nlr->prev = *top;
7777
*top = nlr;

qemu-arm/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o))
5353
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
5454
OBJ_TEST += $(BUILD)/tinytest.o
5555

56-
# we can't use LTO for nlrthumb.c because it contains inline assembler
57-
$(PY_BUILD)/nlrthumb.o: CFLAGS += -fno-lto
58-
5956
all: run
6057

6158
run: $(BUILD)/firmware.elf

0 commit comments

Comments
 (0)