From f43834aba2ed9f8f69d961a6554bc81ecaa98f08 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 21 May 2020 11:27:09 +1000 Subject: 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 #6053. --- py/py.mk | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'py') diff --git a/py/py.mk b/py/py.mk index 3cb505920..3e1d7989f 100644 --- a/py/py.mk +++ b/py/py.mk @@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/ $(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h +# Standard C functions like memset need to be compiled with special flags so +# the compiler does not optimise these functions in terms of themselves. +CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto +$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) + # Force nlr code to always be compiled with space-saving optimisation so # that the function preludes are of a minimal and predictable form. $(PY_BUILD)/nlr%.o: CFLAGS += -Os -- cgit v1.2.3