[AArch64] Fix ICEs in aarch64_print_operand
[official-gcc.git] / libatomic / configure.tgt
blob388ae95e6f4570d9b6f04a7ed5ebb12ed3ee81bb
1 # -*- shell-script -*-
2 #  Copyright (C) 2012-2017 Free Software Foundation, Inc.
3 #  Contributed by Richard Henderson <rth@redhat.com>.
5 #  This file is part of the GNU Atomic Library (libatomic).
7 #  Libatomic is free software; you can redistribute it and/or modify it
8 #  under the terms of the GNU General Public License as published by
9 #  the Free Software Foundation; either version 3 of the License, or
10 #  (at your option) any later version.
12 #  Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
13 #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 #  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 #  more details.
17 #  Under Section 7 of GPL version 3, you are granted additional
18 #  permissions described in the GCC Runtime Library Exception, version
19 #  3.1, as published by the Free Software Foundation.
21 #  You should have received a copy of the GNU General Public License and
22 #  a copy of the GCC Runtime Library Exception along with this program;
23 #  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 #  <http://www.gnu.org/licenses/>.
26 # Map the target cpu to an ARCH sub-directory.  At the same time,
27 # work out any special compilation flags as necessary.
29 # Give operating systems the opportunity to discard XCFLAGS modifications based
30 # on ${target_cpu}.  For example to allow proper use of multilibs.
31 configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
33 case "${target_cpu}" in
34   alpha*)
35         # fenv.c needs this option to generate inexact exceptions.
36         XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui"
37         ARCH=alpha
38         ;;
39   rs6000 | powerpc*)    ARCH=powerpc ;;
40   riscv*)               ARCH=riscv ;;
41   sh*)                  ARCH=sh ;;
43   aarch64*)
44         ARCH=aarch64
45         case "${target}" in
46             aarch64*-*-linux*)
47                 try_ifunc=yes
48                 ;;
49         esac
50         ;;
51   arm*)
52         ARCH=arm
53         case "${target}" in
54             arm*-*-freebsd*)
55                 ;;
56             *)
57                 # ??? Detect when -march=armv7 is already enabled.
58                 try_ifunc=yes
59                 ;;
60         esac
61         ;;
62   sparc)
63         case " ${CC} ${CFLAGS} " in
64           *" -m64 "*)
65             ;;
66           *)
67             if test -z "$with_cpu"; then
68               XCFLAGS="${XCFLAGS} -mcpu=v9"
69             fi
70         esac
71         ARCH=sparc
72         ;;
73   sparc64|sparcv9)
74         case " ${CC} ${CFLAGS} " in
75           *" -m32 "*)
76             XCFLAGS="${XCFLAGS} -mcpu=v9"
77             ;;
78         esac
79         ARCH=sparc
80         ;;
82   i[3456]86)
83         case " ${CC} ${CFLAGS} " in
84           *" -m64 "*|*" -mx32 "*)
85             ;;
86           *)
87             if test -z "$with_arch"; then
88               XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
89               XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
90             fi
91         esac
92         ARCH=x86
93         # ??? Detect when -march=i686 is already enabled.
94         try_ifunc=yes
95         ;;
96   x86_64)
97         case " ${CC} ${CFLAGS} " in
98           *" -m32 "*)
99             XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
100             XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
101             ;;
102           *)
103             ;;
104         esac
105         ARCH=x86
106         # ??? Detect when -mcx16 is already enabled.
107         try_ifunc=yes
108         ;;
110   *)                    ARCH="${target_cpu}" ;;
111 esac
113 # The cpu configury is always most relevant.
114 if test -d ${srcdir}/config/$ARCH ; then
115   config_path="$ARCH"
118 # Other system configury
119 case "${target}" in
120   aarch64*-*-linux*)
121         # OS support for atomic primitives.
122         config_path="${config_path} linux/aarch64 posix"
123         ;;
125   arm*-*-linux*)
126         # OS support for atomic primitives.
127         config_path="${config_path} linux/arm posix"
128         ;;
130   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
131   | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
132   | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
133   | *-*-darwin* | *-*-aix* | *-*-cygwin*)
134         # POSIX system.  The OS is supported.
135         config_path="${config_path} posix"
136         ;;
138   *-*-mingw*)
139         # OS support for atomic primitives.
140         case ${target_thread_file} in
141           win32)
142             config_path="${config_path} mingw"
143             ;;
144           posix)
145             config_path="${config_path} posix"
146             ;;
147         esac
148         ;;
150   *-*-rtems*)
151         XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}"
152         config_path="rtems"
153         ;;
155   *-*-elf*)
156         # ??? No target OS.  We could be targeting bare-metal kernel-mode,
157         # or user-mode for some custom OS.  If the target supports TAS,
158         # we can build our own spinlocks, given there are no signals.
159         # If the target supports disabling interrupts, we can work in
160         # kernel-mode, given the system is not multi-processor.
161         UNSUPPORTED=1
162         ;;
164   *)
165         # Who are you?
166         UNSUPPORTED=1
167         ;;
168 esac
170 # glibc will pass hwcap to ifunc resolver functions as an argument.
171 # The type may be different on different architectures.
172 case "${target}" in
173   aarch64*-*-*)
174         IFUNC_RESOLVER_ARGS="uint64_t hwcap"
175         ;;
176   *)
177         IFUNC_RESOLVER_ARGS="void"
178         ;;
179 esac