1 /* Definitions for ARM running Linux-based GNU systems using ELF
2    Copyright (C) 1993-2018 Free Software Foundation, Inc.
3    Contributed by Philip Blundell <philb@gnu.org>
4 
5    This file is part of GCC.
6 
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3, or (at your
10    option) any later version.
11 
12    GCC is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16 
17    Under Section 7 of GPL version 3, you are granted additional
18    permissions described in the GCC Runtime Library Exception, version
19    3.1, as published by the Free Software Foundation.
20 
21    You should have received a copy of the GNU General Public License and
22    a copy of the GCC Runtime Library Exception along with this program;
23    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24    <http://www.gnu.org/licenses/>.  */
25 
26 /* elfos.h should have already been included.  Now just override
27    any conflicting definitions and add any extras.  */
28 
29 /* Run-time Target Specification.  */
30 #undef  TARGET_DEFAULT_FLOAT_ABI
31 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
32 
33 /* TARGET_BIG_ENDIAN_DEFAULT is set in
34    config.gcc for big endian configurations.  */
35 #if TARGET_BIG_ENDIAN_DEFAULT
36 #define TARGET_ENDIAN_DEFAULT    MASK_BIG_END
37 #define TARGET_ENDIAN_OPTION     "mbig-endian"
38 #define TARGET_LINKER_EMULATION  "armelfb_linux"
39 #else
40 #define TARGET_ENDIAN_DEFAULT    0
41 #define TARGET_ENDIAN_OPTION     "mlittle-endian"
42 #define TARGET_LINKER_EMULATION  "armelf_linux"
43 #endif
44 
45 #undef  TARGET_DEFAULT
46 #define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
47 
48 #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
49 
50 /* We do not have any MULTILIB_OPTIONS specified, so there are no
51    MULTILIB_DEFAULTS.  */
52 #undef  MULTILIB_DEFAULTS
53 
54 /* Now we define the strings used to build the spec file.  */
55 #undef  LIB_SPEC
56 #define LIB_SPEC \
57   "%{pthread:-lpthread} \
58    %{shared:-lc} \
59    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
60 
61 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
62 
63 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
64 
65 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
66    %{static:-Bstatic} \
67    %{shared:-shared} \
68    %{symbolic:-Bsymbolic} \
69    %{!static: \
70      %{rdynamic:-export-dynamic} \
71      %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
72    -X \
73    %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
74    SUBTARGET_EXTRA_LINK_SPEC
75 
76 #undef  LINK_SPEC
77 #define LINK_SPEC LINUX_TARGET_LINK_SPEC
78 
79 #define TARGET_OS_CPP_BUILTINS()		\
80   do						\
81     {						\
82 	GNU_USER_TARGET_OS_CPP_BUILTINS();	\
83     }						\
84   while (0)
85 
86 /* Call the function profiler with a given profile label.  */
87 #undef  ARM_FUNCTION_PROFILER
88 #define ARM_FUNCTION_PROFILER(STREAM, LABELNO)  			\
89 {									\
90   fprintf (STREAM, "\tbl\tmcount%s\n",					\
91 	   (TARGET_ARM && NEED_PLT_RELOC) ? "(PLT)" : "");		\
92 }
93 
94 /* The GNU/Linux profiler clobbers the link register.  Make sure the
95    prologue knows to save it.  */
96 #define PROFILE_HOOK(X)						\
97   emit_clobber (gen_rtx_REG (SImode, LR_REGNUM))
98 
99 /* The GNU/Linux profiler needs a frame pointer.  */
100 #define SUBTARGET_FRAME_POINTER_REQUIRED crtl->profile
101 
102 /* Add .note.GNU-stack.  */
103 #undef NEED_INDICATE_EXEC_STACK
104 #define NEED_INDICATE_EXEC_STACK	1
105 
106 /* Uninitialized common symbols in non-PIE executables, even with
107    strong definitions in dependent shared libraries, will resolve
108    to COPY relocated symbol in the executable.  See PR65780.  */
109 #undef TARGET_BINDS_LOCAL_P
110 #define TARGET_BINDS_LOCAL_P default_binds_local_p_2
111 
112 /* Define this to be nonzero if static stack checking is supported.  */
113 #define STACK_CHECK_STATIC_BUILTIN 1
114