10000 Merge pull request #5319 from tannewt/fix_nrf_gcc11 · urish/circuitpython@09859a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 09859a6

Browse files
authored
Merge pull request adafruit#5319 from tannewt/fix_nrf_gcc11
Fix the nRF builds with GCC 11.2
2 parents d3ab761 + f2de010 commit 09859a6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ports/nrf/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
103103

104104
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
105105

106+
# Nordic Softdevice SDK header files contains inline assembler that has
107+
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
108+
# is able to "prove" that arguments to wrapper functions generated with
109+
# the SVCALL() macro are unused and, as a result, the optimizer will remove
110+
# code within the callers that sets up these arguments (which results in
111+
# a broken bootloader). The broken headers come from Nordic-supplied zip
112+
# files and are not trivial to patch so, for now, we'll simply disable the
113+
# new gcc-11 inter-procedural optimizations.
114+
ifeq (,$(findstring unrecognized,$(shell $(CC) $(CFLAGS) -fno-ipa-modref 2>&1)))
115+
CFLAGS += -fno-ipa-modref
116+
endif
117+
106118
# Undo some warnings.
107119
# nrfx does casts that increase alignment requirements.
108120
CFLAGS += -Wno-cast-align

0 commit comments

Comments
 (0)
0