1 /* Configuration file for ARM GNU/Linux FDPIC EABI targets. 2 Copyright (C) 2018-2021 Free Software Foundation, Inc. 3 Contributed by STMicroelectronics. 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 You should have received a copy of the GNU General Public License 18 along with GCC; see the file COPYING3. If not see 19 <http://www.gnu.org/licenses/>. */ 20 21 /* On uClibc EABI GNU/Linux, we want to force -mfdpic by default, 22 which also means we produce PIE code by default. */ 23 #undef FDPIC_CC1_SPEC 24 #define FDPIC_CC1_SPEC \ 25 "%{!mno-fdpic:-mfdpic %{!fno-PIE:%{!fpie:%{!fPIC:%{!fpic: -fPIE}}}}}" 26 27 /* Add --fdpic assembler flag by default. */ 28 #undef TARGET_FDPIC_ASM_SPEC 29 #define TARGET_FDPIC_ASM_SPEC "%{!mno-fdpic: --fdpic}" 30 31 /* TARGET_BIG_ENDIAN_DEFAULT is set in 32 config.gcc for big endian configurations. */ 33 #if TARGET_BIG_ENDIAN_DEFAULT 34 #define TARGET_FDPIC_LINKER_EMULATION "armelfb_linux_fdpiceabi" 35 #else 36 #define TARGET_FDPIC_LINKER_EMULATION "armelf_linux_fdpiceabi" 37 #endif 38 39 /* Unless we generate a shared library or a relocatable object, we 40 force -pie. */ 41 /* -static is not supported, because we have to define the 42 dynamic-linker, as we have some relocations to resolve at load 43 time. We do not generate an error in case the user explictly passes 44 the -dynamic-linker option to the linker. */ 45 #undef SUBTARGET_EXTRA_LINK_SPEC 46 #define SUBTARGET_EXTRA_LINK_SPEC \ 47 "%{!mno-fdpic: -m " TARGET_FDPIC_LINKER_EMULATION \ 48 "%{!shared:%{!r: -pie}} }" \ 49 "%{mno-fdpic: -m " TARGET_LINKER_EMULATION "}" \ 50 "%{!r:%{!mno-fdpic: -z now}}" 51 52 #undef STARTFILE_SPEC 53 #define STARTFILE_SPEC "%{!mno-fdpic:%{!shared:crtreloc.o%s}} " \ 54 LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) 55