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 | 0ea9a90b3d6b2920e96dd8bbc971c236fe048139 (patch) | |
| tree | cb23edde20cd7f8e201132f79a509276c6fba76a /compiler-rt/test | |
| parent | 82b2e7431ded460124a31efe5e541db20c61c497 (diff) | |
| download | bcm5719-llvm-0ea9a90b3d6b2920e96dd8bbc971c236fe048139.tar.gz bcm5719-llvm-0ea9a90b3d6b2920e96dd8bbc971c236fe048139.zip | |
[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
llvm-svn: 334858
Diffstat (limited to 'compiler-rt/test')
| -rw-r--r-- | compiler-rt/test/fuzzer/gc-sections.test | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/test/fuzzer/gc-sections.test b/compiler-rt/test/fuzzer/gc-sections.test index 8785bb00ec1..9765b39f73c 100644 --- a/compiler-rt/test/fuzzer/gc-sections.test +++ b/compiler-rt/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 |

