Skip to content

Commit ce81c8d

Browse files
dhalberttannewt
authored andcommitted
Avoid gcc 7.2.1 compiler issues in nlr_push() (adafruit#506)
Avoid gcc 7.2.1 compiler issues in nlr_push()
1 parent 3be4566 commit ce81c8d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ports/atmel-samd/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ endif
9292
ifeq ($(DEBUG), 1)
9393
# Turn on Python modules useful for debugging (e.g. uheap, ustack).
9494
CFLAGS += -ggdb
95+
CFLAGS += -flto
9596
ifeq ($(CHIP_FAMILY), samd21)
9697
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
9798
endif
@@ -122,8 +123,6 @@ ifeq ($(CHIP_FAMILY), samd51)
122123
CFLAGS += \
123124
-mthumb \
124125
-mabi=aapcs-linux \
125-
-mlong-calls \
126-
-mtune=cortex-m4 \
127126
-mcpu=cortex-m4 \
128127
-mfloat-abi=hard \
129128
-mfpu=fpv4-sp-d16 \

py/nlrthumb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
7474
#else
7575
"b nlr_push_tail \n" // do the rest in C
7676
#endif
77-
);
77+
: // output operands
78+
: "r" (nlr) // input operands
79+
// Do not use r1, r2, r3 as temporary saving registers.
80+
// gcc 7.2.1 started doing this, and r3 got clobbered in nlr_push_tail.
81+
// See https://github.com/adafruit/circuitpython/issues/500 for details.
82+
: "r1", "r2", "r3" // clobbers
83+
);
7884

7985
return 0; // needed to silence compiler warning
8086
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy