[compiler-rt] r334858 - [SanitizerCoverage] Add associated metadata to pc-tables.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 13:12:59 PDT 2018


Author: morehouse
Date: Fri Jun 15 13:12:58 2018
New Revision: 334858

URL: http://llvm.org/viewvc/llvm-project?rev=334858&view=rev
Log:
[SanitizerCoverage] Add associated metadata to pc-tables.

Summary:
Using associated metadata rather than llvm.used allows linkers to
perform dead stripping with -fsanitize-coverage=pc-table.  Unfortunately
in my local tests, LLD was the only linker that made use of this metadata.

Partially addresses https://bugs.llvm.org/show_bug.cgi?id=34636 and fixes
https://github.com/google/sanitizers/issues/971.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: Dor1s, hiraditya, llvm-commits, kcc

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

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=334858&r1=334857&r2=334858&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/gc-sections.test (original)
+++ compiler-rt/trunk/test/fuzzer/gc-sections.test Fri Jun 15 13:12:58 2018
@@ -1,12 +1,12 @@
-REQUIRES: linux
+REQUIRES: linux, lld-available
 
 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.
-DISABLED: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -Wl,-gc-sections
-DISABLED: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -Wl,-gc-sections -fuse-ld=lld
+RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker
 
 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