PR target/52479
[official-gcc.git] / gcc / config / sh / netbsd-elf.h
blobf5a820b136347a3683e9aff71969324a78246e1a
1 /* Definitions for SH running NetBSD using ELF
2 Copyright (C) 2002, 2003, 2004, 2005, 2007, 2011
3 Free Software Foundation, Inc.
4 Contributed by Wasabi Systems, Inc.
6 This file is part of GCC.
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 3, or (at your option)
11 any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* Run-time Target Specification. */
24 /* Extra specs needed for NetBSD SuperH ELF targets. */
26 #undef SUBTARGET_EXTRA_SPECS
27 #define SUBTARGET_EXTRA_SPECS \
28 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
31 #define TARGET_OS_CPP_BUILTINS() \
32 do \
33 { \
34 NETBSD_OS_CPP_BUILTINS_ELF(); \
35 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
36 } \
37 while (0)
39 /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
40 We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate
41 SUBTARGET_LINK_SPEC that pulls in what we need from a generic
42 NetBSD ELF LINK_SPEC. */
44 /* LINK_EMUL_PREFIX from sh/elf.h */
46 #undef SUBTARGET_LINK_EMUL_SUFFIX
47 #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd"
49 #undef SUBTARGET_LINK_SPEC
50 #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF
52 #undef LINK_SPEC
53 #define LINK_SPEC SH_LINK_SPEC
55 #define NETBSD_ENTRY_POINT "__start"
57 /* Provide a CPP_SPEC appropriate for NetBSD. */
58 #undef SUBTARGET_CPP_SPEC
59 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
61 #undef TARGET_DEFAULT
62 #define TARGET_DEFAULT \
63 (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT)
65 /* Define because we use the label and we do not need them. */
66 #define NO_PROFILE_COUNTERS 1
68 #undef FUNCTION_PROFILER
69 #define FUNCTION_PROFILER(STREAM,LABELNO) \
70 do \
71 { \
72 if (TARGET_SHMEDIA32 || TARGET_SHMEDIA64) \
73 { \
74 /* FIXME */ \
75 sorry ("unimplemented-shmedia profiling"); \
76 } \
77 else \
78 { \
79 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \
80 LOCAL_LABEL_PREFIX, (LABELNO)); \
81 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \
82 LOCAL_LABEL_PREFIX, (LABELNO)); \
83 fprintf((STREAM), "\tjmp\t@r1\n"); \
84 fprintf((STREAM), "\tnop\n"); \
85 fprintf((STREAM), "\t.align\t2\n"); \
86 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \
87 LOCAL_LABEL_PREFIX, (LABELNO)); \
88 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \
89 } \
90 } \
91 while (0)
93 /* Since libgcc is compiled with -fpic for this target, we can't use
94 __sdivsi3_1 as the division strategy for -O0 and -Os. */
95 #undef SH_DIV_STRATEGY_DEFAULT
96 #define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
97 #undef SH_DIV_STR_FOR_SIZE
98 #define SH_DIV_STR_FOR_SIZE "call2"