[profile] Skip mmap() if there are no counters
authorVedant Kumar <vsk@apple.com>
Tue, 18 May 2021 23:35:21 +0000 (16:35 -0700)
committerVedant Kumar <vsk@apple.com>
Wed, 19 May 2021 16:31:40 +0000 (09:31 -0700)
commit7014a101614367e05cec1ba72a6be07eb173b304
tree0c5306f51e4341547b2924bb9f37b29fdd8182e1
parent84ae1cf8edc00cbf02a7396fef256f39046c1e5b
[profile] Skip mmap() if there are no counters

If there are no counters, an mmap() of the counters section would fail
due to the size argument being too small (EINVAL).

rdar://78175925

Differential Revision: https://reviews.llvm.org/D102735
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/test/profile/ContinuousSyncMode/image-with-no-counters.c [new file with mode: 0644]