diff options
author | Xinliang David Li <davidxl@google.com> | 2015-11-13 22:33:07 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-11-13 22:33:07 +0000 |
commit | 8f5633c1a7812ec4c8b549c67675b98c1dade82a (patch) | |
tree | a85dfd6e42d359e0ea3644d9995e2b2f728449b2 /lib/profile/InstrProfilingBuffer.c | |
parent | b3d951765ae9be108e3b8f6e8223a5fe8eeb1939 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingBuffer.c')
-rw-r--r-- | lib/profile/InstrProfilingBuffer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/profile/InstrProfilingBuffer.c b/lib/profile/InstrProfilingBuffer.c index e587932da..620c1755b 100644 --- a/lib/profile/InstrProfilingBuffer.c +++ b/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; |