title: Asan : Issue with asan library loading
body: <p>In our build system we have recently integrated ASAN tool (adding -fsanitize=address) to CFLAGS &amp; also while linking , creating library .so files.
  Note:- We are using GCC 6.3 compiler.</p>
  
  <p>We are able to successfully build our code. But while running it fails with following issue:</p>
  
  <pre><code>==52215==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
  </code></pre>
  
  <p>Here is my gcc command:-</p>
  
  <pre><code>/local/common/pkgs/gcc/v6.3.0/bin/gcc -m32 -shared -o /local/testing/build/new_tool/asan_build/syn/verilog/libspd.so  -Wl,-rpath=\$ORIGIN/lib -Wl,-rpath=\$ORIGIN/../lib -W1,-rpath=/local/common/gcc/v6.3.0/lib  -fsanitize=address -L/local/testing/build/new_tool/asan_build/modules /local/testing/build/new_tool/asan_build/modules/silvpi.o /local/testing/build/new_tool/asan_build/modules/sypsv.o /local/testing/build/new_tool/asan_build/modules/cdnsv_tfs.o /local/testing/build/new_tool/asan_build/modules/libcore.o /local/testing/build/new_tool/asan_build/modules/vpi_user.o /local/testing/build/new_tool/asan_build/modules/libdenbase.a /local/testing/build/new_tool/asan_build/modules/libbdd.a  -L/local/testing/build/new_tool/asan_build/syn/lib -L/local/testing/build/new_tool/asan_build/modules -L/home/local/outer/Linux/lib /local/testing/build/new_tool/asan_build/modules/vhpimodelfunc.o /local/testing/build/new_tool/asan_build/modules/vipcommonlib.a  -lm -lc -ldenbase -lbdd -ldenbase -lviputil -llocalCommonMT_sh
  </code></pre>
  
  <p>I am able to build library <code>libspd.so</code> successfully. But when we try to run it fails with above error i mentioned.</p>
  
  <p>i can see the dependent library list of <code>libspd.so</code></p>
  
  <pre><code>ldd /local/testing/build/new_tool/asan_build/syn/verilog/libspd.so
      linux-gate.so.1 =&gt;  (0x00279000)
      libasan.so.3 =&gt; /local/pkgs/gcc/v6.3.0/lib/libasan.so.3 (0xf7175000)
      libm.so.6 =&gt; /lib/libm.so.6 (0x0014e000)
      libc.so.6 =&gt; /lib/libc.so.6 (0xf6f83000)
      libcdsCommonMT_sh.so =&gt; /local/testing/build/new_tool/asan_build/verilog/../lib/liblocalCommonMT_sh.so (0x00178000)
      libdl.so.2 =&gt; /lib/libdl.so.2 (0x00197000)
  </code></pre>
  
  <p>We are trying to run our application with 'xrun' where it runs simulation on top of my build which was build with asan.
  As error says : <code>you should either link runtime to your application</code> i was trying to add my complete asan library path to LD_LIBRARY_PATH, Still facing the same issue.</p>
  
  <p>Not sure whats going wrong here. How can i resolve this issue?</p>
  
  <p>Any idea? Thanks and regards!</p>