Open GoogleCodeExporter opened 9 years ago
Original comment by konstant...@gmail.com
on 28 Jul 2014 at 6:57
Note that I'm also getting similar errors when using -MT and building one of
the Firefox test executables, but so far I have not been able to create a small
test case that reproduces it...
clang_rt.asan_cxx-i386.lib(asan_new_delete.obj) : error LNK2005: "void __cdecl
operator delete(void *)" (??3@YAXPAX@Z) already defined in
libcmt.lib(delete.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: __calloc_impl
already defined in libcmt.lib(calloc_impl.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: __expand already
defined in libcmt.lib(expand.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: __msize already
defined in libcmt.lib(msize.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: __recalloc already
defined in libcmt.lib(recalloc.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: _calloc already
defined in libcmt.lib(calloc.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: _free already
defined in libcmt.lib(free.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: _malloc already
defined in libcmt.lib(malloc.obj)
clang_rt.asan-i386.lib(asan_malloc_win.obj) : error LNK2005: _realloc already
defined in libcmt.lib(realloc.obj)
Original comment by ehsan.ak...@gmail.com
on 28 Jul 2014 at 1:11
Only -MT is currently supported.
-MD is very likely to be implemented before -MTd/-MDd.
Can you provide a justification why -MTd/-MDd are important to support?
Original comment by timurrrr@google.com
on 28 Jul 2014 at 1:15
Self-note: -MD support is tracked here
http://llvm.org/bugs/show_bug.cgi?id=20214
Original comment by timurrrr@google.com
on 28 Jul 2014 at 1:15
-MTd and -MDd would be useful for us since on other platforms we use ASAN with
our "debug" builds which have other debugging runtime facilities such as
assertions and bounds checking enabled. That being said, supporting -MD is
*much* more useful to us since we don't really support building Firefox with
-MT at all, and I've had to do some major hackery to our build system which
disables a whole bunch of modules that we would ideally like to test with ASAN.
Original comment by ehsan.ak...@gmail.com
on 28 Jul 2014 at 1:29
My understanding is that the linker is sensitive to the order of libraries on
the command line. IIRC, the correct order is the asan rtl followed by the CRT.
Can you play with the link line directly to make the link succeed?
It may be affected by '/defaultlib:libcmt.lib' flags in object files as well.
Maybe '/nodefaultlib:libcmt.lib clang_rt.asan-i386.lib libcmt.lib' could fix it.
Hopefully we can fix the order dependency at some point.
Original comment by rnk@google.com
on 28 Jul 2014 at 4:52
I did play with the linking order and also with /nodefaultlib and neither
helped. :(
Original comment by ehsan.ak...@gmail.com
on 28 Jul 2014 at 5:09
If -MD was supported, could you emulate -MDd assertions etc. using preprocessor
macro?
IIRC, all those debug CRTs are structured very differently from the release
counterparts and it is much harder to intercept them correctly.
Original comment by timurrrr@google.com
on 4 Aug 2014 at 1:04
Yes I think that would be possible. We would of course lose the assertion
within the CRT itself, but I don't think that we have used them very heavily
anyways.
Original comment by ehsan.ak...@gmail.com
on 4 Aug 2014 at 1:45
We'll dodge CRT allocator assertions anyways as we'll use ASan-provided
allocator :)
OK, got ya -- I'll prioritize -MD above -MTd/-MDd then.
Original comment by timurrrr@google.com
on 4 Aug 2014 at 1:52
Yep, thanks, I appreciate it. :-)
Original comment by ehsan.ak...@gmail.com
on 4 Aug 2014 at 1:56
Original issue reported on code.google.com by
ehsan.ak...@gmail.com
on 26 Jul 2014 at 5:44