Recent change on enabling --buildid-mmap by default brought an issue
with build-id handling. With build-ID in MMAP2 records, we don't need
to save the build-ID table in the header of a perf data file.
But the actual file contents still need to be cached in the debug
directory for annotation etc. Split the build-ID header processing and
caching and make sure perf record to save hit DSOs in the build-ID cache
by moving perf_session__cache_build_ids() to the end of the record__
finish_output().
Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>