1 /// Test instrumentation can handle various linkages.
2 // REQUIRES: lld-available
4 // FIXME: Investigate and fix.
5 // XFAIL: powerpc64-target-arch
7 // RUN: %clang_profgen -fcoverage-mapping %s -o %t
8 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
9 // RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
11 // RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -fuse-ld=lld -Wl,--gc-sections %s -o %t
12 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
13 // RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
15 // CHECK: {{.*}}external{{.*}}:
17 // CHECK-NEXT: Counters: 1
18 // CHECK-NEXT: Function count: 1
19 // CHECK: {{.*}}weak{{.*}}:
21 // CHECK-NEXT: Counters: 1
22 // CHECK-NEXT: Function count: 1
25 // CHECK-NEXT: Counters: 1
26 // CHECK-NEXT: Function count: 1
27 // CHECK: {{.*}}internal{{.*}}:
29 // CHECK-NEXT: Counters: 1
30 // CHECK-NEXT: Function count: 1
31 // CHECK: {{.*}}linkonce_odr{{.*}}:
33 // CHECK-NEXT: Counters: 1
34 // CHECK-NEXT: Function count: 1
39 __attribute__((weak
)) void discarded1() {}
41 void external() { puts("external"); }
42 __attribute__((weak
)) void weak() { puts("weak"); }
43 static void internal() { puts("internal"); }
44 __attribute__((noinline
)) inline void linkonce_odr() { puts("linkonce_odr"); }