_pyautolib.so is linked with libasan.a if ASAN is used.

BUG=chromium-os:20711
TEST=run autotests under ASAN

Review URL: http://codereview.chromium.org/8065007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103298 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/build/common.gypi b/build/common.gypi
index ef9b233e..26868ae 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1759,7 +1759,8 @@
             # Only in the linux section for now, since ASAN doesn't
             # work on Mac yet.
             'cflags': [
-              '-fasan -w',
+              '-fasan',
+              '-w',
             ],
             'ldflags': [
               '-fasan',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 431e05a9..63076e4 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -15,6 +15,17 @@
       'test/automation/tab_proxy.cc',
       'test/automation/tab_proxy.h',
     ],
+    'pyautolib_libraries': [
+    ],
+    'conditions': [
+      ['asan==1', {
+        'pyautolib_libraries': [
+          # Link in the libasan32.a because this binary will be loaded by
+          # Python that does not have libasan in.
+          '-lasan32',
+        ]
+      }],
+    ],
   },
   'targets': [
     {
@@ -3667,6 +3678,9 @@
              '-Wno-uninitialized',
              '-Wno-self-assign',  # to keep clang happy for generated code.
           ],
+          'libraries': [
+            '<@(pyautolib_libraries)',
+          ],
           'sources': [
             'test/automation/proxy_launcher.cc',
             'test/automation/proxy_launcher.h',