@@ -1674,21 +1674,8 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
1674
1674
sizeof (host_build_id )) == 0 )
1675
1675
is_host = dso__build_id_equal (dso , host_build_id );
1676
1676
1677
- build_id__sprintf (dso -> build_id , sizeof (dso -> build_id ), sbuild_id );
1678
-
1679
- scnprintf (path , sizeof (path ), "%s/%s/%s" , buildid_dir ,
1680
- DSO__NAME_KCORE , sbuild_id );
1681
-
1682
- /* Use /proc/kallsyms if possible */
1677
+ /* Try a fast path for /proc/kallsyms if possible */
1683
1678
if (is_host ) {
1684
- DIR * d ;
1685
-
1686
- /* If no cached kcore go with /proc/kallsyms */
1687
- d = opendir (path );
1688
- if (!d )
1689
- goto proc_kallsyms ;
1690
- closedir (d );
1691
-
1692
1679
/*
1693
1680
* Do not check the build-id cache, unless we know we cannot use
1694
1681
* /proc/kcore or module maps don't match to /proc/kallsyms.
@@ -1699,18 +1686,24 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
1699
1686
if (filename__readable ("/proc/kcore" ) &&
1700
1687
!validate_kcore_addresses ("/proc/kallsyms" , map ))
1701
1688
goto proc_kallsyms ;
1702
-
1703
- /* Find kallsyms in build-id cache with kcore */
1704
- if (!find_matching_kcore (map , path , sizeof (path )))
1705
- return strdup (path );
1706
-
1707
- goto proc_kallsyms ;
1708
1689
}
1709
1690
1691
+ build_id__sprintf (dso -> build_id , sizeof (dso -> build_id ), sbuild_id );
1692
+
1710
1693
/* Find kallsyms in build-id cache with kcore */
1694
+ scnprintf (path , sizeof (path ), "%s/%s/%s" ,
1695
+ buildid_dir , DSO__NAME_KCORE , sbuild_id );
1696
+
1711
1697
if (!find_matching_kcore (map , path , sizeof (path )))
1712
1698
return strdup (path );
1713
1699
1700
+ /* Use current /proc/kallsyms if possible */
1701
+ if (is_host ) {
1702
+ proc_kallsyms :
1703
+ return strdup ("/proc/kallsyms" );
1704
+ }
1705
+
1706
+ /* Finally, find a cache of kallsyms */
1714
1707
scnprintf (path , sizeof (path ), "%s/%s/%s" ,
1715
1708
buildid_dir , DSO__NAME_KALLSYMS , sbuild_id );
1716
1709
@@ -1721,9 +1714,6 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
1721
1714
}
1722
1715
1723
1716
return strdup (path );
1724
-
1725
- proc_kallsyms :
1726
- return strdup ("/proc/kallsyms" );
1727
1717
}
1728
1718
1729
1719
static int dso__load_kernel_sym (struct dso * dso , struct map * map ,
0 commit comments