]> git.ipfire.org Git - thirdparty/gcc.git/blame - libatomic/configure.tgt
Add new test for PR65178.
[thirdparty/gcc.git] / libatomic / configure.tgt
CommitLineData
48310492 1# -*- shell-script -*-
99dee823 2# Copyright (C) 2012-2021 Free Software Foundation, Inc.
48310492
RH
3# Contributed by Richard Henderson <rth@redhat.com>.
4#
5# This file is part of the GNU Atomic Library (libatomic).
6#
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.
11#
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.
16#
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.
20#
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/>.
25
26# Map the target cpu to an ARCH sub-directory. At the same time,
27# work out any special compilation flags as necessary.
28
c47194d2
SH
29# Give operating systems the opportunity to discard XCFLAGS modifications based
30# on ${target_cpu}. For example to allow proper use of multilibs.
31configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
32
48310492 33case "${target_cpu}" in
537b5312
UB
34 alpha*)
35 # fenv.c needs this option to generate inexact exceptions.
36 XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui"
37 ARCH=alpha
38 ;;
48310492 39 rs6000 | powerpc*) ARCH=powerpc ;;
b906c007 40 riscv*) ARCH=riscv ;;
48310492
RH
41 sh*) ARCH=sh ;;
42
141abc6f
SE
43 aarch64*)
44 ARCH=aarch64
45 case "${target}" in
46 aarch64*-*-linux*)
9d0e85af
SE
47 if test -n "$enable_aarch64_lse"; then
48 try_ifunc=yes
49 fi
141abc6f
SE
50 ;;
51 esac
52 ;;
48310492
RH
53 arm*)
54 ARCH=arm
82a19768 55 case "${target}" in
b27c1082 56 arm*-*-freebsd* | arm*-*-netbsd*)
82a19768
AT
57 ;;
58 *)
59 # ??? Detect when -march=armv7 is already enabled.
60 try_ifunc=yes
61 ;;
62 esac
63 ;;
48310492
RH
64 sparc)
65 case " ${CC} ${CFLAGS} " in
66 *" -m64 "*)
67 ;;
68 *)
69 if test -z "$with_cpu"; then
70 XCFLAGS="${XCFLAGS} -mcpu=v9"
71 fi
72 esac
73 ARCH=sparc
74 ;;
75 sparc64|sparcv9)
76 case " ${CC} ${CFLAGS} " in
77 *" -m32 "*)
78 XCFLAGS="${XCFLAGS} -mcpu=v9"
79 ;;
80 esac
81 ARCH=sparc
82 ;;
83
0411ae7f
JJ
84 i[3456]86 | x86_64)
85 cat > conftestx.c <<EOF
86#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
87#error need -march=i486
88#endif
89EOF
90 if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
91 :
92 else
93 if test "${target_cpu}" = x86_64; then
3dd7e092 94 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
0411ae7f
JJ
95 else
96 XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
97 fi
98 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
99 fi
100 cat > conftestx.c <<EOF
101#ifdef __x86_64__
102#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
103#error need -mcx16
104#endif
105#else
106#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
107#error need -march=i686
108#endif
109#endif
110EOF
111 if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
112 try_ifunc=no
113 else
114 try_ifunc=yes
115 fi
116 rm -f conftestx.c
48310492 117 ARCH=x86
48310492
RH
118 ;;
119
120 *) ARCH="${target_cpu}" ;;
121esac
122
123# The cpu configury is always most relevant.
124if test -d ${srcdir}/config/$ARCH ; then
125 config_path="$ARCH"
126fi
127
47ddb895 128tmake_file=
48310492
RH
129# Other system configury
130case "${target}" in
141abc6f
SE
131 aarch64*-*-linux*)
132 # OS support for atomic primitives.
133 config_path="${config_path} linux/aarch64 posix"
134 ;;
135
b1e21e5a 136 arm*-*-linux* | arm*-*-uclinux*)
48310492
RH
137 # OS support for atomic primitives.
138 config_path="${config_path} linux/arm posix"
139 ;;
140
a4c6bd08
AK
141 s390*-*-linux*)
142 # OS support for atomic primitives.
143 config_path="${config_path} s390 posix"
144 ;;
145
47ddb895
DE
146 powerpc*-*-aix*)
147 config_path="${config_path} posix"
148 tmake_file="t-aix"
149 ;;
150
48310492 151 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
b6735e76 152 | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
48310492 153 | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
6fe8c024 154 | *-*-darwin* | *-*-aix* | *-*-cygwin*)
48310492
RH
155 # POSIX system. The OS is supported.
156 config_path="${config_path} posix"
157 ;;
158
dc3368d0
KT
159 *-*-mingw*)
160 # OS support for atomic primitives.
161 case ${target_thread_file} in
162 win32)
163 config_path="${config_path} mingw"
164 ;;
165 posix)
166 config_path="${config_path} posix"
167 ;;
168 esac
169 ;;
c47194d2
SH
170
171 *-*-rtems*)
172 XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}"
173 config_path="rtems"
174 ;;
175
48310492
RH
176 *-*-elf*)
177 # ??? No target OS. We could be targeting bare-metal kernel-mode,
178 # or user-mode for some custom OS. If the target supports TAS,
179 # we can build our own spinlocks, given there are no signals.
180 # If the target supports disabling interrupts, we can work in
181 # kernel-mode, given the system is not multi-processor.
182 UNSUPPORTED=1
183 ;;
184
15545563
TV
185 nvptx*-*-*)
186 ;;
187
48310492
RH
188 *)
189 # Who are you?
190 UNSUPPORTED=1
191 ;;
192esac
141abc6f
SE
193
194# glibc will pass hwcap to ifunc resolver functions as an argument.
195# The type may be different on different architectures.
196case "${target}" in
197 aarch64*-*-*)
198 IFUNC_RESOLVER_ARGS="uint64_t hwcap"
199 ;;
200 *)
201 IFUNC_RESOLVER_ARGS="void"
202 ;;
203esac