summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/fuzzer/gc-sections.test
blob: 7bc2f831b42f32998fc7624b5b52b54bfdfdf0c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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.
RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -fuse-ld=lld -ffunction-sections -Wl,-gc-sections
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
RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker
OpenPOWER on IntegriCloud