From: Patrick Steinhardt Date: Wed, 12 Nov 2025 11:26:13 GMT Subject: Re: [PATCH 3/9] Makefile: turn on NO_MMAP when building with ASan Message-ID: In-Reply-To: <20251112080215.GC979063@coredump.intra.peff.net> On Wed, Nov 12, 2025 at 03:02:15AM -0500, Jeff King wrote: > diff --git a/Makefile b/Makefile > index 7e0f77e298..0f44268405 100644 > --- a/Makefile > +++ b/Makefile > @@ -1587,6 +1587,7 @@ SANITIZE_LEAK = YesCompiledWithIt > endif > ifneq ($(filter address,$(SANITIZERS)),) > NO_REGEX = NeededForASAN > +NO_MMAP = NeededForASAN > SANITIZE_ADDRESS = YesCompiledWithIt > endif > endif Let's also apply this to Meson. Thanks! Patrick diff --git a/meson.build b/meson.build index ad4eb2c4fa..668f8769d2 100644 --- a/meson.build +++ b/meson.build @@ -1408,12 +1408,18 @@ if host_machine.system() == 'windows' libgit_c_args += '-DUSE_WIN32_MMAP' else checkfuncs += { - 'mmap' : ['mmap.c'], # provided by compat/mingw.c. 'unsetenv' : ['unsetenv.c'], # provided by compat/mingw.c. 'getpagesize' : [], } + + if get_option('b_sanitize').contains('address') + libgit_c_args += '-DNO_MMAP' + libgit_sources += 'compat/mmap.c' + else + checkfuncs += { 'mmap': ['mmap.c'] } + endif endif foreach func, impls : checkfuncs