perf: Link error on non x86 with sample_reg_masks

From: Dominik Dingel
Date: Wed Sep 30 2015 - 08:44:40 EST


Greetings,

With 4.3-rc3 during the build of perf (on s390) I get following error:

libperf.a(libperf-in.o): In function `parse_regs':
/home/dingel/GIT/linux/tools/perf/util/parse-regs-options.c:28: undefined reference to `sample_reg_masks'
/home/dingel/GIT/linux/tools/perf/util/parse-regs-options.c:45: undefined reference to `sample_reg_masks'
/home/dingel/GIT/linux/tools/perf/util/parse-regs-options.c:38: undefined reference to `sample_reg_masks'
collect2: error: ld returned 1 exit status
Makefile.perf:306: recipe for target 'perf' failed
make[1]: *** [perf] Error 1
Makefile:68: recipe for target 'all' failed
make: *** [all] Error 2

By doing the same thing, as:

commit af4aeadd8c04303c0aa2d112145c3627e2ebd026
Author: Stephane Eranian <eranian@xxxxxxxxxx>
Date: Tue Sep 1 11:30:14 2015 +0200

perf tools: Fix link time error with sample_reg_masks on non x86

does:

--- a/tools/perf/util/parse-regs-options.c
+++ b/tools/perf/util/parse-regs-options.c
@@ -4,6 +4,10 @@
#include "util/parse-options.h"
#include "util/parse-regs-options.h"

+const struct sample_reg __weak sample_reg_masks[] = {
+ SMPL_REG_END
+};
+

I was able to fix the problem, but is it the right thing to do?

Thanks,
Dominik

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/