sysdep.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Assembler macros for Nios II.
  2. Copyright (C) 2015-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 License as
  6. published by the Free Software Foundation; either version 2.1 of the
  7. 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 ASM_SIZE_DIRECTIVE(name) .size name,.-name
  19. #define ENTRY(name) \
  20. .globl C_SYMBOL_NAME(name); \
  21. .type C_SYMBOL_NAME(name),%function; \
  22. C_LABEL(name) \
  23. cfi_startproc; \
  24. CALL_MCOUNT;
  25. #undef END
  26. #define END(name) \
  27. cfi_endproc; \
  28. ASM_SIZE_DIRECTIVE(name)
  29. #ifdef PROF
  30. # ifdef __PIC__
  31. # define CALL_MCOUNT \
  32. mov r8, ra; \
  33. nextpc r2; \
  34. 1: \
  35. movhi r3, %hiadj(_gp_got - 1b); \
  36. addi r3, r3, %lo(_gp_got - 1b); \
  37. add r2, r2, r3; \
  38. ldw r2, %call(_mcount)(r2); \
  39. callr r2; \
  40. mov ra, r8; \
  41. ret;
  42. # else
  43. # define CALL_MCOUNT \
  44. mov r8, ra; \
  45. call _mount; \
  46. mov ra, r8; \
  47. ret;
  48. # endif
  49. #else
  50. # define CALL_MCOUNT /* Do nothing. */
  51. #endif
  52. #endif /* __ASSEMBLER__ */