Tools: wrap _malloc_r on cygwin

fixes dual allocation heap bug
See https://cygwin.com/pipermail/cygwin/2000-July/038916.html
This commit is contained in:
Andrew Tridgell 2024-07-06 15:50:44 +10:00
parent db19bce1d2
commit 039367e340
1 changed files with 4 additions and 2 deletions

View File

@ -753,8 +753,10 @@ class sitl(Board):
]
# 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: