1 /* Definitions for systems using the Linux kernel, with or without
2 MMU, using ELF at the compiler level but possibly FLT for final
3 linked executables and shared libraries in some no-MMU cases, and
4 possibly with a choice of libc implementations.
5 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006,
6 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
7 Contributed by Eric Youngdale.
8 Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org).
10 This file is part of GCC.
12 GCC is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3, or (at your option)
17 GCC is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 Under Section 7 of GPL version 3, you are granted additional
23 permissions described in the GCC Runtime Library Exception, version
24 3.1, as published by the Free Software Foundation.
26 You should have received a copy of the GNU General Public License and
27 a copy of the GCC Runtime Library Exception along with this program;
28 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
29 <http://www.gnu.org/licenses/>. */
31 /* C libraries supported on Linux. */
33 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
34 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
35 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
37 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
38 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
39 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
42 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
45 builtin_define ("__gnu_linux__"); \
46 builtin_define_std ("linux"); \
47 builtin_define_std ("unix"); \
48 builtin_assert ("system=linux"); \
49 builtin_assert ("system=unix"); \
50 builtin_assert ("system=posix"); \
53 /* Determine which dynamic linker to use depending on whether GLIBC or
54 uClibc or Bionic is the default C library and whether
55 -muclibc or -mglibc or -mbionic has been passed to change the default. */
57 #define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
58 "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
60 #if DEFAULT_LIBC == LIBC_GLIBC
61 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
62 CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
63 #elif DEFAULT_LIBC == LIBC_UCLIBC
64 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
65 CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
66 #elif DEFAULT_LIBC == LIBC_BIONIC
67 #define CHOOSE_DYNAMIC_LINKER(G, U, B) \
68 CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
70 #error "Unsupported DEFAULT_LIBC"
71 #endif /* DEFAULT_LIBC */
73 /* For most targets the following definitions suffice;
74 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
75 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
76 supporting both 32-bit and 64-bit compilation. */
77 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
78 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
79 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
80 #define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
81 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
82 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
83 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
84 #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
86 #define GNU_USER_DYNAMIC_LINKER \
87 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
88 BIONIC_DYNAMIC_LINKER)
89 #define GNU_USER_DYNAMIC_LINKER32 \
90 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
91 BIONIC_DYNAMIC_LINKER32)
92 #define GNU_USER_DYNAMIC_LINKER64 \
93 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
94 BIONIC_DYNAMIC_LINKER64)
95 #define GNU_USER_DYNAMIC_LINKERX32 \
96 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
97 BIONIC_DYNAMIC_LINKERX32)
99 /* Determine whether the entire c99 runtime
100 is present in the runtime library. */
101 #undef TARGET_C99_FUNCTIONS
102 #define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
104 /* Whether we have sincos that follows the GNU extension. */
105 #undef TARGET_HAS_SINCOS
106 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)