Commit Graph

21 Commits

Author SHA1 Message Date
Reid Kleckner acbbf4bf78 Revert r337635 "[Driver] Sanitizer support based on runtime library presence"
This change causes issues with distributed build systems, which may only
have compiler binaries without any runtime libraries. See discussion
about this on https://reviews.llvm.org/D15225.

llvm-svn: 338444
2018-07-31 21:57:35 +00:00
George Karpenkov 8d12fc1907 [Driver] Sanitizer support based on runtime library presence
The runtime libraries of sanitizers are built in compiler-rt, and Clang
can be built without compiler-rt, or compiler-rt can be configured to
only build certain sanitizers. The driver should provide reasonable
diagnostics and not a link-time error when a runtime library is missing.

This patch changes the driver for OS X to only support sanitizers of
which we can find the runtime libraries. The discussion for this patch
explains the rationale

Differential Revision: https://reviews.llvm.org/D15225

llvm-svn: 337635
2018-07-20 23:34:39 +00:00
Saleem Abdulrasool 37bf71828b Reapply SVN r274797.
Original Commit Message

    Driver: Stop linking to C++ when using sanitizers on Darwin

    Sanitizers on Darwin are built as dynamic libraries, not static libraries.
    Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB)
    in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static,
    linking against C++ when enabling a sanitizer becomes over linkage.

    Patch by Dave Lee!

llvm-svn: 275032
2016-07-10 23:24:36 +00:00
Saleem Abdulrasool c61723f73e Revert "Driver: Stop linking to C++ when using sanitizers on Darwin"
This reverts SVN r274797.  It broke the Green Dragon bot.  Revert it until the
failure can be addressed.

llvm-svn: 274814
2016-07-08 00:37:31 +00:00
Saleem Abdulrasool a1a36c85df Driver: Stop linking to C++ when using sanitizers on Darwin
Sanitizers on Darwin are built as dynamic libraries, not static libraries.
Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB)
in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static,
linking against C++ when enabling a sanitizer becomes over linkage.

Patch by Dave Lee!

llvm-svn: 274797
2016-07-07 21:42:29 +00:00
Jonas Hahnfeld f2e73a1adb Fix some more tests with CLANG_DEFAULT_CXX_STDLIB
Also use -stdlib=platform instead of -stdlib=libstdc++ when testing if Clang
chooses the correct default for the given platform.

llvm-svn: 263435
2016-03-14 14:34:10 +00:00
Jonas Hahnfeld 91924a6f63 tests: Add explicit -stdlib=libstdc++ to tests that require it
This will be needed for the next commit that allows to switch the default
C++ library which would otherwise make these tests fail.

llvm-svn: 260661
2016-02-12 07:48:28 +00:00
Anna Zaks e67b402e45 [asan] Add iOS support for Address Sanitizer
Differential Revision: http://reviews.llvm.org/D15624

llvm-svn: 259453
2016-02-02 02:04:48 +00:00
Alexey Samsonov 498f3c3416 [UBSan] Use shared library for UBSan on OS X (Clang part).
Summary:
UBSan is now used in the same way as ASan, and is supported on
OSX and on iOS simulator. At the moment ASan and UBSan can't be used
together due to PR21112, but I hope to resolve it soon by
embedding UBSan into ASan.

Test Plan: regression test suite.

Reviewers: zaks.anna, kubabrecka

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8471

llvm-svn: 233035
2015-03-23 23:14:05 +00:00
Kuba Brecka e899e799b5 Fix the test failure on Windows introduced by r221279.
http://reviews.llvm.org/D6018

llvm-svn: 221316
2014-11-04 23:38:57 +00:00
Kuba Brecka 9ff912db22 Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.

Reviewed at http://reviews.llvm.org/D6018

llvm-svn: 221279
2014-11-04 17:35:17 +00:00
Alexander Potapenko 4fe1301bea [ASan] Fix darwin-sanitizer-ld.c for iossim, which seems to use -lc++ instead of -lstdc++.
llvm-svn: 194822
2013-11-15 16:57:57 +00:00
Alexander Potapenko 868cca96c4 [ASan] Link with libclang_rt.asan_iossim_dynamic.dylib when targeting the iOS simulator.
Add a test.

llvm-svn: 194820
2013-11-15 16:07:44 +00:00
Alexander Potapenko 4462c5b5d6 [ASan] Fix darwin-sanitizer-ld.c to test for the new order of linker flags introduced by r191076.
llvm-svn: 191077
2013-09-20 08:23:19 +00:00
Richard Smith 539e4a77bb ubsan: Emit bounds checks for array indexing, vector indexing, and (in really simple cases) pointer arithmetic. This augments the existing bounds checking with language-level array bounds information.
llvm-svn: 175949
2013-02-23 02:53:19 +00:00
Alexander Potapenko 015333f88c [ASan] Fixed darwin-sanitizer-ld.c to match the flags after the switch to the dynamic runtime.
llvm-svn: 173137
2013-01-22 09:27:00 +00:00
Alexey Samsonov 969be24542 Port r172856: 'Include ubsan runtime even when building a shared library. We don't require executable to be linked with UBSan.' to Mac
llvm-svn: 173014
2013-01-21 08:45:02 +00:00
Alexey Samsonov e0619f5241 Fix test case for linking with sanitizer opts added in r168428.
llvm-svn: 168562
2012-11-25 13:40:21 +00:00
Joey Gouly ebc59d5eb4 PR14306: Move -fbounds-checking to -fsanitize=bounds.
llvm-svn: 168510
2012-11-23 10:39:49 +00:00
Alexey Samsonov 062441b8d4 Try to fix test from r168428 on mingw bot
llvm-svn: 168431
2012-11-21 15:52:36 +00:00
Alexey Samsonov 8368b376ad [Sanitizer] force linking with static sanitizer runtimes on Darwin even if they are not found in resource directory. Add test checking sanitizer linker flags on Darwin.
llvm-svn: 168428
2012-11-21 14:17:42 +00:00