]>
Commit | Line | Data |
---|---|---|
b4eb03fe | 1 | /* Definitions for SH running NetBSD using ELF |
83ffe9cd | 2 | Copyright (C) 2002-2023 Free Software Foundation, Inc. |
b4eb03fe JT |
3 | Contributed by Wasabi Systems, Inc. |
4 | ||
7ec022b2 | 5 | This file is part of GCC. |
b4eb03fe | 6 | |
7ec022b2 | 7 | GCC is free software; you can redistribute it and/or modify |
b4eb03fe | 8 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 9 | the Free Software Foundation; either version 3, or (at your option) |
b4eb03fe JT |
10 | any later version. |
11 | ||
7ec022b2 | 12 | GCC is distributed in the hope that it will be useful, |
b4eb03fe JT |
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 | |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
b4eb03fe JT |
20 | |
21 | /* Run-time Target Specification. */ | |
b655555e | 22 | |
79bc889e JT |
23 | /* Extra specs needed for NetBSD SuperH ELF targets. */ |
24 | ||
25 | #undef SUBTARGET_EXTRA_SPECS | |
26 | #define SUBTARGET_EXTRA_SPECS \ | |
27 | { "netbsd_entry_point", NETBSD_ENTRY_POINT }, | |
28 | ||
29 | ||
b4eb03fe JT |
30 | #define TARGET_OS_CPP_BUILTINS() \ |
31 | do \ | |
32 | { \ | |
33 | NETBSD_OS_CPP_BUILTINS_ELF(); \ | |
34 | builtin_define ("__NO_LEADING_UNDERSCORES__"); \ | |
35 | } \ | |
36 | while (0) | |
37 | ||
38 | /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target. | |
b655555e JT |
39 | We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate |
40 | SUBTARGET_LINK_SPEC that pulls in what we need from a generic | |
41 | NetBSD ELF LINK_SPEC. */ | |
b4eb03fe | 42 | |
b655555e | 43 | /* LINK_EMUL_PREFIX from sh/elf.h */ |
b655555e JT |
44 | #undef SUBTARGET_LINK_EMUL_SUFFIX |
45 | #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd" | |
46 | ||
47 | #undef SUBTARGET_LINK_SPEC | |
79bc889e | 48 | #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF |
b4eb03fe | 49 | |
b655555e JT |
50 | #undef LINK_SPEC |
51 | #define LINK_SPEC SH_LINK_SPEC | |
52 | ||
79bc889e | 53 | #define NETBSD_ENTRY_POINT "__start" |
b4eb03fe JT |
54 | |
55 | /* Provide a CPP_SPEC appropriate for NetBSD. */ | |
56 | #undef SUBTARGET_CPP_SPEC | |
57 | #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC | |
58 | ||
b4eb03fe JT |
59 | #undef TARGET_DEFAULT |
60 | #define TARGET_DEFAULT \ | |
ee0d2b68 | 61 | (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT) |
b4eb03fe | 62 | |
24746a42 | 63 | /* Define because we use the label and we do not need them. */ |
da28a3b9 | 64 | #define NO_PROFILE_COUNTERS 1 |
b4eb03fe JT |
65 | |
66 | #undef FUNCTION_PROFILER | |
67 | #define FUNCTION_PROFILER(STREAM,LABELNO) \ | |
68 | do \ | |
69 | { \ | |
e0c32c62 | 70 | fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \ |
b655555e | 71 | LOCAL_LABEL_PREFIX, (LABELNO)); \ |
e0c32c62 | 72 | fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \ |
b655555e JT |
73 | LOCAL_LABEL_PREFIX, (LABELNO)); \ |
74 | fprintf((STREAM), "\tjmp\t@r1\n"); \ | |
75 | fprintf((STREAM), "\tnop\n"); \ | |
76 | fprintf((STREAM), "\t.align\t2\n"); \ | |
e0c32c62 | 77 | fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \ |
b655555e | 78 | LOCAL_LABEL_PREFIX, (LABELNO)); \ |
e0c32c62 | 79 | fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \ |
b4eb03fe JT |
80 | } \ |
81 | while (0) | |
73a4d10b | 82 | |
ee0d2b68 KK |
83 | #undef SUBTARGET_OVERRIDE_OPTIONS |
84 | #define SUBTARGET_OVERRIDE_OPTIONS \ | |
85 | do \ | |
86 | { \ | |
87 | /* Set -musermode if it hasn't been specified. */ \ | |
00f34291 | 88 | if (OPTION_SET_P (TARGET_USERMODE) == 0) \ |
ee0d2b68 KK |
89 | TARGET_USERMODE = true; \ |
90 | } \ | |
91 | while (0) |