]>
git.ipfire.org Git - thirdparty/gcc.git/blob - 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>
5 This file is part of GCC.
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)
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.
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. */
22 /* Run-time Target Specification. */
24 #define TARGET_VERSION fputs (" (SH GNU/Linux with ELF)", stderr);
26 /* We're not SYSVR4, not having /usr/ccs */
28 #undef MD_STARTFILE_PREFIX
30 /* This was defined in linux.h. Define it here also. */
31 #define HANDLE_PRAGMA_PACK_PUSH_POP
33 /* Don't assume anything about the header files. */
34 #define NO_IMPLICIT_EXTERN_C
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)"
40 /* Enable DWARF 2 exceptions. */
41 #undef DWARF2_UNWIND_INFO
42 #define DWARF2_UNWIND_INFO 1
44 #undef SUBTARGET_CPP_SPEC
45 #define SUBTARGET_CPP_SPEC "\
46 %{posix:-D_POSIX_SOURCE} \
47 %{pthread:-D_REENTRANT -D_PTHREADS} \
50 #define TARGET_OS_CPP_BUILTINS() \
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"); \
61 #define TARGET_DEFAULT \
62 (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
64 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
66 #undef SUBTARGET_LINK_EMUL_SUFFIX
67 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
68 #undef SUBTARGET_LINK_SPEC
69 #define SUBTARGET_LINK_SPEC \
72 %{rdynamic:-export-dynamic} \
73 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
78 "%{pthread:-lpthread} \
80 %{!static:-rpath-link %R/lib:%R/usr/lib} \
83 %{profile:-lc_p} %{!profile: -lc}}"
85 #if defined(HAVE_LD_EH_FRAME_HDR)
87 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
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}"
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}"
102 #define ENDFILE_SPEC \
103 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
105 #define LINK_GCC_C_SEQUENCE_SPEC \
106 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
108 /* Use --as-needed -lgcc_s for eh support. */
109 #ifdef HAVE_LD_AS_NEEDED
110 #define USE_LD_AS_NEEDED 1
113 /* Output assembler code to STREAM to call the profiler. */
115 #undef FUNCTION_PROFILER
116 #define FUNCTION_PROFILER(STREAM,LABELNO) \
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"); \
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"); \
135 fprintf (STREAM, "1:\t.long\tmcount@GOT\n"); \
136 fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n"); \
139 fprintf (STREAM, "1:\t.long\tmcount\n"); \
140 fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n"); \
143 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
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))