File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -71,3 +71,31 @@ supported by GCC. UBSan detects undefined behaviors of programs at runtime.
71
71
$ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a
72
72
73
73
If UBSan detects any problem at runtime, it outputs a “runtime error:” message.
74
+
75
+ 4) Cross compilation
76
+ ====================
77
+ As Multiarch is commonly supported in Linux distributions, we can install
78
+ libraries for multiple architectures on the same system and then cross-compile
79
+ Linux perf. For example, Aarch64 libraries and toolchains can be installed on
80
+ an x86_64 machine, allowing us to compile perf for an Aarch64 target.
81
+
82
+ Below is the command for building the perf with dynamic linking.
83
+
84
+ $ cd /path/to/Linux
85
+ $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
86
+
87
+ For static linking, the option `LDFLAGS="-static"` is required.
88
+
89
+ $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
90
+ LDFLAGS="-static" -C tools/perf
91
+
92
+ In the embedded system world, a use case is to explicitly specify the package
93
+ configuration paths for cross building:
94
+
95
+ $ PKG_CONFIG_SYSROOT_DIR="/path/to/cross/build/sysroot" \
96
+ PKG_CONFIG_LIBDIR="/usr/lib/:/usr/local/lib" \
97
+ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
98
+
99
+ In this case, the variable PKG_CONFIG_SYSROOT_DIR can be used alongside the
100
+ variable PKG_CONFIG_LIBDIR or PKG_CONFIG_PATH to prepend the sysroot path to
101
+ the library paths for cross compilation.
You can’t perform that action at this time.
0 commit comments