[cfe-dev] Problems linking compiler-rt and libc++ with -nodefaultlibs; Could -stdlib=none be a solution?

Dan Albert danalbert at google.com
Wed Jan 14 11:18:28 PST 2015


SGTM. This would be useful to me (and certainly others as well) even
outside the tests because we don't use the system installed C++ stdlib, but
still need the other system libraries.

On Wed, Jan 14, 2015 at 8:31 AM, Eric Fiselier <eric at efcs.ca> wrote:

> Hi All,
>
> Currently we cannot use sanitizers and other instrumentation when
> building and testing libc++ on OS X. For obvious reasons we have to
> use '-nodefaultlibs' to ensure that clang doesn't link in another
> standard library. On linux using '-fsanitize=...' and '-nodefaultlibs'
> will link compiler-rt but on OS X it will not. I imagine other
> platforms might also have this problem.
>
> Manually linking compiler-rt is hard if not impossible and it would be
> nice if we could have the linker driver do it for us. The changes
> required to allow OS X to link compiler-rt with '-nodefaultlibs' seem
> quite complicated and I don't think I would be able to make the
> changes myself.
>
> Should compiler-rt be linked when '-fsanitize=...' and
> '-nodefaultlibs' are given? This behavior should be uniform across all
> platforms. If not then how can we make manually linking compiler-rt
> easier?
>
> As an aside libc++ probably doesn't need to drop all default
> libraries, just the standard library. Currently there is no way to do
> this. One option that would fit our use case would be to add the
> '-stdlib=none' option that only prevented linking (and including) the
> standard library.
>
> Are there any thoughts on adding '-stdlib=none'?
>
> Related discussions can be found below:
>
> [cfe-dev] Linking ProfileRT when using -nodefaultlibs
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-November/039873.html
>
> r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs
> is provided.
>
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141020/116984.html
>
> /Eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150114/814f0663/attachment.html>


More information about the cfe-dev mailing list