Merge pull request #5319 from tannewt/fix_nrf_gcc11

Fix the nRF builds with GCC 11.2
This commit is contained in:
microDev 2021-09-09 09:09:34 +05:30 committed by GitHub
commit 09859a60e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,6 +103,18 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
# Nordic Softdevice SDK header files contains inline assembler that has
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
# is able to "prove" that arguments to wrapper functions generated with
# the SVCALL() macro are unused and, as a result, the optimizer will remove
# code within the callers that sets up these arguments (which results in
# a broken bootloader). The broken headers come from Nordic-supplied zip
# files and are not trivial to patch so, for now, we'll simply disable the
# new gcc-11 inter-procedural optimizations.
ifeq (,$(findstring unrecognized,$(shell $(CC) $(CFLAGS) -fno-ipa-modref 2>&1)))
CFLAGS += -fno-ipa-modref
endif
# Undo some warnings.
# nrfx does casts that increase alignment requirements.
CFLAGS += -Wno-cast-align