Fix change log
[official-gcc.git] / gcc / config / linux.h
blob7c0ca95db42e0f047ec71b11e45dbe4f296223bb
1 /* Definitions for Linux-based GNU systems with ELF format
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006,
3 2007, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Eric Youngdale.
5 Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org).
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful,
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.
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.
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
26 <http://www.gnu.org/licenses/>. */
28 /* Don't assume anything about the header files. */
29 #define NO_IMPLICIT_EXTERN_C
31 #undef ASM_APP_ON
32 #define ASM_APP_ON "#APP\n"
34 #undef ASM_APP_OFF
35 #define ASM_APP_OFF "#NO_APP\n"
37 #undef MD_EXEC_PREFIX
38 #undef MD_STARTFILE_PREFIX
40 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
41 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
42 provides part of the support for getting C++ file-scope static
43 object constructed before entering `main'. */
45 #if defined HAVE_LD_PIE
46 #define LINUX_TARGET_STARTFILE_SPEC \
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}"
49 #else
50 #define LINUX_TARGET_STARTFILE_SPEC \
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}"
53 #endif
54 #undef STARTFILE_SPEC
55 #define STARTFILE_SPEC LINUX_TARGET_STARTFILE_SPEC
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
59 provides part of the support for getting C++ file-scope static
60 object constructed before entering `main', followed by a normal
61 GNU/Linux "finalizer" file, `crtn.o'. */
63 #define LINUX_TARGET_ENDFILE_SPEC \
64 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
65 #undef ENDFILE_SPEC
66 #define ENDFILE_SPEC LINUX_TARGET_ENDFILE_SPEC
68 /* This is for -profile to use -lc_p instead of -lc. */
69 #define LINUX_TARGET_CC1_SPEC "%{profile:-p}"
70 #ifndef CC1_SPEC
71 #define CC1_SPEC LINUX_TARGET_CC1_SPEC
72 #endif
74 /* The GNU C++ standard library requires that these macros be defined. */
75 #undef CPLUSPLUS_CPP_SPEC
76 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
78 #define LINUX_TARGET_LIB_SPEC \
79 "%{pthread:-lpthread} \
80 %{shared:-lc} \
81 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
82 #undef LIB_SPEC
83 #define LIB_SPEC LINUX_TARGET_LIB_SPEC
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)
90 #define LINUX_TARGET_OS_CPP_BUILTINS() \
91 do { \
92 if (OPTION_GLIBC) \
93 builtin_define ("__gnu_linux__"); \
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)
101 #if defined(HAVE_LD_EH_FRAME_HDR)
102 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
103 #endif
105 /* Define this so we can compile MS code for use with WINE. */
106 #define HANDLE_PRAGMA_PACK_PUSH_POP
108 #undef LINK_GCC_C_SEQUENCE_SPEC
109 #define LINK_GCC_C_SEQUENCE_SPEC \
110 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
112 /* Use --as-needed -lgcc_s for eh support. */
113 #ifdef HAVE_LD_AS_NEEDED
114 #define USE_LD_AS_NEEDED 1
115 #endif
117 /* Determine which dynamic linker to use depending on whether GLIBC or
118 uClibc or Bionic is the default C library and whether
119 -muclibc or -mglibc or -mbionic has been passed to change the default. */
121 #define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
122 "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
124 #if DEFAULT_LIBC == LIBC_GLIBC
125 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
126 CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
127 #elif DEFAULT_LIBC == LIBC_UCLIBC
128 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
129 CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
130 #elif DEFAULT_LIBC == LIBC_BIONIC
131 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
132 CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
133 #else
134 #error "Unsupported DEFAULT_LIBC"
135 #endif /* DEFAULT_LIBC */
137 /* For most targets the following definitions suffice;
138 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
139 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
140 supporting both 32-bit and 64-bit compilation. */
141 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
142 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
143 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
144 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
145 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
146 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
148 #define LINUX_DYNAMIC_LINKER \
149 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
150 BIONIC_DYNAMIC_LINKER)
151 #define LINUX_DYNAMIC_LINKER32 \
152 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
153 BIONIC_DYNAMIC_LINKER32)
154 #define LINUX_DYNAMIC_LINKER64 \
155 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
156 BIONIC_DYNAMIC_LINKER64)
158 /* Determine whether the entire c99 runtime
159 is present in the runtime library. */
160 #define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
162 /* Whether we have sincos that follows the GNU extension. */
163 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
165 #define TARGET_POSIX_IO