sysdep.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Assembler macros for SH.
  2. Copyright (C) 1999, 2000, 2005 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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #include <sysdeps/generic/sysdep.h>
  17. #include <features.h>
  18. #include <libc-internal.h>
  19. #ifdef __ASSEMBLER__
  20. /* Syntactic details of assembler. */
  21. #define ALIGNARG(log2) log2
  22. /* For ELF we need the `.type' directive to make shared libs work right. */
  23. #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,@##typearg;
  24. #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
  25. #ifdef SHARED
  26. #define PLTJMP(_x) _x##@PLT
  27. #else
  28. #define PLTJMP(_x) _x
  29. #endif
  30. /* Define an entry point visible from C. */
  31. #define ENTRY(name) \
  32. ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
  33. ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function) \
  34. .align ALIGNARG(5); \
  35. C_LABEL(name) \
  36. cfi_startproc; \
  37. CALL_MCOUNT
  38. #undef END
  39. #define END(name) \
  40. cfi_endproc; \
  41. ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
  42. /* If compiled for profiling, call `mcount' at the start of each function. */
  43. #ifdef PROF
  44. #define CALL_MCOUNT \
  45. mov.l 1f,r1; \
  46. sts.l pr,@-r15; \
  47. cfi_adjust_cfa_offset (4); \
  48. cfi_rel_offset (pr, 0); \
  49. mova 2f,r0; \
  50. jmp @r1; \
  51. lds r0,pr; \
  52. .align 2; \
  53. 1: .long mcount; \
  54. 2: lds.l @r15+,pr; \
  55. cfi_adjust_cfa_offset (-4); \
  56. cfi_restore (pr)
  57. #else
  58. #define CALL_MCOUNT /* Do nothing. */
  59. #endif
  60. #ifdef __UCLIBC_UNDERSCORES__
  61. /* Since C identifiers are not normally prefixed with an underscore
  62. on this system, the asm identifier `syscall_error' intrudes on the
  63. C name space. Make sure we use an innocuous name. */
  64. #define syscall_error __syscall_error
  65. #define mcount _mcount
  66. #endif
  67. #endif /* __ASSEMBLER__ */