aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-buildid-cache.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-20 01:50:32 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-20 01:50:32 -0500
commitf31f40be8f82d5eeb4ca084f9ac0f11ca265876b (patch)
tree6fce9ac78045249084d641945e094dcaea72d265 /tools/perf/builtin-buildid-cache.c
parent13c12dbe3a2ce17227f7ddef652b6a53c78fa51f (diff)
parent895be5b31e5175bef575008aadb4f0a27b850daa (diff)
Merge tag 'asoc-v3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v3.14 A few fixes, all driver speccific ones. The DaVinci ones aren't as clear as they should be from the subject lines on the commits but they fix issues which will prevent correct operation in some use cases and only affect that particular driver so are reasonably safe.
Diffstat (limited to 'tools/perf/builtin-buildid-cache.c')
-rw-r--r--tools/perf/builtin-buildid-cache.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index cfede86161d8..b22dbb16f877 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -63,11 +63,35 @@ static int build_id_cache__kcore_dir(char *dir, size_t sz)
63 return 0; 63 return 0;
64} 64}
65 65
66static bool same_kallsyms_reloc(const char *from_dir, char *to_dir)
67{
68 char from[PATH_MAX];
69 char to[PATH_MAX];
70 const char *name;
71 u64 addr1 = 0, addr2 = 0;
72 int i;
73
74 scnprintf(from, sizeof(from), "%s/kallsyms", from_dir);
75 scnprintf(to, sizeof(to), "%s/kallsyms", to_dir);
76
77 for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) {
78 addr1 = kallsyms__get_function_start(from, name);
79 if (addr1)
80 break;
81 }
82
83 if (name)
84 addr2 = kallsyms__get_function_start(to, name);
85
86 return addr1 == addr2;
87}
88
66static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir, 89static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir,
67 size_t to_dir_sz) 90 size_t to_dir_sz)
68{ 91{
69 char from[PATH_MAX]; 92 char from[PATH_MAX];
70 char to[PATH_MAX]; 93 char to[PATH_MAX];
94 char to_subdir[PATH_MAX];
71 struct dirent *dent; 95 struct dirent *dent;
72 int ret = -1; 96 int ret = -1;
73 DIR *d; 97 DIR *d;
@@ -86,10 +110,11 @@ static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir,
86 continue; 110 continue;
87 scnprintf(to, sizeof(to), "%s/%s/modules", to_dir, 111 scnprintf(to, sizeof(to), "%s/%s/modules", to_dir,
88 dent->d_name); 112 dent->d_name);
89 if (!compare_proc_modules(from, to)) { 113 scnprintf(to_subdir, sizeof(to_subdir), "%s/%s",
90 scnprintf(to, sizeof(to), "%s/%s", to_dir, 114 to_dir, dent->d_name);
91 dent->d_name); 115 if (!compare_proc_modules(from, to) &&
92 strlcpy(to_dir, to, to_dir_sz); 116 same_kallsyms_reloc(from_dir, to_subdir)) {
117 strlcpy(to_dir, to_subdir, to_dir_sz);
93 ret = 0; 118 ret = 0;
94 break; 119 break;
95 } 120 }