gcc_base.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/export.h>
  3. #include <linux/kernel.h>
  4. #include <linux/mutex.h>
  5. #include "gcov.h"
  6. /*
  7. * __gcov_init is called by gcc-generated constructor code for each object
  8. * file compiled with -fprofile-arcs.
  9. */
  10. void __gcov_init(struct gcov_info *info)
  11. {
  12. static unsigned int gcov_version;
  13. mutex_lock(&gcov_lock);
  14. if (gcov_version == 0) {
  15. gcov_version = gcov_info_version(info);
  16. /*
  17. * Printing gcc's version magic may prove useful for debugging
  18. * incompatibility reports.
  19. */
  20. pr_info("version magic: 0x%x\n", gcov_version);
  21. }
  22. /*
  23. * Add new profiling data structure to list and inform event
  24. * listener.
  25. */
  26. gcov_info_link(info);
  27. if (gcov_events_enabled)
  28. gcov_event(GCOV_ADD, info);
  29. mutex_unlock(&gcov_lock);
  30. }
  31. EXPORT_SYMBOL(__gcov_init);
  32. /*
  33. * These functions may be referenced by gcc-generated profiling code but serve
  34. * no function for kernel profiling.
  35. */
  36. void __gcov_flush(void)
  37. {
  38. /* Unused. */
  39. }
  40. EXPORT_SYMBOL(__gcov_flush);
  41. void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
  42. {
  43. /* Unused. */
  44. }
  45. EXPORT_SYMBOL(__gcov_merge_add);
  46. void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
  47. {
  48. /* Unused. */
  49. }
  50. EXPORT_SYMBOL(__gcov_merge_single);
  51. void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
  52. {
  53. /* Unused. */
  54. }
  55. EXPORT_SYMBOL(__gcov_merge_delta);
  56. void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
  57. {
  58. /* Unused. */
  59. }
  60. EXPORT_SYMBOL(__gcov_merge_ior);
  61. void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
  62. {
  63. /* Unused. */
  64. }
  65. EXPORT_SYMBOL(__gcov_merge_time_profile);
  66. void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
  67. {
  68. /* Unused. */
  69. }
  70. EXPORT_SYMBOL(__gcov_merge_icall_topn);
  71. void __gcov_exit(void)
  72. {
  73. /* Unused. */
  74. }
  75. EXPORT_SYMBOL(__gcov_exit);