Skip to content

Commit

Permalink
lib: libc: Build with -fno-builtin
Browse files Browse the repository at this point in the history
Without -fno-builtin the compiler might attempt to optimize the libc
code by replacing loops with calls to libc code, potentially causing
infinite loops. This seems to cause problems on some platforms with
GCC 12.
  • Loading branch information
stephan-gh committed Jun 18, 2022
1 parent 77edf0c commit 1b36977
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/libc/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ OBJS += \
$(LOCAL_DIR)/rand.o \
$(LOCAL_DIR)/eabi.o

# Without -fno-builtin the compiler might attempt to optimize the libc code by
# replacing loops with calls to libc code, potentially causing infinite loops.
$(BUILDDIR)/$(LOCAL_DIR)/%.o: CFLAGS := $(CFLAGS) -fno-builtin

include $(LOCAL_DIR)/string/rules.mk

Expand Down

0 comments on commit 1b36977

Please sign in to comment.