8000 py/py.mk: Use additional CFLAGS to compile string0.c. · ansonhex/circuitpython@f43834a · GitHub
[go: up one dir, main page]

Skip to content

Commit f43834a

Browse files
dpgeorgetannewt
authored andcommitted
py/py.mk: Use additional CFLAGS to compile string0.c.
Otherwise functions like memset might get optimised to call themselves (eg with gcc 10). And provide CFLAGS_BUILTIN so these options can be changed by a port if needed. Fixes issue adafruit#6053.
1 parent 2bd6d05 commit f43834a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

py/py.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/
346346

347347
$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h
348348

349+
# Standard C functions like memset need to be compiled with special flags so
350+
# the compiler does not optimise these functions in terms of themselves.
351+
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
352+
$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN)
353+
349354
# Force nlr code to always be compiled with space-saving optimisation so
350355
# that the function preludes are of a minimal and predictable form.
351356
$(PY_BUILD)/nlr%.o: CFLAGS += -Os

0 commit comments

Comments
 (0)
0