diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index f3b35585af3b94..82982c9ab65ec5 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -753,8 +753,10 @@ def configure_env(self, cfg, env): ] # wrap malloc to ensure memory is zeroed - # don't do this on MacOS as ld doesn't support --wrap - if platform.system() != 'Darwin': + if cfg.env.DEST_OS == 'cygwin': + # on cygwin we need to wrap _malloc_r instead + env.LINKFLAGS += ['-Wl,--wrap,_malloc_r'] + elif platform.system() != 'Darwin': env.LINKFLAGS += ['-Wl,--wrap,malloc'] if cfg.options.enable_sfml: