1 /* Definitions of target machine for gcc for Super-H using sh-superh-elf. 2 Copyright (C) 2001-2020 Free Software Foundation, Inc. 3 4 This file is part of GNU CC. 5 6 GNU CC is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 GNU CC is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GCC; see the file COPYING3. If not see 18 <http://www.gnu.org/licenses/>. */ 19 20 21 /* This header file is used when the vendor name is set to 'superh'. 22 config.gcc already configured the compiler for SH4 only and switched 23 the default endianness to little (although big endian is still available). 24 This file configures the spec file to the default board configuration 25 but in such a way that it can be overridden by a boardspecs file 26 (using the -specs= option). This file is expected to disable the 27 defaults and provide options --defsym _start and --defsym _stack 28 which are required by the SuperH configuration of GNU ld. 29 30 This file is intended to override sh.h. */ 31 32 #ifndef _SUPERH_H 33 #define _SUPERH_H 34 #endif 35 36 37 /* Override the linker spec strings to use the new emulation 38 The specstrings are concatenated as follows 39 LINK_EMUL_PREFIX.(''|'32'|'64'|LINK_DEFAULT_CPU_EMUL).SUBTARGET_LINK_EMUL_SUFFIX 40 */ 41 #undef LINK_EMUL_PREFIX 42 #undef SUBTARGET_LINK_EMUL_SUFFIX 43 44 #define LINK_EMUL_PREFIX "superh" 45 #define SUBTARGET_LINK_EMUL_SUFFIX "" 46 47 /* Add the SUBTARGET_LINK_SPEC to add the board and runtime support and 48 change the endianness */ 49 #undef SUBTARGET_LINK_SPEC 50 #if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN 51 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml|!mb:-EL}%{mb:-EB}" 52 #else 53 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml:-EL}%{mb|!ml:-EB}" 54 #endif 55 56 57 /* This is used by the link spec if the boardspecs file is not used 58 (for whatever reason). 59 If the boardspecs file overrides this then an alternative can be used. */ 60 #undef SUBTARGET_EXTRA_SPECS 61 #define SUBTARGET_EXTRA_SPECS \ 62 { "board_link", "--defsym _start=0x1000 --defsym _stack=0x30000" }, \ 63 { "asruntime", "" }, \ 64 { "cppruntime", "-D__GDB_SIM__" }, \ 65 { "cc1runtime", "" }, \ 66 { "ldruntime", "" }, \ 67 { "libruntime", "-lc -lgloss" } 68 69 70 /* Set the SUBTARGET_CPP_SPEC to define __EMBEDDED_CROSS__ which has an effect 71 on newlib and provide the runtime support */ 72 #undef SUBTARGET_CPP_SPEC 73 #define SUBTARGET_CPP_SPEC \ 74 "-D__EMBEDDED_CROSS__ %{m4-100*:-D__SH4_100__} %{m4-200*:-D__SH4_200__} %{m4-300*:-D__SH4_300__} %{m4-340:-D__SH4_340__} %{m4-400:-D__SH4_400__} %{m4-500:-D__SH4_500__} \ 75 %(cppruntime)" 76 77 /* Override the SUBTARGET_ASM_SPEC to add the runtime support */ 78 #undef SUBTARGET_ASM_SPEC 79 #define SUBTARGET_ASM_SPEC "%{m4-100*|m4-200*:-isa=sh4} %{m4-400|m4-340:-isa=sh4-nommu-nofpu} %{m4-500:-isa=sh4-nofpu} %(asruntime)" 80 81 /* Override the SUBTARGET_ASM_RELAX_SPEC so it doesn't interfere with the 82 runtime support by adding -isa=sh4 in the wrong place. */ 83 #undef SUBTARGET_ASM_RELAX_SPEC 84 #define SUBTARGET_ASM_RELAX_SPEC "%{!m4-100*:%{!m4-200*:%{!m4-300*:%{!m4-340:%{!m4-400:%{!m4-500:-isa=sh4}}}}}}" 85 86 /* Create the CC1_SPEC to add the runtime support */ 87 #undef CC1_SPEC 88 #define CC1_SPEC "%(cc1runtime)" 89 90 #undef CC1PLUS_SPEC 91 #define CC1PLUS_SPEC "%(cc1runtime)" 92 93 94 /* Override the LIB_SPEC to add the runtime support */ 95 #undef LIB_SPEC 96 #define LIB_SPEC "%{!shared:%{!symbolic:%(libruntime) -lc}} %{pg:-lprofile -lc}" 97 98 /* Override STARTFILE_SPEC to add profiling and MMU support. */ 99 #undef STARTFILE_SPEC 100 #define STARTFILE_SPEC \ 101 "%{!shared: %{!m4-400*:%{!m4-340*: %{pg:gcrt1-mmu.o%s}%{!pg:crt1-mmu.o%s}}}} \ 102 %{!shared: %{m4-340*|m4-400*: %{pg:gcrt1.o%s}%{!pg:crt1.o%s}}} \ 103 crti.o%s \ 104 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 105