[compiler-rt] r336941 - [SanitizerCoverage] Add associated metadata to 8-bit counters.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 13:24:58 PDT 2018


Author: morehouse
Date: Thu Jul 12 13:24:58 2018
New Revision: 336941

URL: http://llvm.org/viewvc/llvm-project?rev=336941&view=rev
Log:
[SanitizerCoverage] Add associated metadata to 8-bit counters.

Summary:
This allows counters associated with unused functions to be
dead-stripped along with their functions.  This approach is the same one
we used for PC tables.

Fixes an issue where LLD removes an unused PC table but leaves the 8-bit
counter.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, hiraditya, kcc

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

Modified:
    compiler-rt/trunk/test/fuzzer/gc-sections.test

Modified: compiler-rt/trunk/test/fuzzer/gc-sections.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/gc-sections.test?rev=336941&r1=336940&r2=336941&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/gc-sections.test (original)
+++ compiler-rt/trunk/test/fuzzer/gc-sections.test Thu Jul 12 13:24:58 2018
@@ -4,9 +4,11 @@ No gc-sections:
 RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t
 RUN: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1
 
-With gc-sections. Currently, we can't remove unused code.
+With gc-sections. Currently, we can't remove unused code except with LLD.
 RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -fuse-ld=lld -ffunction-sections -Wl,-gc-sections
 RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker
+RUN: %run %t -runs=0 2>&1 | FileCheck %s
+CHECK-NOT: ERROR: The size of coverage PC tables does not match
 
 With gc sections, with trace-pc. Unused code is removed.
 RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -fsanitize-coverage=0 -fsanitize-coverage=trace-pc -ffunction-sections -Wl,-gc-sections




More information about the llvm-commits mailing list