]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sh/linux.h
linux.h (LIB_SPEC): Remove -rpath-link.
[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, 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 /* We're not SYSVR4, not having /usr/ccs */
28 #undef MD_EXEC_PREFIX
29 #undef MD_STARTFILE_PREFIX
30
31 /* This was defined in linux.h. Define it here also. */
32 #define HANDLE_PRAGMA_PACK_PUSH_POP
33
34 /* Don't assume anything about the header files. */
35 #define NO_IMPLICIT_EXTERN_C
36
37 /* The GNU C++ standard library requires that these macros be defined. */
38 #undef CPLUSPLUS_CPP_SPEC
39 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
40
41 /* Enable DWARF 2 exceptions. */
42 #undef DWARF2_UNWIND_INFO
43 #define DWARF2_UNWIND_INFO 1
44
45 #undef SUBTARGET_CPP_SPEC
46 #define SUBTARGET_CPP_SPEC "\
47 %{posix:-D_POSIX_SOURCE} \
48 %{pthread:-D_REENTRANT -D_PTHREADS} \
49 "
50
51 #define TARGET_OS_CPP_BUILTINS() \
52 do { \
53 builtin_define_std ("unix"); \
54 builtin_define ("__gnu_linux__"); \
55 builtin_define_std ("linux"); \
56 builtin_assert ("system=linux"); \
57 builtin_assert ("system=unix"); \
58 builtin_assert ("system=posix"); \
59 } while (0)
60
61 #undef TARGET_DEFAULT
62 #define TARGET_DEFAULT \
63 (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
64
65 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
66
67 #undef SUBTARGET_LINK_EMUL_SUFFIX
68 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
69 #undef SUBTARGET_LINK_SPEC
70 #define SUBTARGET_LINK_SPEC \
71 "%{shared:-shared} \
72 %{!static: \
73 %{rdynamic:-export-dynamic} \
74 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
75 %{static:-static}"
76
77 #undef LIB_SPEC
78 #define LIB_SPEC \
79 "%{pthread:-lpthread} \
80 %{shared: -lc} \
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 /* Determine whether the the entire c99 runtime
114 is present in the runtime library. */
115 #define TARGET_C99_FUNCTIONS 1
116
117 /* Output assembler code to STREAM to call the profiler. */
118
119 #undef FUNCTION_PROFILER
120 #define FUNCTION_PROFILER(STREAM,LABELNO) \
121 do { \
122 if (flag_pic) \
123 { \
124 fprintf (STREAM, "\tmov.l\t3f,r1\n"); \
125 fprintf (STREAM, "\tmova\t3f,r0\n"); \
126 fprintf (STREAM, "\tadd\tr1,r0\n"); \
127 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
128 fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n"); \
129 } \
130 else \
131 fprintf (STREAM, "\tmov.l\t1f,r1\n"); \
132 fprintf (STREAM, "\tsts.l\tpr,@-r15\n"); \
133 fprintf (STREAM, "\tmova\t2f,r0\n"); \
134 fprintf (STREAM, "\tjmp\t@r1\n"); \
135 fprintf (STREAM, "\tlds\tr0,pr\n"); \
136 fprintf (STREAM, "\t.align\t2\n"); \
137 if (flag_pic) \
138 { \
139 fprintf (STREAM, "1:\t.long\tmcount@GOT\n"); \
140 fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n"); \
141 } \
142 else \
143 fprintf (STREAM, "1:\t.long\tmcount\n"); \
144 fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n"); \
145 } while (0)
146
147 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
148
149 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
150 to a fake register number 16 as a placeholder for the return address
151 in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
152 _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
153 the register. So the entry of dwarf_reg_size_table corresponding to
154 this slot must be set. To do this, we redefine DBX_REGISTER_NUMBER
155 so as to return itself for 16. */
156 #undef DBX_REGISTER_NUMBER
157 #define DBX_REGISTER_NUMBER(REGNO) \
158 ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))