[compiler-rt] r339733 - [SanitizerCoverage] Add associated metadata to PC guards.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 15:04:35 PDT 2018


Author: morehouse
Date: Tue Aug 14 15:04:34 2018
New Revision: 339733

URL: http://llvm.org/viewvc/llvm-project?rev=339733&view=rev
Log:
[SanitizerCoverage] Add associated metadata to PC guards.

Summary:
Without this metadata LLD strips unused PC table entries
but won't strip unused guards.  This metadata also seems
to influence the linker to change the ordering in the PC
guard section to match that of the PC table section.

The libFuzzer runtime library depends on the ordering
of the PC table and PC guard sections being the same.  This
is not generally guaranteed, so we may need to redesign
PC tables/guards/counters in the future.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: kcc, hiraditya, llvm-commits

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

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=339733&r1=339732&r2=339733&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/gc-sections.test (original)
+++ compiler-rt/trunk/test/fuzzer/gc-sections.test Tue Aug 14 15:04:34 2018
@@ -8,8 +8,13 @@ With gc-sections. Currently, we can't re
 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
 RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker
+
+RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -fsanitize-coverage=0 -fsanitize-coverage=trace-pc-guard,pc-table -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




More information about the llvm-commits mailing list