[PATCH] D53114: [libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl, -dead_strip.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 07:03:00 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT344346: [libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl… (authored by Dor1s, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53114?vs=169118&id=169393#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53114

Files:
  test/fuzzer/dead-stripping.test


Index: test/fuzzer/dead-stripping.test
===================================================================
--- test/fuzzer/dead-stripping.test
+++ test/fuzzer/dead-stripping.test
@@ -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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53114.169393.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181012/f76620a1/attachment.bin>


More information about the llvm-commits mailing list