summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingBuffer.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/InstrProfilingBuffer.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/InstrProfilingBuffer.c')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingBuffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingBuffer.c b/compiler-rt/lib/profile/InstrProfilingBuffer.c
index e587932da0a..620c1755baa 100644
--- a/compiler-rt/lib/profile/InstrProfilingBuffer.c
+++ b/compiler-rt/lib/profile/InstrProfilingBuffer.c
@@ -79,6 +79,10 @@ int __llvm_profile_write_buffer_internal(
/* 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