1 | // REQUIRES: osx-ld64-live_support |
2 | |
3 | // Compiling with PGO/code coverage on Darwin should raise no warnings or errors |
4 | // when using an exports list. |
5 | |
6 | // 1) Check that using PGO/code coverage flags with an export list containing |
7 | // just "_main" produces no warnings or errors. |
8 | // |
9 | // RUN: echo "_main" > %t.exports |
10 | // RUN: %clang_pgogen -Werror -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee %t.log |
11 | // RUN: %clang_profgen -Werror -fcoverage-mapping -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee -a %t.log |
12 | // RUN: cat %t.log | count 0 |
13 | |
14 | // 2) Ditto (1), but for GCOV. |
15 | // |
16 | // RUN: %clang -Werror -Wl,-exported_symbols_list,%t.exports --coverage -o %t.gcov %s | tee -a %t.gcov.log |
17 | // RUN: cat %t.gcov.log | count 0 |
18 | |
19 | // 3) The default set of weak external symbols should match the set of symbols |
20 | // exported by clang. See Darwin::addProfileRTLibs. This requirement was put in |
21 | // place to support tapi binary verification. |
22 | // |
23 | // RUN: %clang_pgogen -Werror -o %t.default %s |
24 | // RUN: nm -jUg %t.default | grep -v __mh_execute_header > %t.default.exports |
25 | // RUN: nm -jUg %t | grep -v __mh_execute_header > %t.clang.exports |
26 | // RUN: diff %t.default.exports %t.clang.exports |
27 | |
28 | // 4) Ditto (3), but for GCOV. |
29 | // |
30 | // RUN: %clang -Werror --coverage -o %t.gcov.default %s |
31 | // RUN: nm -jUg %t.gcov | grep -v __mh_execute_header > %t.gcov.exports |
32 | // RUN: nm -jUg %t.gcov.default | grep -v __mh_execute_header > %t.gcov.default.exports |
33 | // RUN: diff %t.gcov.default.exports %t.gcov.exports |
34 | |
35 | int main() {} |
36 | |