b27c108234
This is a roll-up of a set of changes needed to support the Arm EABI on NetBSD. 2019-06-14 Matt Thomas <matt@3am-software.com> Matthew Green <mrg@eterna.com.au> Nick Hudson <skrll@netbsd.org> Maya Rashish <coypu@sdf.org> Richard Earnshaw <rearnsha@arm.com> gcc: * config.gcc (arm*-*-netbsdelf*) Add support for EABI configuration. * config.host (arm*-*-netbsd*): Use driver-arm.o on native NetBSD. * config/arm/netbsd-eabi.h: New file. * config/arm/netbsd-elf.h (TARGET_OS_CPP_BUILTINS): Undefine before redefining. (SUBTARGET_EXTRA_ASM_SPEC): Don't pass -matpcs to the assembler. * config/netbsd-elf.h (NETBSD_LINK_LD_ELF_SO_SPEC): New define. (NETBSD_SUBTARGET_EXTRA_SPECS): New define. (SUBTARGET_EXTRA_SPECS): Define to NETBSD_SUBTARGET_EXTRA_SPECS. libatomic: * configure.tgt (arm*): Handle NetBSD in the same way as FreeBSD. libgcc: * config.host (arm*-*-netbsdelf*): Add support for EABI configurations. * config/arm/t-netbsd (LIB1ASMFUNCS): Add some additional assembler functions to build. * config/arm/t-netbsd-eabi: New file. Co-Authored-By: Matthew Green <mrg@eterna.com.au> Co-Authored-By: Maya Rashish <coypu@sdf.org> Co-Authored-By: Nick Hudson <skrll@netbsd.org> Co-Authored-By: Richard Earnshaw <rearnsha@arm.com> From-SVN: r272290
187 lines
4.7 KiB
Bash
187 lines
4.7 KiB
Bash
# -*- shell-script -*-
|
|
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
|
# Contributed by Richard Henderson <rth@redhat.com>.
|
|
#
|
|
# This file is part of the GNU Atomic Library (libatomic).
|
|
#
|
|
# Libatomic 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 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Libatomic 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.
|
|
#
|
|
# Under Section 7 of GPL version 3, you are granted additional
|
|
# permissions described in the GCC Runtime Library Exception, version
|
|
# 3.1, as published by the Free Software Foundation.
|
|
#
|
|
# You should have received a copy of the GNU General Public License and
|
|
# a copy of the GCC Runtime Library Exception along with this program;
|
|
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
# Map the target cpu to an ARCH sub-directory. At the same time,
|
|
# work out any special compilation flags as necessary.
|
|
|
|
# Give operating systems the opportunity to discard XCFLAGS modifications based
|
|
# on ${target_cpu}. For example to allow proper use of multilibs.
|
|
configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
|
|
|
|
case "${target_cpu}" in
|
|
alpha*)
|
|
# fenv.c needs this option to generate inexact exceptions.
|
|
XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui"
|
|
ARCH=alpha
|
|
;;
|
|
rs6000 | powerpc*) ARCH=powerpc ;;
|
|
riscv*) ARCH=riscv ;;
|
|
sh*) ARCH=sh ;;
|
|
|
|
aarch64*)
|
|
ARCH=aarch64
|
|
case "${target}" in
|
|
aarch64*-*-linux*)
|
|
if test -n "$enable_aarch64_lse"; then
|
|
try_ifunc=yes
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
arm*)
|
|
ARCH=arm
|
|
case "${target}" in
|
|
arm*-*-freebsd* | arm*-*-netbsd*)
|
|
;;
|
|
*)
|
|
# ??? Detect when -march=armv7 is already enabled.
|
|
try_ifunc=yes
|
|
;;
|
|
esac
|
|
;;
|
|
sparc)
|
|
case " ${CC} ${CFLAGS} " in
|
|
*" -m64 "*)
|
|
;;
|
|
*)
|
|
if test -z "$with_cpu"; then
|
|
XCFLAGS="${XCFLAGS} -mcpu=v9"
|
|
fi
|
|
esac
|
|
ARCH=sparc
|
|
;;
|
|
sparc64|sparcv9)
|
|
case " ${CC} ${CFLAGS} " in
|
|
*" -m32 "*)
|
|
XCFLAGS="${XCFLAGS} -mcpu=v9"
|
|
;;
|
|
esac
|
|
ARCH=sparc
|
|
;;
|
|
|
|
i[3456]86)
|
|
case " ${CC} ${CFLAGS} " in
|
|
*" -m64 "*|*" -mx32 "*)
|
|
;;
|
|
*)
|
|
if test -z "$with_arch"; then
|
|
XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
|
|
XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
|
|
fi
|
|
esac
|
|
ARCH=x86
|
|
# ??? Detect when -march=i686 is already enabled.
|
|
try_ifunc=yes
|
|
;;
|
|
x86_64)
|
|
case " ${CC} ${CFLAGS} " in
|
|
*" -m32 "*)
|
|
XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
|
|
XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
ARCH=x86
|
|
# ??? Detect when -mcx16 is already enabled.
|
|
try_ifunc=yes
|
|
;;
|
|
|
|
*) ARCH="${target_cpu}" ;;
|
|
esac
|
|
|
|
# The cpu configury is always most relevant.
|
|
if test -d ${srcdir}/config/$ARCH ; then
|
|
config_path="$ARCH"
|
|
fi
|
|
|
|
# Other system configury
|
|
case "${target}" in
|
|
aarch64*-*-linux*)
|
|
# OS support for atomic primitives.
|
|
config_path="${config_path} linux/aarch64 posix"
|
|
;;
|
|
|
|
arm*-*-linux*)
|
|
# OS support for atomic primitives.
|
|
config_path="${config_path} linux/arm posix"
|
|
;;
|
|
|
|
s390*-*-linux*)
|
|
# OS support for atomic primitives.
|
|
config_path="${config_path} s390 posix"
|
|
;;
|
|
|
|
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
|
|
| *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
|
|
| *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
|
|
| *-*-darwin* | *-*-aix* | *-*-cygwin*)
|
|
# POSIX system. The OS is supported.
|
|
config_path="${config_path} posix"
|
|
;;
|
|
|
|
*-*-mingw*)
|
|
# OS support for atomic primitives.
|
|
case ${target_thread_file} in
|
|
win32)
|
|
config_path="${config_path} mingw"
|
|
;;
|
|
posix)
|
|
config_path="${config_path} posix"
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
*-*-rtems*)
|
|
XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}"
|
|
config_path="rtems"
|
|
;;
|
|
|
|
*-*-elf*)
|
|
# ??? No target OS. We could be targeting bare-metal kernel-mode,
|
|
# or user-mode for some custom OS. If the target supports TAS,
|
|
# we can build our own spinlocks, given there are no signals.
|
|
# If the target supports disabling interrupts, we can work in
|
|
# kernel-mode, given the system is not multi-processor.
|
|
UNSUPPORTED=1
|
|
;;
|
|
|
|
*)
|
|
# Who are you?
|
|
UNSUPPORTED=1
|
|
;;
|
|
esac
|
|
|
|
# glibc will pass hwcap to ifunc resolver functions as an argument.
|
|
# The type may be different on different architectures.
|
|
case "${target}" in
|
|
aarch64*-*-*)
|
|
IFUNC_RESOLVER_ARGS="uint64_t hwcap"
|
|
;;
|
|
*)
|
|
IFUNC_RESOLVER_ARGS="void"
|
|
;;
|
|
esac
|