sysdep.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Assembler macros for SH.
  2. Copyright (C) 1999-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. #include <sysdeps/generic/sysdep.h>
  16. #ifdef __ASSEMBLER__
  17. /* Syntactic details of assembler. */
  18. #define ALIGNARG(log2) log2
  19. #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
  20. #ifdef SHARED
  21. #define PLTJMP(_x) _x##@PLT
  22. #else
  23. #define PLTJMP(_x) _x
  24. #endif
  25. /* Define an entry point visible from C. */
  26. #define ENTRY(name) \
  27. .globl C_SYMBOL_NAME(name); \
  28. .type C_SYMBOL_NAME(name),@function; \
  29. .align ALIGNARG(5); \
  30. C_LABEL(name) \
  31. cfi_startproc; \
  32. CALL_MCOUNT
  33. #undef END
  34. #define END(name) \
  35. cfi_endproc; \
  36. ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
  37. /* If compiled for profiling, call `mcount' at the start of each function. */
  38. #ifdef PROF
  39. #define CALL_MCOUNT \
  40. mov.l 1f,r1; \
  41. sts.l pr,@-r15; \
  42. cfi_adjust_cfa_offset (4); \
  43. cfi_rel_offset (pr, 0); \
  44. mova 2f,r0; \
  45. jmp @r1; \
  46. lds r0,pr; \
  47. .align 2; \
  48. 1: .long mcount; \
  49. 2: lds.l @r15+,pr; \
  50. cfi_adjust_cfa_offset (-4); \
  51. cfi_restore (pr)
  52. #else
  53. #define CALL_MCOUNT /* Do nothing. */
  54. #endif
  55. /* Since C identifiers are not normally prefixed with an underscore
  56. on this system, the asm identifier `syscall_error' intrudes on the
  57. C name space. Make sure we use an innocuous name. */
  58. #define syscall_error __syscall_error
  59. #define mcount _mcount
  60. #endif /* __ASSEMBLER__ */