| 1 | /* Configuration file for Linux Android targets. |
| 2 | Copyright (C) 2008-2025 Free Software Foundation, Inc. |
| 3 | Contributed by Doug Kwan (dougkwan@google.com) |
| 4 | Rewritten by CodeSourcery, Inc. |
| 5 | |
| 6 | This file is part of GCC. |
| 7 | |
| 8 | GCC is free software; you can redistribute it and/or modify it |
| 9 | under the terms of the GNU General Public License as published |
| 10 | by the Free Software Foundation; either version 3, or (at your |
| 11 | option) any later version. |
| 12 | |
| 13 | GCC is distributed in the hope that it will be useful, but WITHOUT |
| 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 16 | License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with GCC; see the file COPYING3. If not see |
| 20 | <http://www.gnu.org/licenses/>. */ |
| 21 | |
| 22 | #define ANDROID_TARGET_OS_CPP_BUILTINS() \ |
| 23 | do { \ |
| 24 | if (TARGET_ANDROID) \ |
| 25 | builtin_define ("__ANDROID__"); \ |
| 26 | } while (0) |
| 27 | |
| 28 | #if ANDROID_DEFAULT |
| 29 | # define NOANDROID "mno-android" |
| 30 | #else |
| 31 | # define NOANDROID "!mandroid" |
| 32 | #endif |
| 33 | |
| 34 | #define LINUX_OR_ANDROID_CC(LINUX_SPEC, ANDROID_SPEC) \ |
| 35 | "%{" NOANDROID "|tno-android-cc:" LINUX_SPEC ";:" ANDROID_SPEC "}" |
| 36 | |
| 37 | #define LINUX_OR_ANDROID_LD(LINUX_SPEC, ANDROID_SPEC) \ |
| 38 | "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" |
| 39 | |
| 40 | #define ANDROID_LINK_SPEC \ |
| 41 | "%{shared: -Bsymbolic}" |
| 42 | |
| 43 | #define ANDROID_CC1_SPEC \ |
| 44 | "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ |
| 45 | "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" |
| 46 | |
| 47 | #define ANDROID_CC1PLUS_SPEC \ |
| 48 | "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ |
| 49 | "%{!frtti:%{!fno-rtti: -fno-rtti}}" |
| 50 | |
| 51 | #define ANDROID_LIB_SPEC \ |
| 52 | "%{!static: -ldl}" |
| 53 | |
| 54 | #define ANDROID_STARTFILE_SPEC \ |
| 55 | "%{shared: crtbegin_so%O%s;:" \ |
| 56 | " %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}" |
| 57 | |
| 58 | #define ANDROID_ENDFILE_SPEC \ |
| 59 | "%{shared: crtend_so%O%s;: crtend_android%O%s}" |
| 60 | |