diff options
| author | Francis Ricci <francisjricci@gmail.com> | 2017-09-08 19:43:53 +0000 |
|---|---|---|
| committer | Francis Ricci <francisjricci@gmail.com> | 2017-09-08 19:43:53 +0000 |
| commit | 4a327e1c5c827bc073c2e69372cf566fd6db81c3 (patch) | |
| tree | ea8d58389017ca93ab7388eb031df797758188bc | |
| parent | 901132092187aeebcbafc6332f6235d3dea3e915 (diff) | |
| download | bcm5719-llvm-4a327e1c5c827bc073c2e69372cf566fd6db81c3.tar.gz bcm5719-llvm-4a327e1c5c827bc073c2e69372cf566fd6db81c3.zip | |
Prevent DCE on __lsan_is_turned_off and re-enable test case
Summary:
-dead_strip in ld64 strips weak interface symbols, which I believe
is most likely the cause of this test failure. Re-enable after marking the interface
function as used.
Reviewers: alekseyshl, kubamracek, kcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37635
llvm-svn: 312824
| -rw-r--r-- | compiler-rt/include/sanitizer/lsan_interface.h | 2 | ||||
| -rw-r--r-- | compiler-rt/test/lsan/TestCases/link_turned_off.cc | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/include/sanitizer/lsan_interface.h b/compiler-rt/include/sanitizer/lsan_interface.h index 8fb8e756da2..1f2e58909b4 100644 --- a/compiler-rt/include/sanitizer/lsan_interface.h +++ b/compiler-rt/include/sanitizer/lsan_interface.h @@ -64,6 +64,8 @@ extern "C" { // for the program it is linked into (if the return value is non-zero). This // function must be defined as returning a constant value; any behavior beyond // that is unsupported. + // To avoid dead stripping, you may need to define this function with + // __attribute__((used)) int __lsan_is_turned_off(); // This function may be optionally provided by the user and should return diff --git a/compiler-rt/test/lsan/TestCases/link_turned_off.cc b/compiler-rt/test/lsan/TestCases/link_turned_off.cc index fd11272ceae..245fd017b6e 100644 --- a/compiler-rt/test/lsan/TestCases/link_turned_off.cc +++ b/compiler-rt/test/lsan/TestCases/link_turned_off.cc @@ -3,15 +3,13 @@ // RUN: %clangxx_lsan %s -o %t // RUN: %env_lsan_opts=$LSAN_BASE %run %t // RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s -// -// UNSUPPORTED: darwin #include <sanitizer/lsan_interface.h> int argc_copy; extern "C" { -int __lsan_is_turned_off() { +int __attribute__((used)) __lsan_is_turned_off() { return (argc_copy == 1); } } |

