r220455 - Revert r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.

Alexey Samsonov vonosmas at gmail.com
Fri Oct 24 11:05:10 PDT 2014


On Fri, Oct 24, 2014 at 5:23 AM, Joerg Sonnenberger <joerg at britannica.bec.de
> wrote:

> On Thu, Oct 23, 2014 at 01:35:37PM -0700, Alexey Samsonov wrote:
> > On Thu, Oct 23, 2014 at 12:04 PM, Joerg Sonnenberger <
> > joerg at britannica.bec.de> wrote:
> >
> > > On Thu, Oct 23, 2014 at 12:46:10AM -0000, Alexey Samsonov wrote:
> > > > "-nodefaultlibs" is told to link only the libraries explicitly
> provided
> > > > by the user, and providing "-fsanitize=address" is a clear
> indication of
> > > > intention to link with ASan runtime.
> > >
> > > Is it? I would expect such use for free-standing for example and I can
> > > think of use cases for ASAN that do not involve the normal userland
> > > libraries. As such, I believe this needs more thought...
> > >
> >
> > Please elaborate what example / use case you have in mind.
>
> Consider that you want to debug a boot loader in userland. You provide a
> small glue library that emulates the normal hardware access via direct
> system calls. You don't use libc at all. You still have to provide your
> own ASAN implementation of course, but now keeping -fsanitize=address on
> the command line breaks things badly.
>

In this case you should compile your code with -fsanitize=address (so that
it's instrumented,
and has callbacks into ASan runtime), and link it with your custom ASan
implementation instead
of relying on the driver behavior for -fsanitize=address linking. That is,
you may have to split compilation
and linking in two separate steps, but that doesn't seem terrible.


>
> Joerg
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141024/6b517947/attachment.html>


More information about the cfe-commits mailing list