]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions for Linux-based GNU systems with ELF format |
2f83c7d6 | 2 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006, |
74c70253 | 3 | 2007, 2009, 2010 Free Software Foundation, Inc. |
9e2fc7c0 | 4 | Contributed by Eric Youngdale. |
e5e809f4 | 5 | Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). |
9e2fc7c0 | 6 | |
2a71dcad | 7 | This file is part of GCC. |
9e2fc7c0 | 8 | |
2a71dcad | 9 | GCC is free software; you can redistribute it and/or modify |
9e2fc7c0 | 10 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 11 | the Free Software Foundation; either version 3, or (at your option) |
9e2fc7c0 RK |
12 | any later version. |
13 | ||
2a71dcad | 14 | GCC is distributed in the hope that it will be useful, |
9e2fc7c0 RK |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
748086b7 JJ |
19 | Under Section 7 of GPL version 3, you are granted additional |
20 | permissions described in the GCC Runtime Library Exception, version | |
21 | 3.1, as published by the Free Software Foundation. | |
22 | ||
23 | You should have received a copy of the GNU General Public License and | |
24 | a copy of the GCC Runtime Library Exception along with this program; | |
25 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
2f83c7d6 | 26 | <http://www.gnu.org/licenses/>. */ |
9e2fc7c0 | 27 | |
991b6592 | 28 | /* Don't assume anything about the header files. */ |
9e2fc7c0 RK |
29 | #define NO_IMPLICIT_EXTERN_C |
30 | ||
9e2fc7c0 RK |
31 | #undef ASM_APP_ON |
32 | #define ASM_APP_ON "#APP\n" | |
33 | ||
34 | #undef ASM_APP_OFF | |
35 | #define ASM_APP_OFF "#NO_APP\n" | |
36 | ||
9e2fc7c0 RK |
37 | #undef MD_EXEC_PREFIX |
38 | #undef MD_STARTFILE_PREFIX | |
39 | ||
956d6950 JL |
40 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add |
41 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | |
9e2fc7c0 | 42 | provides part of the support for getting C++ file-scope static |
991b6592 | 43 | object constructed before entering `main'. */ |
9e2fc7c0 | 44 | |
0a2b72a6 | 45 | #if defined HAVE_LD_PIE |
51b9db92 | 46 | #define LINUX_TARGET_STARTFILE_SPEC \ |
24a4dd31 JJ |
47 | "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ |
48 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" | |
275b60d6 | 49 | #else |
51b9db92 | 50 | #define LINUX_TARGET_STARTFILE_SPEC \ |
24a4dd31 JJ |
51 | "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ |
52 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" | |
275b60d6 | 53 | #endif |
51b9db92 MK |
54 | #undef STARTFILE_SPEC |
55 | #define STARTFILE_SPEC LINUX_TARGET_STARTFILE_SPEC | |
9e2fc7c0 | 56 | |
956d6950 JL |
57 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
58 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | |
9e2fc7c0 RK |
59 | provides part of the support for getting C++ file-scope static |
60 | object constructed before entering `main', followed by a normal | |
956d6950 | 61 | GNU/Linux "finalizer" file, `crtn.o'. */ |
9e2fc7c0 | 62 | |
51b9db92 | 63 | #define LINUX_TARGET_ENDFILE_SPEC \ |
24a4dd31 | 64 | "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" |
51b9db92 MK |
65 | #undef ENDFILE_SPEC |
66 | #define ENDFILE_SPEC LINUX_TARGET_ENDFILE_SPEC | |
12e2fea9 | 67 | |
991b6592 | 68 | /* This is for -profile to use -lc_p instead of -lc. */ |
51b9db92 | 69 | #define LINUX_TARGET_CC1_SPEC "%{profile:-p}" |
bba17b29 | 70 | #ifndef CC1_SPEC |
51b9db92 | 71 | #define CC1_SPEC LINUX_TARGET_CC1_SPEC |
bba17b29 L |
72 | #endif |
73 | ||
281e78ae | 74 | /* The GNU C++ standard library requires that these macros be defined. */ |
37344b9b | 75 | #undef CPLUSPLUS_CPP_SPEC |
281e78ae | 76 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" |
37344b9b | 77 | |
51b9db92 | 78 | #define LINUX_TARGET_LIB_SPEC \ |
17772b2a JJ |
79 | "%{pthread:-lpthread} \ |
80 | %{shared:-lc} \ | |
81 | %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" | |
51b9db92 MK |
82 | #undef LIB_SPEC |
83 | #define LIB_SPEC LINUX_TARGET_LIB_SPEC | |
f0ce07b8 | 84 | |
74c70253 MK |
85 | /* C libraries supported on Linux. */ |
86 | #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) | |
87 | #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) | |
88 | #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) | |
89 | ||
26b0ad13 KG |
90 | #define LINUX_TARGET_OS_CPP_BUILTINS() \ |
91 | do { \ | |
74c70253 MK |
92 | if (OPTION_GLIBC) \ |
93 | builtin_define ("__gnu_linux__"); \ | |
26b0ad13 KG |
94 | builtin_define_std ("linux"); \ |
95 | builtin_define_std ("unix"); \ | |
96 | builtin_assert ("system=linux"); \ | |
97 | builtin_assert ("system=unix"); \ | |
98 | builtin_assert ("system=posix"); \ | |
99 | } while (0) | |
100 | ||
0a2b72a6 | 101 | #if defined(HAVE_LD_EH_FRAME_HDR) |
275b60d6 JJ |
102 | #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " |
103 | #endif | |
104 | ||
344189f9 | 105 | #undef LINK_GCC_C_SEQUENCE_SPEC |
42df2193 JJ |
106 | #define LINK_GCC_C_SEQUENCE_SPEC \ |
107 | "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" | |
272f51a3 | 108 | |
8efcd34f AM |
109 | /* Use --as-needed -lgcc_s for eh support. */ |
110 | #ifdef HAVE_LD_AS_NEEDED | |
111 | #define USE_LD_AS_NEEDED 1 | |
112 | #endif | |
113 | ||
464aea98 | 114 | /* Determine which dynamic linker to use depending on whether GLIBC or |
74c70253 MK |
115 | uClibc or Bionic is the default C library and whether |
116 | -muclibc or -mglibc or -mbionic has been passed to change the default. */ | |
117 | ||
118 | #define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ | |
119 | "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" | |
120 | ||
121 | #if DEFAULT_LIBC == LIBC_GLIBC | |
122 | #define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | |
123 | CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) | |
124 | #elif DEFAULT_LIBC == LIBC_UCLIBC | |
125 | #define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | |
126 | CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) | |
127 | #elif DEFAULT_LIBC == LIBC_BIONIC | |
128 | #define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | |
129 | CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) | |
464aea98 | 130 | #else |
74c70253 MK |
131 | #error "Unsupported DEFAULT_LIBC" |
132 | #endif /* DEFAULT_LIBC */ | |
464aea98 | 133 | |
7bd85ce0 JM |
134 | /* For most targets the following definitions suffice; |
135 | GLIBC_DYNAMIC_LINKER must be defined for each target using them, or | |
136 | GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets | |
137 | supporting both 32-bit and 64-bit compilation. */ | |
464aea98 | 138 | #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" |
7bd85ce0 JM |
139 | #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" |
140 | #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" | |
74c70253 MK |
141 | #define BIONIC_DYNAMIC_LINKER "/system/bin/linker" |
142 | #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" | |
143 | #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" | |
144 | ||
145 | #define LINUX_DYNAMIC_LINKER \ | |
146 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ | |
147 | BIONIC_DYNAMIC_LINKER) | |
148 | #define LINUX_DYNAMIC_LINKER32 \ | |
149 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ | |
150 | BIONIC_DYNAMIC_LINKER32) | |
151 | #define LINUX_DYNAMIC_LINKER64 \ | |
152 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ | |
153 | BIONIC_DYNAMIC_LINKER64) | |
464aea98 | 154 | |
a4d05547 | 155 | /* Determine whether the entire c99 runtime |
272f51a3 | 156 | is present in the runtime library. */ |
7bd85ce0 | 157 | #define TARGET_C99_FUNCTIONS (OPTION_GLIBC) |
90b8be73 | 158 | |
006339cd | 159 | /* Whether we have sincos that follows the GNU extension. */ |
a95054c1 | 160 | #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC) |
006339cd | 161 | |
4969c0d8 | 162 | #define TARGET_POSIX_IO |