machine-gmon.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Machine-dependent definitions for profiling support. Generic GCC 2 version.
  2. Copyright (C) 1996-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. /* GCC version 2 gives us a perfect magical function to get
  16. just the information we need:
  17. void *__builtin_return_address (unsigned int N)
  18. returns the return address of the frame N frames up. */
  19. /* Be warned that GCC cannot usefully compile __builtin_return_address(N)
  20. for N != 0 on all machines. In this case, you may have to write
  21. your own version of _mcount(). */
  22. #if __GNUC__ < 2
  23. #error "This file uses __builtin_return_address, a GCC 2 extension."
  24. #endif
  25. #include <sysdep.h>
  26. /* The canonical name for the function is `_mcount' in both C and asm,
  27. but some old asm code might assume it's `mcount'. */
  28. void _mcount (void);
  29. weak_alias (_mcount, mcount)
  30. static void mcount_internal (u_long frompc, u_long selfpc);
  31. #define _MCOUNT_DECL(frompc, selfpc) \
  32. static inline void mcount_internal (u_long frompc, u_long selfpc)
  33. #define MCOUNT \
  34. void _mcount (void) \
  35. { \
  36. mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \
  37. }