#include <sys/mman.h>
 #include <linux/stringify.h>
 
-#include "build-id.h"
 #include "event.h"
 #include "debug.h"
+#include "dso.h"
 #include "evlist.h"
 #include "namespaces.h"
 #include "symbol.h"
        /*
         * mark dso as use to generate buildid in the header
         */
-       if (!ret)
-               build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine);
-
+       if (!ret) {
+               struct dso_id dso_id = {
+                       {
+                               .maj = event->mmap2.maj,
+                               .min = event->mmap2.min,
+                               .ino = event->mmap2.ino,
+                               .ino_generation = event->mmap2.ino_generation,
+                       },
+                       .mmap2_valid = true,
+                       .mmap2_ino_generation_valid = true,
+               };
+               struct dso *dso = machine__findnew_dso_id(jd->machine, filename, &dso_id);
+
+               if (dso)
+                       dso__set_hit(dso);
+       }
 out:
        perf_sample__exit(&sample);
        free(event);