1 /* Target macros for arc*-*-linux targets. 2 3 Copyright (C) 2017-2020 Free Software Foundation, Inc. 4 5 This file is part of GCC. 6 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 3, or (at your option) 10 any later version. 11 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. 16 17 You should have received a copy of the GNU General Public License 18 along with GCC; see the file COPYING3. If not see 19 <http://www.gnu.org/licenses/>. */ 20 21 /* Enable DWARF 2 exceptions. */ 22 #undef DWARF2_UNWIND_INFO 23 #define DWARF2_UNWIND_INFO 1 24 25 #define TARGET_OS_CPP_BUILTINS() \ 26 do \ 27 { \ 28 GNU_USER_TARGET_OS_CPP_BUILTINS (); \ 29 } \ 30 while (0) 31 32 #define GLIBC_DYNAMIC_LINKER \ 33 "/lib/ld-linux-arc%{mbig-endian:eb}%{mcpu=arc700:700}.so.2" 34 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" 35 36 /* Note that the default is to link against dynamic libraries, if they are 37 available. Override with -static. */ 38 #undef LINK_SPEC 39 #define LINK_SPEC "%{h*} \ 40 %{static:-Bstatic} \ 41 %{shared:-shared} \ 42 %{symbolic:-Bsymbolic} \ 43 %{!static: \ 44 %{rdynamic:-export-dynamic} \ 45 %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ 46 -X \ 47 %{mbig-endian:-EB} %{EB} %{EL} \ 48 %{!z:-z max-page-size=0x2000 -z common-page-size=0x2000} \ 49 %{mcpu=nps400:-marclinux_nps; :-marclinux}" 50 51 #undef STARTFILE_SPEC 52 #define STARTFILE_SPEC \ 53 LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) 54 55 #undef ENDFILE_SPEC 56 #define ENDFILE_SPEC \ 57 LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) 58 59 #undef LIB_SPEC 60 #define LIB_SPEC \ 61 "%{pthread:-lpthread} \ 62 %{shared:-lc} \ 63 %{!shared:%{profile:-lc_p}%{!profile:-lc}}" 64 65 #undef TARGET_ASM_FILE_END 66 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack 67 68 /* No SDATA default for linux. */ 69 #undef TARGET_SDATA_DEFAULT 70 #define TARGET_SDATA_DEFAULT 0 71 72 /* We have medium calls. */ 73 #undef TARGET_MMEDIUM_CALLS_DEFAULT 74 #define TARGET_MMEDIUM_CALLS_DEFAULT 1 75 76 /* We do not have any MULTILIB_OPTIONS specified, so there are no 77 MULTILIB_DEFAULTS. */ 78 #undef MULTILIB_DEFAULTS 79 80 /* Linux toolchains use r25 as the thread pointer register. */ 81 #undef TARGET_ARC_TP_REGNO_DEFAULT 82 #define TARGET_ARC_TP_REGNO_DEFAULT 25 83 84 #undef SUBTARGET_CPP_SPEC 85 #define SUBTARGET_CPP_SPEC "\ 86 %{pthread:-D_REENTRANT} \ 87 " 88 89 /* Indexed loads are default off. */ 90 #undef TARGET_INDEXED_LOADS_DEFAULT 91 #define TARGET_INDEXED_LOADS_DEFAULT 0 92 93 /* Pre/post modify with register displacement are default off. */ 94 #undef TARGET_AUTO_MODIFY_REG_DEFAULT 95 #define TARGET_AUTO_MODIFY_REG_DEFAULT 0 96 97 #if DEFAULT_LIBC == LIBC_GLIBC 98 /* Override linux.h LINK_EH_SPEC definition. 99 Signalize that because we have fde-glibc, we don't need all C shared libs 100 linked against -lgcc_s. */ 101 #undef LINK_EH_SPEC 102 #define LINK_EH_SPEC "--eh-frame-hdr " 103 #endif 104 105 #undef SUBTARGET_CPP_SPEC 106 #define SUBTARGET_CPP_SPEC "\ 107 %{pthread:-D_REENTRANT} \ 108 " 109 110 /* Build attribute: procedure call standard. */ 111 #undef ATTRIBUTE_PCS 112 #define ATTRIBUTE_PCS 3 113 114 /* Clear the instruction cache from `beg' to `end'. This makes an 115 inline system call to SYS_cacheflush. */ 116 #undef CLEAR_INSN_CACHE 117 #define CLEAR_INSN_CACHE(beg, end) \ 118 { \ 119 register unsigned long _beg __asm ("r0") = (unsigned long) (beg); \ 120 register unsigned long _end __asm ("r1") = (unsigned long) (end); \ 121 register unsigned long _xtr __asm ("r2") = 0; \ 122 register unsigned long _scno __asm ("r8") = 244; \ 123 __asm __volatile ("trap_s 0 ; sys_cache_sync" \ 124 : "=r" (_beg) \ 125 : "0" (_beg), "r" (_end), "r" (_xtr), "r" (_scno)); \ 126 } 127 128 /* Emit rtl for profiling. Output assembler code to FILE 129 to call "_mcount" for profiling a function entry. */ 130 #define PROFILE_HOOK(LABEL) \ 131 { \ 132 rtx fun, rt; \ 133 rt = get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM); \ 134 fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); \ 135 emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode); \ 136 } 137 138 /* Enter/Leave ops are default off for linux targets. */ 139 #undef TARGET_CODE_DENSITY_FRAME_DEFAULT 140 #define TARGET_CODE_DENSITY_FRAME_DEFAULT 0 141