Build.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. 1) perf build
  2. =============
  3. The perf build process consists of several separated building blocks,
  4. which are linked together to form the perf binary:
  5. - libperf library (static)
  6. - perf builtin commands
  7. - traceevent library (static)
  8. - GTK ui library
  9. Several makefiles govern the perf build:
  10. - Makefile
  11. top level Makefile working as a wrapper that calls the main
  12. Makefile.perf with a -j option to do parallel builds.
  13. - Makefile.perf
  14. main makefile that triggers build of all perf objects including
  15. installation and documentation processing.
  16. - tools/build/Makefile.build
  17. main makefile of the build framework
  18. - tools/build/Build.include
  19. build framework generic definitions
  20. - Build makefiles
  21. makefiles that defines build objects
  22. Please refer to tools/build/Documentation/Build.txt for more
  23. information about build framework.
  24. 2) perf build
  25. =============
  26. The Makefile.perf triggers the build framework for build objects:
  27. perf, libperf, gtk
  28. resulting in following objects:
  29. $ ls *-in.o
  30. gtk-in.o libperf-in.o perf-in.o
  31. Those objects are then used in final linking:
  32. libperf-gtk.so <- gtk-in.o libperf-in.o
  33. perf <- perf-in.o libperf-in.o
  34. NOTE this description is omitting other libraries involved, only
  35. focusing on build framework outcomes
  36. 3) Build with ASan or UBSan
  37. ==========================
  38. $ cd tools/perf
  39. $ make DESTDIR=/usr
  40. $ make DESTDIR=/usr install
  41. AddressSanitizer (or ASan) is a GCC feature that detects memory corruption bugs
  42. such as buffer overflows and memory leaks.
  43. $ cd tools/perf
  44. $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
  45. $ ASAN_OPTIONS=log_path=asan.log ./perf record -a
  46. ASan outputs all detected issues into a log file named 'asan.log.<pid>'.
  47. UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior detector
  48. supported by GCC. UBSan detects undefined behaviors of programs at runtime.
  49. $ cd tools/perf
  50. $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=undefined'
  51. $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a
  52. If UBSan detects any problem at runtime, it outputs a “runtime error:” message.