[compiler-rt] r344346 - [libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl, -dead_strip.

Max Moroz via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 06:59:56 PDT 2018


Author: dor1s
Date: Fri Oct 12 06:59:56 2018
New Revision: 344346

URL: http://llvm.org/viewvc/llvm-project?rev=344346&view=rev
Log:
[libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl,-dead_strip.

Summary:
The corresponding asncov change: https://reviews.llvm.org/D53113.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=892167

Reviewers: morehouse, kcc, george.karpenkov

Reviewed By: morehouse, george.karpenkov

Subscribers: delcypher, #sanitizers, llvm-commits

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

Added:
    compiler-rt/trunk/test/fuzzer/dead-stripping.test

Added: compiler-rt/trunk/test/fuzzer/dead-stripping.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/dead-stripping.test?rev=344346&view=auto
==============================================================================
--- compiler-rt/trunk/test/fuzzer/dead-stripping.test (added)
+++ compiler-rt/trunk/test/fuzzer/dead-stripping.test Fri Oct 12 06:59:56 2018
@@ -0,0 +1,23 @@
+REQUIRES: darwin
+
+No dead_strip. Unused code is not removed.
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t
+RUN: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1
+RUN: %run %t -runs=0 2>&1 | FileCheck %s
+
+With dead_strip. Unused code is not removed.
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -Wl,-dead_strip
+RUN: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1
+RUN: %run %t -runs=0 2>&1 | FileCheck %s
+
+With dead_strip, with trace-pc. Unused code is removed.
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -fsanitize-coverage=0 -fsanitize-coverage=trace-pc -Wl,-dead_strip
+RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker
+RUN: %run %t -runs=0 2>&1 | FileCheck %s
+
+With dead_strip, with pc-table. Unused code is not removed.
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -fsanitize-coverage=0 -fsanitize-coverage=trace-pc-guard,pc-table -Wl,-dead_strip
+RUN: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1
+RUN: %run %t -runs=0 2>&1 | FileCheck %s
+
+CHECK-NOT: ERROR: The size of coverage PC tables does not match




More information about the llvm-commits mailing list