https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90312
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Bence Szabó from comment #3) > Thank you for the patch! > > The main blocker is some msvc specific code in sanitizer_win_defs.h. > WIN_FORCE_LINK, WIN_WEAK_ALIAS, WIN_EXPORT > > AFAIK the sanitizer is from LLVM (or google?) Yes, libsanitizer is part of LLVM and we copy the run-time library. > and the official llvm build > for windows is using msvc. So probably no-one has ever tried to compile this > for windows with gcc. Hard to guess, but I would expect usage of llvm. That said, I would create a PR here: https://github.com/google/sanitizers/issues and ask about LLVM + sanitizers being used for mingw. > > The build dies early in libsanitizer with: > > libtool: compile: /c/GIT/gcc/trunk_build/./gcc/xgcc -shared-libgcc > -B/c/GIT/gcc/trunk_build/./gcc -nostdinc++ > -L/c/GIT/gcc/trunk_build/x86_64-w64-mingw32/libstdc++-v3/src > -L/c/GIT/gcc/trunk_build/x86_64-w64-mingw32/libstdc++-v3/src/.libs > -L/c/GIT/gcc/trunk_build/x86_64-w64-mingw32/libstdc++-v3/libsupc++/.libs > -L/c/mingw_83_build/x86_64-w64-mingw32/lib -L/c/mingw_83_build/mingw/lib > -isystem /c/mingw_83_build/x86_64-w64-mingw32/include -isystem > /c/mingw_83_build/mingw/include -B/c/mingw_83_build/x86_64-w64-mingw32/bin/ > -B/c/mingw_83_build/x86_64-w64-mingw32/lib/ -isystem > /c/mingw_83_build/x86_64-w64-mingw32/include -isystem > /c/mingw_83_build/x86_64-w64-mingw32/sys-include -D_GNU_SOURCE -D_DEBUG > -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS > -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I. > -I../../../../trunk_src/libsanitizer/sanitizer_common -I.. -I > ../../../../trunk_src/libsanitizer/include -isystem > ../../../../trunk_src/libsanitizer/include/system -Wall -W > -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC > -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables > -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include > -I../../libstdc++-v3/include/x86_64-w64-mingw32 > -I../../../../trunk_src/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 > -g -O2 -pipe -fno-ident > -I/c/GIT/gcc/prerequisites/x86_64-w64-mingw32-static/include -MT > sanitizer_common.lo -MD -MP -MF .deps/sanitizer_common.Tpo -c > ../../../../trunk_src/libsanitizer/sanitizer_common/sanitizer_common.cc > -DDLL_EXPORT -DPIC -o .libs/sanitizer_common.o > In file included from > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_internal_defs.h: > 58, > from > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_flags.h:15, > from > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_common.h:17, > from > ../../../../trunk_src/libsanitizer/sanitizer_common/sanitizer_common.cc:12: > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_win_defs.h:66: > 11: error: expected constructor, destructor, or type conversion before '(' > token > 66 | __pragma(comment(linker, "/alternatename:" WIN_SYM_PREFIX > STRINGIFY(Name) "="\ > | ^ > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_win_defs.h:94:3: > note: in expansion of macro 'WIN_WEAK_ALIAS' > 94 | WIN_WEAK_ALIAS(Name, WEAK_DEFAULT_NAME(Name)) > \ > | ^~~~~~~~~~~~~~ > c:\git\gcc\trunk_src\libsanitizer\sanitizer_common\sanitizer_internal_defs.h: > 60:3: note: in expansion of macro 'WIN_WEAK_EXPORT_DEF' > 60 | WIN_WEAK_EXPORT_DEF(ReturnType, Name, __VA_ARGS__) > | ^~~~~~~~~~~~~~~~~~~ > ../../../../trunk_src/libsanitizer/sanitizer_common/sanitizer_common.cc:328: > 1: note: in expansion of macro 'SANITIZER_INTERFACE_WEAK_DEF' > 328 | SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_report_error_summary, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > make[4]: *** [Makefile:663: sanitizer_common.lo] Error 1 > > Same goes for WIN_FORCE_LINK