]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sh/linux.h
linux.h (ASM_PREFERRED_EH_DATA_FORMAT): Remove.
[thirdparty/gcc.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 Free Software Foundation, Inc.
3 Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Run-time Target Specification. */
23 #undef TARGET_VERSION
24 #define TARGET_VERSION fputs (" (SH GNU/Linux with ELF)", stderr);
25
26 /* We're not SYSVR4, not having /usr/ccs */
27 #undef MD_EXEC_PREFIX
28 #undef MD_STARTFILE_PREFIX
29
30 /* This was defined in linux.h. Define it here also. */
31 #define HANDLE_PRAGMA_PACK_PUSH_POP
32
33 /* Don't assume anything about the header files. */
34 #define NO_IMPLICIT_EXTERN_C
35
36 /* The GNU C++ standard library requires that these macros be defined. */
37 #undef CPLUSPLUS_CPP_SPEC
38 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
39
40 /* Enable DWARF 2 exceptions. */
41 #undef DWARF2_UNWIND_INFO
42 #define DWARF2_UNWIND_INFO 1
43
44 #undef SUBTARGET_CPP_SPEC
45 #define SUBTARGET_CPP_SPEC "\
46 %{posix:-D_POSIX_SOURCE} \
47 %{pthread:-D_REENTRANT -D_PTHREADS} \
48 "
49
50 #define TARGET_OS_CPP_BUILTINS() \
51 do { \
52 builtin_define_std ("unix"); \
53 builtin_define ("__gnu_linux__"); \
54 builtin_define_std ("linux"); \
55 builtin_assert ("system=linux"); \
56 builtin_assert ("system=unix"); \
57 builtin_assert ("system=posix"); \
58 } while (0)
59
60 #undef TARGET_DEFAULT
61 #define TARGET_DEFAULT \
62 (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
63
64 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
65
66 #undef SUBTARGET_LINK_EMUL_SUFFIX
67 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
68 #undef SUBTARGET_LINK_SPEC
69 #define SUBTARGET_LINK_SPEC \
70 "%{shared:-shared} \
71 %{!static: \
72 %{rdynamic:-export-dynamic} \
73 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
74 %{static:-static}"
75
76 #undef LIB_SPEC
77 #define LIB_SPEC \
78 "%{pthread:-lpthread} \
79 %{shared: -lc} \
80 %{!static:-rpath-link %R/lib:%R/usr/lib} \
81 %{!shared: \
82 %{mieee-fp:-lieee} \
83 %{profile:-lc_p} %{!profile: -lc}}"
84
85 #if defined(HAVE_LD_EH_FRAME_HDR)
86 #undef LINK_EH_SPEC
87 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
88 #endif
89
90 #undef STARTFILE_SPEC
91 #if defined HAVE_LD_PIE
92 #define STARTFILE_SPEC \
93 "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
94 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
95 #else
96 #define STARTFILE_SPEC \
97 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
98 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
99 #endif
100
101 #undef ENDFILE_SPEC
102 #define ENDFILE_SPEC \
103 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
104
105 #define LINK_GCC_C_SEQUENCE_SPEC \
106 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
107
108 /* Use --as-needed -lgcc_s for eh support. */
109 #ifdef HAVE_LD_AS_NEEDED
110 #define USE_LD_AS_NEEDED 1
111 #endif
112
113 /* Output assembler code to STREAM to call the profiler. */
114
115 #undef FUNCTION_PROFILER
116 #define FUNCTION_PROFILER(STREAM,LABELNO) \
117 do { \
118 if (flag_pic) \
119 { \
120 fprintf (STREAM, "\tmov.l\t3f,r1\n"); \
121 fprintf (STREAM, "\tmova\t3f,r0\n"); \
122 fprintf (STREAM, "\tadd\tr1,r0\n"); \
123 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
124 fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n"); \
125 } \
126 else \
127 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
128 fprintf (STREAM, "\tsts.l\tpr,@-r15\n"); \
129 fprintf (STREAM, "\tmova\t2f,r0\n"); \
130 fprintf (STREAM, "\tjmp\t@r1\n"); \
131 fprintf (STREAM, "\tlds\tr0,pr\n"); \
132 fprintf (STREAM, "\t.align\t2\n"); \
133 if (flag_pic) \
134 { \
135 fprintf (STREAM, "1:\t.long\tmcount@GOT\n"); \
136 fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n"); \
137 } \
138 else \
139 fprintf (STREAM, "1:\t.long\tmcount\n"); \
140 fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n"); \
141 } while (0)
142
143 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
144
145 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
146 to a fake register number 16 as a placeholder for the return address
147 in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
148 _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
149 the register. So the entry of dwarf_reg_size_table corresponding to
150 this slot must be set. To do this, we redefine DBX_REGISTER_NUMBER
151 so as to return itself for 16. */
152 #undef DBX_REGISTER_NUMBER
153 #define DBX_REGISTER_NUMBER(REGNO) \
154 ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))