2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+ Mickaël Guêné <mickael.guene@st.com>
- * config.gcc: Handle *-*-uclinuxfdpiceabi.
+ * config.gcc: Handle arm*-*-uclinuxfdpiceabi.
+ * config/arm/bpabi.h (TARGET_FDPIC_ASM_SPEC): New.
+ (SUBTARGET_EXTRA_ASM_SPEC): Use TARGET_FDPIC_ASM_SPEC.
+ * config/arm/linux-eabi.h (FDPIC_CC1_SPEC): New.
+ (CC1_SPEC): Use FDPIC_CC1_SPEC.
+ (MUSL_DYNAMIC_LINKER): Add -fdpic suffix when needed.
+ * config/arm/uclinuxfdpiceabi.h: New file.
+
+2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+
+ * config.gcc: Handle *-*-uclinuxfdpiceabi.
2019-09-10 Christophe Lyon <christophe.lyon@st.com>
Mickaël Guêné <mickael.guene@st.com>
esac
tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h arm/arm.h"
+ case $target in
+ arm*-*-uclinuxfdpiceabi)
+ tm_file="$tm_file arm/uclinuxfdpiceabi.h"
+ ;;
+ esac
# Generation of floating-point instructions requires at least ARMv5te.
if [ "$with_float" = "hard" -o "$with_float" = "softfp" ] ; then
target_cpu_cname="arm10e"
#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
"|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+#define TARGET_FDPIC_ASM_SPEC ""
+
#define BE8_LINK_SPEC \
"%{!r:%{!mbe32:%:be8_linkopt(%{mlittle-endian:little}" \
" %{mbig-endian:big}" \
/* Tell the assembler to build BPABI binaries. */
#undef SUBTARGET_EXTRA_ASM_SPEC
#define SUBTARGET_EXTRA_ASM_SPEC \
- "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
+ "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC \
+ TARGET_FDPIC_ASM_SPEC
#ifndef SUBTARGET_EXTRA_LINK_SPEC
#define SUBTARGET_EXTRA_LINK_SPEC ""
#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
#endif
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef ASAN_CC1_SPEC
#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
+#define FDPIC_CC1_SPEC ""
+
#undef CC1_SPEC
#define CC1_SPEC \
- LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \
+ LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \
+ FDPIC_CC1_SPEC, \
GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \
ANDROID_CC1_SPEC)
--- /dev/null
+/* Configuration file for ARM GNU/Linux FDPIC EABI targets.
+ Copyright (C) 2018,2019 Free Software Foundation, Inc.
+ Contributed by STMicroelectronics.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* On uClibc EABI GNU/Linux, we want to force -mfdpic by default,
+ which also means we produce PIE code by default. */
+#undef FDPIC_CC1_SPEC
+#define FDPIC_CC1_SPEC \
+ "%{!mno-fdpic:-mfdpic %{!fno-PIE:%{!fpie:%{!fPIC:%{!fpic: -fPIE}}}}}"
+
+/* Add --fdpic assembler flag by default. */
+#undef TARGET_FDPIC_ASM_SPEC
+#define TARGET_FDPIC_ASM_SPEC "%{!mno-fdpic: --fdpic}"
+
+/* TARGET_BIG_ENDIAN_DEFAULT is set in
+ config.gcc for big endian configurations. */
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_FDPIC_LINKER_EMULATION "armelfb_linux_fdpiceabi"
+#else
+#define TARGET_FDPIC_LINKER_EMULATION "armelf_linux_fdpiceabi"
+#endif
+
+/* Unless we generate a shared library or a relocatable object, we
+ force -pie. */
+/* -static is not supported, because we have to define the
+ dynamic-linker, as we have some relocations to resolve at load
+ time. We do not generate an error in case the user explictly passes
+ the -dynamic-linker option to the linker. */
+#undef SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC \
+ "%{!mno-fdpic: -m " TARGET_FDPIC_LINKER_EMULATION \
+ "%{!shared:%{!r: -pie}} }" \
+ "%{mno-fdpic: -m " TARGET_LINKER_EMULATION "}" \
+ "%{!r:%{!mno-fdpic: -z now}}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{!mno-fdpic:%{!shared:crtreloc.o%s}} " \
+ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC)
+2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+ Mickaël Guêné <mickael.guene@st.com>
+
+ * configure.tgt (arm*-*-*fdpiceabi): Sanitizers are
+ unsupported in this configuration.
+
2019-08-16 Iain Sandoe <iain@sandoe.co.uk>
* LOCAL_PATCHES: Add r274585.
;;
sparc*-*-solaris2.11*)
;;
+ arm*-*-*fdpiceabi)
+ UNSUPPORTED=1
+ ;;
arm*-*-linux*)
;;
mips*64*-*-linux*)