From b750e10c9f2e51fea2afdd0cdd72629e3f98d3d6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Jul 2023 14:55:37 +1000 Subject: [PATCH] waf: wrap newlib alloc functions on ChibiOS this prevents scripting and string library functions from calling sbrk based alloction functions that are not thread safe --- Tools/ardupilotwaf/chibios.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/ardupilotwaf/chibios.py b/Tools/ardupilotwaf/chibios.py index 04d93eb872..46d2bb2ca0 100644 --- a/Tools/ardupilotwaf/chibios.py +++ b/Tools/ardupilotwaf/chibios.py @@ -699,6 +699,7 @@ def build(bld): 'fopen', 'fflush', 'fwrite', 'fread', 'fputs', 'fgets', 'clearerr', 'fseek', 'ferror', 'fclose', 'tmpfile', 'getc', 'ungetc', 'feof', 'ftell', 'freopen', 'remove', 'vfprintf', 'fscanf', - '_gettimeofday', '_times', '_times_r', '_gettimeofday_r', 'time', 'clock' ] + '_gettimeofday', '_times', '_times_r', '_gettimeofday_r', 'time', 'clock', + '_sbrk_r', '_malloc_r', '_calloc_r', '_free_r'] for w in wraplist: bld.env.LINKFLAGS += ['-Wl,--wrap,%s' % w]