diff options
author | Matt Morehouse <mascasa@google.com> | 2018-06-15 20:12:58 +0000 |
---|---|---|
committer | Matt Morehouse <mascasa@google.com> | 2018-06-15 20:12:58 +0000 |
commit | 8a49f09d4bea3ee91cbea177d35b3f0eac457a14 (patch) | |
tree | 80a756438bd197aab677fd3c42dcb1c95ced1e58 /test/fuzzer/gc-sections.test | |
parent | 094e5f339071fbaa7141dc7b659ffae9965723b2 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/fuzzer/gc-sections.test')
-rw-r--r-- | test/fuzzer/gc-sections.test | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/fuzzer/gc-sections.test b/test/fuzzer/gc-sections.test index 8785bb00e..9765b39f7 100644 --- a/test/fuzzer/gc-sections.test +++ b/test/fuzzer/gc-sections.test @@ -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 |