The following simple program
#include <malloc.h>
int main(int argc, char **argv)
{
char* arr=malloc(10);
arr[10]='\0';
return 0;
}
builds fine with VC2019 16.8.2 in 32 bit dynamic linking
cl -Zi -fsanitize=address -MD clang_rt.asan_dynamic-i386.lib xx.c
and reports the memory error when running the program. However when using the 64bit variant I get a linking error
> cl -Zi -fsanitize=address -MD clang_rt.asan_dynamic-x86_64.lib xx.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
xx.c
Microsoft (R) Incremental Linker Version 14.28.29336.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:xx.exe
/debug
clang_rt.asan_dynamic-x86_64.lib
xx.obj
xx.obj : error LNK2019: unresolved external symbol __asan_shadow_memory_dynamic_address referenced in function main
xx.exe : fatal error LNK1120: 1 unresolved externals
Looking in the clang_rt.asan_dynamic-x86_64.lib
with dumpbin
the missing symbol appears.
Note that on both architectures static linking of the sample (without the _dynamic libs) works, but I need dynamic linking because of larger dependencies (Qt dlls).
Anyone stumbled across that already ?
Regards, Leo