summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-02-28 19:00:16 +0000
committerVedant Kumar <vsk@apple.com>2018-02-28 19:00:16 +0000
commita4c56923d264431ba21a54b0ba7b095cfc740128 (patch)
treefb8f0a8d3004cf6b81aac7520ed2d48f46c20e1f
parent9a041a75221cadaafbf902e8ec6b73f6d2612d89 (diff)
downloadbcm5719-llvm-a4c56923d264431ba21a54b0ba7b095cfc740128.tar.gz
bcm5719-llvm-a4c56923d264431ba21a54b0ba7b095cfc740128.zip
[profile] Test the exported symbol set for empty programs
Programs without any code in them should export the exact same set of symbols as programs with code, at least on Darwin. This is done to make text-based API verification possible for certain Darwin frameworks. llvm-svn: 326351
-rw-r--r--compiler-rt/test/profile/instrprof-darwin-dead-strip.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler-rt/test/profile/instrprof-darwin-dead-strip.c b/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
index 03049335efd..6a2bffc213a 100644
--- a/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
+++ b/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
@@ -1,7 +1,7 @@
// REQUIRES: osx-ld64-live_support
// REQUIRES: lto
-// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -o %t %s
+// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -o %t %s
// RUN: %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s -check-prefix=PROF
@@ -10,7 +10,7 @@
// RUN: otool -s __DATA __llvm_prf_names %t | FileCheck %s -check-prefix=PRF_NAMES
// RUN: otool -s __DATA __llvm_prf_cnts %t | FileCheck %s -check-prefix=PRF_CNTS
-// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -flto -o %t.lto %s
+// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -flto -o %t.lto %s
// RUN: %run %t.lto
// RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw
// RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s -check-prefix=PROF
@@ -22,12 +22,24 @@
// Note: We expect foo() and some of the profiling data associated with it to
// be dead-stripped.
+// Note: When there is no code in a program, we expect to see the exact same
+// set of external functions provided by the profile runtime.
+
+// RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip -dynamiclib -o %t.nocode.dylib %s
+// RUN: nm -jgU %t.nocode.dylib > %t.nocode.syms
+// RUN: nm -jgU %t | grep -vE "main|foo|mh_execute_header" > %t.code.syms
+// RUN: diff %t.nocode.syms %t.code.syms
+
+#ifdef CODE
+
// COV: [[@LINE+1]]{{ *}}|{{ *}}0|void foo()
void foo() {}
// COV: [[@LINE+1]]{{ *}}|{{ *}}1|int main
int main() { return 0; }
+#endif // CODE
+
// NM-NOT: foo
// PROF: Counters:
OpenPOWER on IntegriCloud