summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingFile.c
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-13 22:33:07 +0000
committerXinliang David Li <davidxl@google.com>2015-11-13 22:33:07 +0000
commitb6c81d2b924c1759a90651a0d41e5a505752548c (patch)
tree5835326c9f44a8eda2314ffcc87d9cc5effc46f2 /compiler-rt/lib/profile/InstrProfilingFile.c
parente6edd48d69dbe8107301b82fe98be05e9baf4504 (diff)
downloadbcm5719-llvm-b6c81d2b924c1759a90651a0d41e5a505752548c.tar.gz
bcm5719-llvm-b6c81d2b924c1759a90651a0d41e5a505752548c.zip
[PGO] Ensure profile section symbols are created (linux)
- This is to handle a corner case where profile lib is linked in but non of the modules are instrumented (On linux, since we avoided the overhead to emit runtime hook use functions so this is the side effect of that size optimization). - Added a profile runtime test case to cover all scenarios of shared library builds. Differential Revision: http://reviews.llvm.org/D14468 llvm-svn: 253098
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingFile.c')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 6af835e484a..318648e446b 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -36,6 +36,10 @@ static int writeFile(FILE *File) {
/* Create the header. */
__llvm_profile_header Header;
+
+ if (!DataSize)
+ return 0;
+
Header.Magic = __llvm_profile_get_magic();
Header.Version = __llvm_profile_get_version();
Header.DataSize = DataSize;
OpenPOWER on IntegriCloud