Skip to content

Commit

Permalink
fixup! fixup! newlib: add thread safe syscalls
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Dupont committed Feb 27, 2018
1 parent 33860ef commit d05c147
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sys/newlib_thread_safe/Makefile.include
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
UNDEF += $(BINDIR)/newlib_thread_safe/syscalls.o

# define the compile test files
define __has_reent_test
#include <sys/reent.h>\n
endef

define __has_reent_small_test
#include <sys/reent.h>\n
#ifndef _REENT_SMALL\n
#error wasting 1KB\n
#endif\n
endef

# compile the tests
__has_reent := $(shell printf "$(__has_reent_test)" | $(CC) -E $(CFLAGS) $(INCLUDES) - > /dev/null 2>&1 ; echo $$?)
__has_reent_small := $(shell printf "$(__has_reent_small_test)" | $(CC) -E $(CFLAGS) $(INCLUDES) - > /dev/null 2>&1 ; echo $$?)

# check if we use REENT_SMALL
ifeq (0, $(__has_reent))
ifneq (0, $(__has_reent_small))
$(error "MODULE_NEWLIB_THREAD_SAFE defined but _REENT_SMALL not defined")
endif
else
$(error "MODULE_NEWLIB_THREAD_SAFE defined but <sys/reent.h> not found in toolchain path")
endif

0 comments on commit d05c147

Please sign in to comment.