[PATCH] Optional support for dynamic Asan runtime

Alexey Samsonov samsonov at google.com
Wed Mar 26 11:51:52 PDT 2014

Comment at: lib/asan/CMakeLists.txt:57
@@ +56,3 @@
+set(ASAN_DYNAMIC_LIBS stdc++)
Yury Gribov wrote:
> Alexey Samsonov wrote:
> >   set(ASAN_DYNAMIC_LIBS stdc++ c m)
> I wonder whether I need 'c' at all.
I believe we don't

Comment at: lib/asan/asan_malloc_linux.cc:115
@@ +114,3 @@
+  if (!asan_inited)
+    return AsanPreinitAlloc(size);
+  if (AsanIsPreinitAllocated(ptr))
Yury Gribov wrote:
> Alexey Samsonov wrote:
> > This is just wrong. Is realloc() called before asan_inited or on PreinitAllocated pointers?
> AFAIR realloc() is called before asan_inited on PreinitAlloc-ated pointers (dlerror calls it to allocate string). So what's wrong exactly?
if realloc(ptr, new_size) != ptr, you have to copy the contents to the newly allocated buffer. It's so sad we need to appease dlerror() with hacks like this. Can you clarify why you need to call it in AsanCheckIncompatibleRT?

Comment at: test/asan/lit.cfg:35
@@ -29,3 +34,3 @@
 target_cxxflags = config.cxx_mode_flags + target_cflags
 clang_asan_cflags = ["-fsanitize=address",
Can you instead rename this to clang_asan_static_cflags, and define clang_asan_cflags depending on config.asan_dynamic (so that these lists are immutable and defined in a single place)?


More information about the llvm-commits mailing list