OSDN Git Service

* config/sh/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / linux.h
1 /* Definitions for SH running Linux-based GNU systems using ELF
2    Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005
3    Free Software Foundation, Inc.
4    Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
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 2, 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 this program; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* Run-time Target Specification.  */
24 #undef TARGET_VERSION
25 #define TARGET_VERSION  fputs (" (SH GNU/Linux with ELF)", stderr);
26
27 /* Enable DWARF 2 exceptions.  */
28 #undef DWARF2_UNWIND_INFO
29 #define DWARF2_UNWIND_INFO 1
30
31 #undef SUBTARGET_CPP_SPEC
32 #define SUBTARGET_CPP_SPEC "\
33    %{posix:-D_POSIX_SOURCE} \
34    %{pthread:-D_REENTRANT -D_PTHREADS} \
35 "
36
37 #define TARGET_OS_CPP_BUILTINS() \
38   do                                            \
39     {                                           \
40       LINUX_TARGET_OS_CPP_BUILTINS();           \
41       if (flag_pic)                             \
42         {                                       \
43           builtin_define ("__PIC__");           \
44           builtin_define ("__pic__");           \
45         }                                       \
46     }                                           \
47   while (0)
48
49 #undef TARGET_DEFAULT
50 #define TARGET_DEFAULT \
51   (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
52
53 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
54
55 #undef SUBTARGET_LINK_EMUL_SUFFIX
56 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
57 #undef SUBTARGET_LINK_SPEC
58 #define SUBTARGET_LINK_SPEC \
59   "%{shared:-shared} \
60    %{!static: \
61      %{rdynamic:-export-dynamic} \
62      %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
63    %{static:-static}"
64
65 /* Output assembler code to STREAM to call the profiler.  */
66
67 #undef FUNCTION_PROFILER
68 #define FUNCTION_PROFILER(STREAM,LABELNO)                               \
69   do {                                                                  \
70     if (flag_pic)                                                       \
71       {                                                                 \
72         fprintf (STREAM, "\tmov.l\t3f,r1\n");                           \
73         fprintf (STREAM, "\tmova\t3f,r0\n");                            \
74         fprintf (STREAM, "\tadd\tr1,r0\n");                             \
75         fprintf (STREAM, "\tmov.l\t1f,r1\n");                           \
76         fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");                     \
77       }                                                                 \
78     else                                                                \
79       fprintf (STREAM, "\tmov.l\t1f,r1\n");                             \
80     fprintf (STREAM, "\tsts.l\tpr,@-r15\n");                            \
81     fprintf (STREAM, "\tmova\t2f,r0\n");                                \
82     fprintf (STREAM, "\tjmp\t@r1\n");                                   \
83     fprintf (STREAM, "\tlds\tr0,pr\n");                                 \
84     fprintf (STREAM, "\t.align\t2\n");                                  \
85     if (flag_pic)                                                       \
86       {                                                                 \
87         fprintf (STREAM, "1:\t.long\tmcount@GOT\n");                    \
88         fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");         \
89       }                                                                 \
90     else                                                                \
91       fprintf (STREAM, "1:\t.long\tmcount\n");                          \
92     fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");                          \
93   } while (0)
94
95 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
96
97 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
98    to a fake register number 16 as a placeholder for the return address
99    in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
100    _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
101    the register.  So the entry of dwarf_reg_size_table corresponding to
102    this slot must be set.  To do this, we redefine DBX_REGISTER_NUMBER
103    so as to return itself for 16.  */
104 #undef DBX_REGISTER_NUMBER
105 #define DBX_REGISTER_NUMBER(REGNO) \
106   ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))