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