]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/sh/linux.h
host-hpux.c: Change copyright header to refer to version 3 of the GNU General Public...
[thirdparty/gcc.git] / gcc / config / sh / linux.h
CommitLineData
93ca1662 1/* Definitions for SH running Linux-based GNU systems using ELF
2f83c7d6 2 Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
e35b30c7 3 Free Software Foundation, Inc.
93ca1662
NY
4 Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
5
7ec022b2 6This file is part of GCC.
93ca1662 7
7ec022b2 8GCC is free software; you can redistribute it and/or modify
93ca1662 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
93ca1662
NY
11any later version.
12
7ec022b2 13GCC is distributed in the hope that it will be useful,
93ca1662
NY
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
2f83c7d6
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
93ca1662
NY
21
22/* Run-time Target Specification. */
23#undef TARGET_VERSION
24#define TARGET_VERSION fputs (" (SH GNU/Linux with ELF)", stderr);
25
4977bab6
ZW
26/* Enable DWARF 2 exceptions. */
27#undef DWARF2_UNWIND_INFO
28#define DWARF2_UNWIND_INFO 1
29
f636e2a5
AH
30#undef SUBTARGET_CPP_SPEC
31#define SUBTARGET_CPP_SPEC "\
93ca1662 32 %{posix:-D_POSIX_SOURCE} \
f636e2a5
AH
33 %{pthread:-D_REENTRANT -D_PTHREADS} \
34"
35
f1a58d92 36#define TARGET_OS_CPP_BUILTINS() \
65f527e0
KK
37 do \
38 { \
39 LINUX_TARGET_OS_CPP_BUILTINS(); \
65f527e0
KK
40 } \
41 while (0)
f1a58d92
R
42
43#undef TARGET_DEFAULT
44#define TARGET_DEFAULT \
c0fb94d7 45 (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT \
73a4d10b 46 | TARGET_OPT_DEFAULT)
f1a58d92 47
43c73004
KK
48#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
49
7bd85ce0
JM
50#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
51
f1a58d92
R
52#undef SUBTARGET_LINK_EMUL_SUFFIX
53#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
54#undef SUBTARGET_LINK_SPEC
55#define SUBTARGET_LINK_SPEC \
56 "%{shared:-shared} \
93ca1662
NY
57 %{!static: \
58 %{rdynamic:-export-dynamic} \
7bd85ce0 59 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
93ca1662
NY
60 %{static:-static}"
61
4977bab6
ZW
62/* Output assembler code to STREAM to call the profiler. */
63
64#undef FUNCTION_PROFILER
65#define FUNCTION_PROFILER(STREAM,LABELNO) \
66 do { \
ae88d80c 67 if (TARGET_SHMEDIA) \
4977bab6 68 { \
ae88d80c
KK
69 fprintf (STREAM, "\tpt\t1f,tr1\n"); \
70 fprintf (STREAM, "\taddi.l\tr15,-8,r15\n"); \
71 fprintf (STREAM, "\tst.l\tr15,0,r18\n"); \
72 if (flag_pic) \
73 { \
76243d10 74 const char *gofs = "(datalabel _GLOBAL_OFFSET_TABLE_-(0f-.))"; \
ae88d80c
KK
75 fprintf (STREAM, "\tmovi\t((%s>>16)&0xffff),r21\n", gofs); \
76 fprintf (STREAM, "\tshori\t(%s & 0xffff),r21\n", gofs); \
77 fprintf (STREAM, "0:\tptrel/u\tr21,tr0\n"); \
78 fprintf (STREAM, "\tmovi\t((mcount@GOTPLT)&0xffff),r22\n"); \
79 fprintf (STREAM, "\tgettr\ttr0,r21\n"); \
80 fprintf (STREAM, "\tadd.l\tr21,r22,r21\n"); \
81 fprintf (STREAM, "\tld.l\tr21,0,r21\n"); \
82 fprintf (STREAM, "\tptabs\tr21,tr0\n"); \
83 } \
84 else \
85 fprintf (STREAM, "\tpt\tmcount,tr0\n"); \
86 fprintf (STREAM, "\tgettr\ttr1,r18\n"); \
87 fprintf (STREAM, "\tblink\ttr0,r63\n"); \
88 fprintf (STREAM, "1:\tld.l\tr15,0,r18\n"); \
89 fprintf (STREAM, "\taddi.l\tr15,8,r15\n"); \
4977bab6
ZW
90 } \
91 else \
4977bab6 92 { \
ae88d80c
KK
93 if (flag_pic) \
94 { \
95 fprintf (STREAM, "\tmov.l\t3f,r1\n"); \
96 fprintf (STREAM, "\tmova\t3f,r0\n"); \
97 fprintf (STREAM, "\tadd\tr1,r0\n"); \
98 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
99 fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n"); \
100 } \
101 else \
102 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
103 fprintf (STREAM, "\tsts.l\tpr,@-r15\n"); \
104 fprintf (STREAM, "\tmova\t2f,r0\n"); \
105 fprintf (STREAM, "\tjmp\t@r1\n"); \
106 fprintf (STREAM, "\tlds\tr0,pr\n"); \
107 fprintf (STREAM, "\t.align\t2\n"); \
108 if (flag_pic) \
109 { \
110 fprintf (STREAM, "1:\t.long\tmcount@GOT\n"); \
111 fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n"); \
112 } \
113 else \
114 fprintf (STREAM, "1:\t.long\tmcount\n"); \
115 fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n"); \
4977bab6 116 } \
4977bab6
ZW
117 } while (0)
118
8662eb14 119#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
235b4b36
KK
120
121/* For SH3 and SH4, we use a slot of the unwind frame which correspond
122 to a fake register number 16 as a placeholder for the return address
123 in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
124 _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
125 the register. So the entry of dwarf_reg_size_table corresponding to
126 this slot must be set. To do this, we redefine DBX_REGISTER_NUMBER
127 so as to return itself for 16. */
128#undef DBX_REGISTER_NUMBER
129#define DBX_REGISTER_NUMBER(REGNO) \
130 ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))
73a4d10b
R
131
132/* Since libgcc is compiled with -fpic for this target, we can't use
133 __sdivsi3_1 as the division strategy for -O0 and -Os. */
134#undef SH_DIV_STRATEGY_DEFAULT
135#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
136#undef SH_DIV_STR_FOR_SIZE
137#define SH_DIV_STR_FOR_SIZE "call2"