linux.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /* Definitions for Motorola 68k running Linux-based GNU systems with
  2. ELF format.
  3. Copyright (C) 1995-2015 Free Software Foundation, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify
  6. it 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,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU 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. /* Add %(asm_cpu_spec) to a generic definition of ASM_SPEC. */
  17. #undef ASM_SPEC
  18. #define ASM_SPEC "%(asm_cpu_spec) %(asm_pcrel_spec)"
  19. #undef PREFERRED_STACK_BOUNDARY
  20. #define PREFERRED_STACK_BOUNDARY 32
  21. /* for 68k machines this only needs to be TRUE for the 68000 */
  22. #undef STRICT_ALIGNMENT
  23. #define STRICT_ALIGNMENT 0
  24. #undef M68K_HONOR_TARGET_STRICT_ALIGNMENT
  25. #define M68K_HONOR_TARGET_STRICT_ALIGNMENT 0
  26. /* Here are four prefixes that are used by asm_fprintf to
  27. facilitate customization for alternate assembler syntaxes.
  28. Machines with no likelihood of an alternate syntax need not
  29. define these and need not use asm_fprintf. */
  30. /* The prefix for register names. Note that REGISTER_NAMES
  31. is supposed to include this prefix. Also note that this is NOT an
  32. fprintf format string, it is a literal string */
  33. #undef REGISTER_PREFIX
  34. #define REGISTER_PREFIX "%"
  35. /* The prefix for local (compiler generated) labels.
  36. These labels will not appear in the symbol table. */
  37. #undef LOCAL_LABEL_PREFIX
  38. #define LOCAL_LABEL_PREFIX "."
  39. /* The prefix to add to user-visible assembler symbols. */
  40. #undef USER_LABEL_PREFIX
  41. #define USER_LABEL_PREFIX ""
  42. #define ASM_COMMENT_START "|"
  43. /* Target OS builtins. */
  44. #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
  45. #undef CPP_SPEC
  46. #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
  47. /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
  48. for the special GCC options -static and -shared, which allow us to
  49. link things in one of these three modes by applying the appropriate
  50. combinations of options at link-time.
  51. When the -shared link option is used a final link is not being
  52. done. */
  53. #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  54. #undef LINK_SPEC
  55. #define LINK_SPEC "-m m68kelf %{shared} \
  56. %{!shared: \
  57. %{!static: \
  58. %{rdynamic:-export-dynamic} \
  59. -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
  60. %{static}}"
  61. /* For compatibility with linux/a.out */
  62. #undef PCC_BITFIELD_TYPE_MATTERS
  63. /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
  64. keep switch tables in the text section. */
  65. #define JUMP_TABLES_IN_TEXT_SECTION 1
  66. /* Use the default action for outputting the case label. */
  67. #undef ASM_OUTPUT_CASE_LABEL
  68. #define ASM_RETURN_CASE_JUMP \
  69. do { \
  70. if (TARGET_COLDFIRE) \
  71. { \
  72. if (ADDRESS_REG_P (operands[0])) \
  73. return "jmp %%pc@(2,%0:l)"; \
  74. else \
  75. return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
  76. } \
  77. else \
  78. return "jmp %%pc@(2,%0:w)"; \
  79. } while (0)
  80. /* This is how to output an assembler line that says to advance the
  81. location counter to a multiple of 2**LOG bytes. */
  82. #undef ASM_OUTPUT_ALIGN
  83. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  84. if ((LOG) > 0) \
  85. fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));
  86. /* If defined, a C expression whose value is a string containing the
  87. assembler operation to identify the following data as uninitialized global
  88. data. */
  89. #define BSS_SECTION_ASM_OP "\t.section\t.bss"
  90. /* A C statement (sans semicolon) to output to the stdio stream
  91. FILE the assembler definition of uninitialized global DECL named
  92. NAME whose size is SIZE bytes and alignment is ALIGN bytes.
  93. Try to use asm_output_aligned_bss to implement this macro. */
  94. #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  95. asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
  96. /* Output assembler code to FILE to increment profiler label # LABELNO
  97. for profiling a function entry. */
  98. #define NO_PROFILE_COUNTERS 1
  99. #undef FUNCTION_PROFILER
  100. #define FUNCTION_PROFILER(FILE, LABELNO) \
  101. { \
  102. if (flag_pic) \
  103. fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
  104. else \
  105. fprintf (FILE, "\tjbsr _mcount\n"); \
  106. }
  107. /* Do not break .stabs pseudos into continuations. */
  108. #define DBX_CONTIN_LENGTH 0
  109. /* 1 if N is a possible register number for a function value. For
  110. m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
  111. pointer, or floating types, respectively. Reject fp0 if not using
  112. a 68881 coprocessor. */
  113. #undef FUNCTION_VALUE_REGNO_P
  114. #define FUNCTION_VALUE_REGNO_P(N) \
  115. ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
  116. /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
  117. more than one register. */
  118. #undef NEEDS_UNTYPED_CALL
  119. #define NEEDS_UNTYPED_CALL 1
  120. /* Define how to generate (in the callee) the output value of a
  121. function and how to find (in the caller) the value returned by a
  122. function. VALTYPE is the data type of the value (as a tree). If
  123. the precise function being called is known, FUNC is its
  124. FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
  125. result in d0, a0, or fp0 as appropriate. */
  126. #undef FUNCTION_VALUE
  127. #define FUNCTION_VALUE(VALTYPE, FUNC) \
  128. m68k_function_value (VALTYPE, FUNC)
  129. /* Define how to find the value returned by a library function
  130. assuming the value has mode MODE.
  131. For m68k/SVR4 look for integer values in d0, pointer values in d0
  132. (returned in both d0 and a0), and floating values in fp0. */
  133. #undef LIBCALL_VALUE
  134. #define LIBCALL_VALUE(MODE) \
  135. m68k_libcall_value (MODE)
  136. /* For m68k SVR4, structures are returned using the reentrant
  137. technique. */
  138. #undef PCC_STATIC_STRUCT_RETURN
  139. #define DEFAULT_PCC_STRUCT_RETURN 0
  140. /* Finalize the trampoline by flushing the insn cache. */
  141. #undef FINALIZE_TRAMPOLINE
  142. #define FINALIZE_TRAMPOLINE(TRAMP) \
  143. emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
  144. LCT_NORMAL, VOIDmode, 2, TRAMP, Pmode, \
  145. plus_constant (Pmode, TRAMP, TRAMPOLINE_SIZE), \
  146. Pmode);
  147. /* Clear the instruction cache from `beg' to `end'. This makes an
  148. inline system call to SYS_cacheflush. The arguments are as
  149. follows:
  150. cacheflush (addr, scope, cache, len)
  151. addr - the start address for the flush
  152. scope - the scope of the flush (see the cpush insn)
  153. cache - which cache to flush (see the cpush insn)
  154. len - a factor relating to the number of flushes to perform:
  155. len/16 lines, or len/4096 pages. */
  156. #define CLEAR_INSN_CACHE(BEG, END) \
  157. { \
  158. register unsigned long _beg __asm ("%d1") = (unsigned long) (BEG); \
  159. unsigned long _end = (unsigned long) (END); \
  160. register unsigned long _len __asm ("%d4") = (_end - _beg + 32); \
  161. __asm __volatile \
  162. ("move%.l #123, %/d0\n\t" /* system call nr */ \
  163. "move%.l #1, %/d2\n\t" /* clear lines */ \
  164. "move%.l #3, %/d3\n\t" /* insn+data caches */ \
  165. "trap #0" \
  166. : /* no outputs */ \
  167. : "d" (_beg), "d" (_len) \
  168. : "%d0", "%d2", "%d3"); \
  169. }
  170. #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  171. #undef DBX_REGISTER_NUMBER
  172. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  173. #undef SIZE_TYPE
  174. #define SIZE_TYPE "unsigned int"
  175. #undef PTRDIFF_TYPE
  176. #define PTRDIFF_TYPE "int"
  177. #undef WCHAR_TYPE
  178. #define WCHAR_TYPE "long int"
  179. #undef WCHAR_TYPE_SIZE
  180. #define WCHAR_TYPE_SIZE BITS_PER_WORD
  181. /* Install the __sync libcalls. */
  182. #undef TARGET_INIT_LIBFUNCS
  183. #define TARGET_INIT_LIBFUNCS m68k_init_sync_libfuncs