Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 328 by [email protected]: Error linking when building a program that calls calloc with clang-cl's address-sanitizer and -MTd
http://code.google.com/p/address-sanitizer/issues/detail?id=328

$ cat foo.cpp
#include <stdlib.h>
int f() {
 calloc(1, 1);
 return 1;
}

$ clang-cl -fsanitize=address -c foo.cpp -MTd

$ clang-cl -fsanitize=address foo.obj -LD
libcmtd.lib(dbgheap.obj) : error LNK2005: __calloc_dbg already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __expand already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __expand_dbg already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __free_dbg already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __realloc_dbg already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in clang_rt.asan_dll_thunk-i386.lib(asan_dll_thunk.obj) LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
foo.dll : fatal error LNK1169: one or more multiply defined symbols found
clang-cl.exe: error: linker command failed with exit code 1169 (use -v to see invocation)

$ clang-cl -fsanitize=address foo.obj
libcmtd.lib(dbgheap.obj) : error LNK2005: __calloc_dbg already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __expand already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __expand_dbg already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __free_dbg already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __realloc_dbg already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj) libcmtd.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in clang_rt.asan-i386.lib(asan_malloc_win.obj)
   Creating library foo.lib and object foo.exp
LINK : fatal error LNK1561: entry point must be defined
clang-cl.exe: error: linker command failed with exit code 1561 (use -v to see invocation)

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to