Index: lib/asan/asan_linux.cc =================================================================== --- lib/asan/asan_linux.cc +++ lib/asan/asan_linux.cc @@ -39,6 +39,17 @@ #include #endif +// x64 FreeBSD 9.2 and older define 64-bit register names in both 64-bit +// and 32-bit modes. +#if SANITIZER_FREEBSD +#include +# if __FreeBSD_version <= 902001 // v9.2 +# define mc_eip mc_rip +# define mc_ebp mc_rbp +# define mc_esp mc_rsp +# endif +#endif + extern "C" void* _DYNAMIC; namespace __asan { Index: lib/asan/tests/CMakeLists.txt =================================================================== --- lib/asan/tests/CMakeLists.txt +++ lib/asan/tests/CMakeLists.txt @@ -34,6 +34,13 @@ -O2) append_if(ASAN_UNITTEST_COMMON_CFLAGS COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros) +# System headers incorrectly define 'size_t' as 'unsigned long' on +# x64 FreeBSD 9.2 whereas 'unsigned int' is expected. +if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND + CMAKE_SIZEOF_VOID_P MATCHES "8") + list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -D_SIZE_T_DECLARED) +endif() + # Use -D instead of definitions to please custom compile command. list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -DASAN_HAS_BLACKLIST=1