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