Kostya Serebryany | 80e9a6c | 2017-09-15 23:07:18 +0000 | [diff] [blame^] | 1 | REQUIRES: linux |
| 2 | |
| 3 | No gc-sections: |
| 4 | RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t |
| 5 | RUN: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1 |
| 6 | |
| 7 | With gc-sections. Currently, we can't remove unused code. |
| 8 | DISABLED: %cpp_compiler %S/GcSectionsTest.cpp -o %t -ffunction-sections -Wl,-gc-sections |
| 9 | DISABLED: nm %t | grep UnusedFunctionShouldBeRemovedByLinker | count 1 |
| 10 | |
| 11 | With gc sections, with trace-pc. Unused code is removed. |
| 12 | RUN: %cpp_compiler %S/GcSectionsTest.cpp -o %t -fsanitize-coverage=0 -fsanitize-coverage=trace-pc -ffunction-sections -Wl,-gc-sections |
| 13 | RUN: nm %t | not grep UnusedFunctionShouldBeRemovedByLinker |