aarch64-elf.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* Machine description for AArch64 architecture.
  2. Copyright (C) 2009-2015 Free Software Foundation, Inc.
  3. Contributed by ARM Ltd.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_AARCH64_ELF_H
  17. #define GCC_AARCH64_ELF_H
  18. #define ASM_OUTPUT_LABELREF(FILE, NAME) \
  19. aarch64_asm_output_labelref (FILE, NAME)
  20. #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
  21. do \
  22. { \
  23. assemble_name (FILE, NAME1); \
  24. fputs (" = ", FILE); \
  25. assemble_name (FILE, NAME2); \
  26. fputc ('\n', FILE); \
  27. } while (0)
  28. #define TEXT_SECTION_ASM_OP "\t.text"
  29. #define DATA_SECTION_ASM_OP "\t.data"
  30. #define BSS_SECTION_ASM_OP "\t.bss"
  31. #define CTORS_SECTION_ASM_OP "\t.section\t.init_array,\"aw\",%init_array"
  32. #define DTORS_SECTION_ASM_OP "\t.section\t.fini_array,\"aw\",%fini_array"
  33. #undef INIT_SECTION_ASM_OP
  34. #undef FINI_SECTION_ASM_OP
  35. #define INIT_ARRAY_SECTION_ASM_OP CTORS_SECTION_ASM_OP
  36. #define FINI_ARRAY_SECTION_ASM_OP DTORS_SECTION_ASM_OP
  37. /* Since we use .init_array/.fini_array we don't need the markers at
  38. the start and end of the ctors/dtors arrays. */
  39. #define CTOR_LIST_BEGIN asm (CTORS_SECTION_ASM_OP)
  40. #define CTOR_LIST_END /* empty */
  41. #define DTOR_LIST_BEGIN asm (DTORS_SECTION_ASM_OP)
  42. #define DTOR_LIST_END /* empty */
  43. #undef TARGET_ASM_CONSTRUCTOR
  44. #define TARGET_ASM_CONSTRUCTOR aarch64_elf_asm_constructor
  45. #undef TARGET_ASM_DESTRUCTOR
  46. #define TARGET_ASM_DESTRUCTOR aarch64_elf_asm_destructor
  47. #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
  48. /* Support for -falign-* switches. Use .p2align to ensure that code
  49. sections are padded with NOP instructions, rather than zeros. */
  50. #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
  51. do \
  52. { \
  53. if ((LOG) != 0) \
  54. { \
  55. if ((MAX_SKIP) == 0) \
  56. fprintf ((FILE), "\t.p2align %d\n", (int) (LOG)); \
  57. else \
  58. fprintf ((FILE), "\t.p2align %d,,%d\n", \
  59. (int) (LOG), (int) (MAX_SKIP)); \
  60. } \
  61. } while (0)
  62. #endif /* HAVE_GAS_MAX_SKIP_P2ALIGN */
  63. #define JUMP_TABLES_IN_TEXT_SECTION 0
  64. #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
  65. do { \
  66. switch (GET_MODE (BODY)) \
  67. { \
  68. case QImode: \
  69. asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n", \
  70. VALUE, REL); \
  71. break; \
  72. case HImode: \
  73. asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n", \
  74. VALUE, REL); \
  75. break; \
  76. case SImode: \
  77. case DImode: /* See comment in aarch64_output_casesi. */ \
  78. asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n", \
  79. VALUE, REL); \
  80. break; \
  81. default: \
  82. gcc_unreachable (); \
  83. } \
  84. } while (0)
  85. #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
  86. fprintf(STREAM, "\t.align\t%d\n", (int)POWER)
  87. #define ASM_COMMENT_START "//"
  88. #define LOCAL_LABEL_PREFIX "."
  89. #define USER_LABEL_PREFIX ""
  90. #define GLOBAL_ASM_OP "\t.global\t"
  91. #ifdef TARGET_BIG_ENDIAN_DEFAULT
  92. #define ENDIAN_SPEC "-mbig-endian"
  93. #else
  94. #define ENDIAN_SPEC "-mlittle-endian"
  95. #endif
  96. #if TARGET_DATA_MODEL == 1
  97. #define ABI_SPEC "-mabi=lp64"
  98. #define MULTILIB_DEFAULTS { "mabi=lp64" }
  99. #elif TARGET_DATA_MODEL == 2
  100. #define ABI_SPEC "-mabi=ilp32"
  101. #define MULTILIB_DEFAULTS { "mabi=ilp32" }
  102. #else
  103. #error "Unknown or undefined TARGET_DATA_MODEL!"
  104. #endif
  105. /* Force the default endianness and ABI flags onto the command line
  106. in order to make the other specs easier to write. */
  107. #undef DRIVER_SELF_SPECS
  108. #define DRIVER_SELF_SPECS \
  109. " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \
  110. " %{!mabi=*:" ABI_SPEC "}"
  111. #ifdef HAVE_AS_MABI_OPTION
  112. #define ASM_MABI_SPEC "%{mabi=*:-mabi=%*}"
  113. #else
  114. #define ASM_MABI_SPEC "%{mabi=lp64:}"
  115. #endif
  116. #ifndef ASM_SPEC
  117. #define ASM_SPEC "\
  118. %{mbig-endian:-EB} \
  119. %{mlittle-endian:-EL} \
  120. %{march=*:-march=%*} \
  121. %(asm_cpu_spec)" \
  122. ASM_MABI_SPEC
  123. #endif
  124. #undef TYPE_OPERAND_FMT
  125. #define TYPE_OPERAND_FMT "%%%s"
  126. #undef TARGET_ASM_NAMED_SECTION
  127. #define TARGET_ASM_NAMED_SECTION aarch64_elf_asm_named_section
  128. /* Stabs debug not required. */
  129. #undef DBX_DEBUGGING_INFO
  130. #endif /* GCC_AARCH64_ELF_H */