<div>May I ask someone with good Darwin knowledge to look at it? </div><div><br></div><div><div>+  llvm::sys::path::append(LibAsan, "lib", "clang", "darwin", TC.getArchName());</div></div><div>
<br></div><div>Daniel, I remember you suggested "fat" libraries for Mac. </div><div>Is that how we can/should do it now? </div><div><br></div><div><br></div><div><div>+    CmdArgs.push_back("-U");</div>
</div><div><br></div><div>We need to add -U __asan_foo for a bunch of run-time functions from asan rt (see Alex's description).</div><div>On Linux we get away w/o doing this because the default for treating uninitialized symbols in shared objects is different. </div>
What would be more preferable, have a bunch of "-U __asan_foo" lines or  "--undefined dynamic_lookup"? <br>Or maybe there is some third solution we missed? <div><br></div><div><br></div><div><div>+  if (Args.hasArg(options::OPT_faddress_sanitizer)) {</div>
</div><div><br></div><div>Please use Args.hasFlag(options::OPT_faddress_sanitizer, options::OPT_fno_address_sanitizer, false))                                                                                                                                     </div>
<div>and hide the flag checking inside addAsanRTDarwinExe/etc</div><div><br></div><div><div>+const int AsanIfaceFnsSize = sizeof(AsanIfaceFns) / sizeof(char*);</div></div><div><div>+const char *AsanIfaceFns[13] = {</div></div>
<div><br></div><div>I would make these function-scope (if we end up needing them). </div><div><br></div><div>--kcc </div><div><br></div><div><br><br><div class="gmail_quote">On Wed, Nov 30, 2011 at 5:14 AM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">See the attachment.<br>
<br>
For Darwin executables we do the same thing as for Linux (see addASanRTLinux)<br>
For Darwin shared libraries we need to explicitly mark the interface<br>
functions inserted by ASan as dynamic_lookup, otherwise we'll get a<br>
linker error.<br>
Another solution is to pass "--undefined dynamic_lookup" to the<br>
linker, but this won't allow the users to notice their own undefined<br>
symbols.<br>
<br>
WBR,<br>
<span class="HOEnZb"><font color="#888888">Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div>