~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/Documentation/Build.txt

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/Documentation/Build.txt (Architecture m68k) and /tools/perf/Documentation/Build.txt (Architecture ppc)


  1                                                     1 
  2 1) perf build                                       2 1) perf build
  3 =============                                       3 =============
  4 The perf build process consists of several sep      4 The perf build process consists of several separated building blocks,
  5 which are linked together to form the perf bin      5 which are linked together to form the perf binary:
  6   - libperf library (static)                        6   - libperf library (static)
  7   - perf builtin commands                           7   - perf builtin commands
  8   - traceevent library (static)                     8   - traceevent library (static)
  9   - GTK ui library                                  9   - GTK ui library
 10                                                    10 
 11 Several makefiles govern the perf build:           11 Several makefiles govern the perf build:
 12                                                    12 
 13   - Makefile                                       13   - Makefile
 14     top level Makefile working as a wrapper th     14     top level Makefile working as a wrapper that calls the main
 15     Makefile.perf with a -j option to do paral     15     Makefile.perf with a -j option to do parallel builds.
 16                                                    16 
 17   - Makefile.perf                                  17   - Makefile.perf
 18     main makefile that triggers build of all p     18     main makefile that triggers build of all perf objects including
 19     installation and documentation processing.     19     installation and documentation processing.
 20                                                    20 
 21   - tools/build/Makefile.build                     21   - tools/build/Makefile.build
 22     main makefile of the build framework           22     main makefile of the build framework
 23                                                    23 
 24   - tools/build/Build.include                      24   - tools/build/Build.include
 25     build framework generic definitions            25     build framework generic definitions
 26                                                    26 
 27   - Build makefiles                                27   - Build makefiles
 28     makefiles that defines build objects           28     makefiles that defines build objects
 29                                                    29 
 30 Please refer to tools/build/Documentation/Buil     30 Please refer to tools/build/Documentation/Build.txt for more
 31 information about build framework.                 31 information about build framework.
 32                                                    32 
 33                                                    33 
 34 2) perf build                                      34 2) perf build
 35 =============                                      35 =============
 36 The Makefile.perf triggers the build framework     36 The Makefile.perf triggers the build framework for build objects:
 37    perf, libperf, gtk                              37    perf, libperf, gtk
 38                                                    38 
 39 resulting in following objects:                    39 resulting in following objects:
 40   $ ls  *-in.o                                     40   $ ls  *-in.o
 41   gtk-in.o  libperf-in.o  perf-in.o                41   gtk-in.o  libperf-in.o  perf-in.o
 42                                                    42 
 43 Those objects are then used in final linking:      43 Those objects are then used in final linking:
 44   libperf-gtk.so <- gtk-in.o  libperf-in.o         44   libperf-gtk.so <- gtk-in.o  libperf-in.o
 45   perf           <- perf-in.o libperf-in.o         45   perf           <- perf-in.o libperf-in.o
 46                                                    46 
 47                                                    47 
 48 NOTE this description is omitting other librar     48 NOTE this description is omitting other libraries involved, only
 49      focusing on build framework outcomes          49      focusing on build framework outcomes
 50                                                    50 
 51 3) Build with ASan or UBSan                        51 3) Build with ASan or UBSan
 52 ==========================                         52 ==========================
 53   $ cd tools/perf                                  53   $ cd tools/perf
 54   $ make DESTDIR=/usr                              54   $ make DESTDIR=/usr
 55   $ make DESTDIR=/usr install                      55   $ make DESTDIR=/usr install
 56                                                    56 
 57 AddressSanitizer (or ASan) is a GCC feature th     57 AddressSanitizer (or ASan) is a GCC feature that detects memory corruption bugs
 58 such as buffer overflows and memory leaks.         58 such as buffer overflows and memory leaks.
 59                                                    59 
 60   $ cd tools/perf                                  60   $ cd tools/perf
 61   $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame     61   $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
 62   $ ASAN_OPTIONS=log_path=asan.log ./perf reco     62   $ ASAN_OPTIONS=log_path=asan.log ./perf record -a
 63                                                    63 
 64 ASan outputs all detected issues into a log fi     64 ASan outputs all detected issues into a log file named 'asan.log.<pid>'.
 65                                                    65 
 66 UndefinedBehaviorSanitizer (or UBSan) is a fas     66 UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior detector
 67 supported by GCC. UBSan detects undefined beha     67 supported by GCC. UBSan detects undefined behaviors of programs at runtime.
 68                                                    68 
 69   $ cd tools/perf                                  69   $ cd tools/perf
 70   $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame     70   $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=undefined'
 71   $ UBSAN_OPTIONS=print_stacktrace=1 ./perf re     71   $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a
 72                                                    72 
 73 If UBSan detects any problem at runtime, it ou     73 If UBSan detects any problem at runtime, it outputs a “runtime error:” message.
 74                                                    74 
 75 4) Cross compilation                               75 4) Cross compilation
 76 ====================                               76 ====================
 77 As Multiarch is commonly supported in Linux di     77 As Multiarch is commonly supported in Linux distributions, we can install
 78 libraries for multiple architectures on the sa     78 libraries for multiple architectures on the same system and then cross-compile
 79 Linux perf. For example, Aarch64 libraries and     79 Linux perf. For example, Aarch64 libraries and toolchains can be installed on
 80 an x86_64 machine, allowing us to compile perf     80 an x86_64 machine, allowing us to compile perf for an Aarch64 target.
 81                                                    81 
 82 Below is the command for building the perf wit     82 Below is the command for building the perf with dynamic linking.
 83                                                    83 
 84   $ cd /path/to/Linux                              84   $ cd /path/to/Linux
 85   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linu     85   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
 86                                                    86 
 87 For static linking, the option `LDFLAGS="-stat     87 For static linking, the option `LDFLAGS="-static"` is required.
 88                                                    88 
 89   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linu     89   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
 90     LDFLAGS="-static" -C tools/perf                90     LDFLAGS="-static" -C tools/perf
 91                                                    91 
 92 In the embedded system world, a use case is to     92 In the embedded system world, a use case is to explicitly specify the package
 93 configuration paths for cross building:            93 configuration paths for cross building:
 94                                                    94 
 95   $ PKG_CONFIG_SYSROOT_DIR="/path/to/cross/bui     95   $ PKG_CONFIG_SYSROOT_DIR="/path/to/cross/build/sysroot" \
 96     PKG_CONFIG_LIBDIR="/usr/lib/:/usr/local/li     96     PKG_CONFIG_LIBDIR="/usr/lib/:/usr/local/lib" \
 97     make ARCH=arm64 CROSS_COMPILE=aarch64-linu     97     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
 98                                                    98 
 99 In this case, the variable PKG_CONFIG_SYSROOT_     99 In this case, the variable PKG_CONFIG_SYSROOT_DIR can be used alongside the
100 variable PKG_CONFIG_LIBDIR or PKG_CONFIG_PATH     100 variable PKG_CONFIG_LIBDIR or PKG_CONFIG_PATH to prepend the sysroot path to
101 the library paths for cross compilation.          101 the library paths for cross compilation.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php