[cfe-commits] Add the support for AddressSanitizer on Darwin into the driver.

Kostya Serebryany kcc at google.com
Wed Nov 30 14:59:20 PST 2011


May I ask someone with good Darwin knowledge to look at it?

+  llvm::sys::path::append(LibAsan, "lib", "clang", "darwin",
TC.getArchName());

Daniel, I remember you suggested "fat" libraries for Mac.
Is that how we can/should do it now?


+    CmdArgs.push_back("-U");

We need to add -U __asan_foo for a bunch of run-time functions from asan rt
(see Alex's description).
On Linux we get away w/o doing this because the default for treating
uninitialized symbols in shared objects is different.
What would be more preferable, have a bunch of "-U __asan_foo" lines
or  "--undefined dynamic_lookup"?
Or maybe there is some third solution we missed?


+  if (Args.hasArg(options::OPT_faddress_sanitizer)) {

Please
use Args.hasFlag(options::OPT_faddress_sanitizer,
options::OPT_fno_address_sanitizer,
false))

and hide the flag checking inside addAsanRTDarwinExe/etc

+const int AsanIfaceFnsSize = sizeof(AsanIfaceFns) / sizeof(char*);
+const char *AsanIfaceFns[13] = {

I would make these function-scope (if we end up needing them).

--kcc



On Wed, Nov 30, 2011 at 5:14 AM, Alexander Potapenko <glider at google.com>wrote:

> See the attachment.
>
> For Darwin executables we do the same thing as for Linux (see
> addASanRTLinux)
> For Darwin shared libraries we need to explicitly mark the interface
> functions inserted by ASan as dynamic_lookup, otherwise we'll get a
> linker error.
> Another solution is to pass "--undefined dynamic_lookup" to the
> linker, but this won't allow the users to notice their own undefined
> symbols.
>
> WBR,
> Alexander Potapenko
> Software Engineer
> Google Moscow
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111130/777d1373/attachment.html>


More information about the cfe-commits mailing list