1*ec02198aSmrg# Copyright (C) 1998-2020 Free Software Foundation, Inc.
210d565efSmrg#
310d565efSmrg# This file is part of GCC.
410d565efSmrg#
510d565efSmrg# GCC is free software; you can redistribute it and/or modify
610d565efSmrg# it under the terms of the GNU General Public License as published by
710d565efSmrg# the Free Software Foundation; either version 3, or (at your option)
810d565efSmrg# any later version.
910d565efSmrg#
1010d565efSmrg# GCC is distributed in the hope that it will be useful,
1110d565efSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1210d565efSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1310d565efSmrg# GNU General Public License for more details.
1410d565efSmrg#
1510d565efSmrg# You should have received a copy of the GNU General Public License
1610d565efSmrg# along with GCC; see the file COPYING3.  If not see
1710d565efSmrg# <http://www.gnu.org/licenses/>.
1810d565efSmrg
19c7a68eb7Smrg# Build a very basic set of libraries that should cater for most cases.
20c7a68eb7Smrg
21c7a68eb7Smrg# Single-precision floating-point is NOT supported; we don't build a
22c7a68eb7Smrg# suitable library for that.  Use the rm-profile config in that case.
23c7a68eb7Smrg
24c7a68eb7Smrg# PART 1 - Useful groups of options
25c7a68eb7Smrg
26c7a68eb7Smrgdp_fpus		:= vfp vfpv2 vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 \
27c7a68eb7Smrg		   neon neon-vfpv3 neon-fp16 vfpv4 neon-vfpv4 vfpv4-d16 \
28c7a68eb7Smrg		   fpv5-d16 fp-armv8 neon-fp-armv8 crypto-neon-fp-armv8 \
29c7a68eb7Smrg		   vfp3
30c7a68eb7Smrg
31c7a68eb7Smrgsp_fpus		:= vfpv3xd vfpv3xd-fp16  fpv4-sp-d16 fpv5-sp-d16
32c7a68eb7Smrg
33c7a68eb7Smrgv7a_fps		:= vfpv3 vfpv3-fp16 vfpv4 simd neon-fp16 neon-vfpv4
34c7a68eb7Smrgv7ve_fps	:= vfpv3-d16 vfpv3 vfpv3-d16-fp16 vfpv3-fp16 vfpv4 neon \
35c7a68eb7Smrg		   neon-fp16 simd
36c7a68eb7Smrg
37c7a68eb7Smrg# Not all these permutations exist for all architecture variants, but
38c7a68eb7Smrg# it seems to work ok.
39c7a68eb7Smrgv8_fps		:= simd fp16 crypto fp16+crypto dotprod fp16fml
40c7a68eb7Smrg
41c7a68eb7Smrg# We don't do anything special with these.  Pre-v4t probably doesn't work.
420fc04c29Smrgall_early_nofp	:= armv4 armv4t armv5t
43c7a68eb7Smrg
440fc04c29Smrgall_early_arch	:= armv5tej armv6 armv6j armv6k armv6z armv6kz \
45c7a68eb7Smrg		   armv6zk armv6t2 iwmmxt iwmmxt2
46c7a68eb7Smrg
47c7a68eb7Smrgall_v7_a_r	:= armv7-a armv7ve armv7-r
48c7a68eb7Smrg
490fc04c29Smrgall_v8_archs	:= armv8-a armv8-a+crc armv8.1-a armv8.2-a armv8.3-a armv8.4-a \
50*ec02198aSmrg		   armv8.5-a armv8.6-a
51c7a68eb7Smrg
52c7a68eb7Smrg# No floating point variants, require thumb1 softfp
53c7a68eb7Smrgall_nofp_t	:= armv6-m armv6s-m armv8-m.base
54c7a68eb7Smrg
55c7a68eb7Smrgall_nofp_t2	:= armv7-m
56c7a68eb7Smrg
57c7a68eb7Smrgall_sp_only	:= armv7e-m armv8-m.main
58c7a68eb7Smrg
59c7a68eb7SmrgMULTILIB_OPTIONS     =
60c7a68eb7SmrgMULTILIB_DIRNAMES    =
6110d565efSmrgMULTILIB_EXCEPTIONS  =
6210d565efSmrgMULTILIB_MATCHES     =
63c7a68eb7SmrgMULTILIB_REUSE	     =
6410d565efSmrg
65c7a68eb7Smrg# PART 2 - multilib build rules
6610d565efSmrg
67c7a68eb7SmrgMULTILIB_OPTIONS     += marm/mthumb
68c7a68eb7SmrgMULTILIB_DIRNAMES    += arm thumb
6910d565efSmrg
70c7a68eb7SmrgMULTILIB_OPTIONS     += mfpu=auto
71c7a68eb7SmrgMULTILIB_DIRNAMES    += autofp
72c7a68eb7Smrg
73c7a68eb7SmrgMULTILIB_OPTIONS     += march=armv5te+fp/march=armv7+fp
74c7a68eb7SmrgMULTILIB_DIRNAMES    += v5te v7
75c7a68eb7Smrg
7610d565efSmrgMULTILIB_OPTIONS     += mfloat-abi=hard
7710d565efSmrgMULTILIB_DIRNAMES    += fpu
7810d565efSmrg
79c7a68eb7Smrg# Build a total of 4 library variants (base options plus the following):
80c7a68eb7SmrgMULTILIB_REQUIRED    += mthumb
81c7a68eb7SmrgMULTILIB_REQUIRED    += marm/mfpu=auto/march=armv5te+fp/mfloat-abi=hard
82c7a68eb7SmrgMULTILIB_REQUIRED    += mthumb/mfpu=auto/march=armv7+fp/mfloat-abi=hard
83c7a68eb7Smrg
84c7a68eb7Smrg# PART 3 - Match rules
85c7a68eb7Smrg
86c7a68eb7Smrg# Map all supported FPUs onto mfpu=auto
87c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach FPU, $(dp_fpus), \
88c7a68eb7Smrg			  mfpu?auto=mfpu?$(FPU))
89c7a68eb7Smrg
90c7a68eb7SmrgMULTILIB_MATCHES     += march?armv5te+fp=march?armv5te
91c7a68eb7Smrg
92c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach ARCH, $(all_early_arch), \
93c7a68eb7Smrg		          march?armv5te+fp=march?$(ARCH) \
94c7a68eb7Smrg			  march?armv5te+fp=march?$(ARCH)+fp)
95c7a68eb7Smrg
96c7a68eb7SmrgMULTILIB_MATCHES     += march?armv7+fp=march?armv7
97c7a68eb7Smrg
98c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach FPARCH, $(v7a_fps), \
99c7a68eb7Smrg		          march?armv7+fp=march?armv7-a+$(FPARCH))
100c7a68eb7Smrg
101c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach FPARCH, $(v7ve_fps), \
102c7a68eb7Smrg		          march?armv7+fp=march?armv7ve+$(FPARCH))
103c7a68eb7Smrg
104c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach ARCH, $(all_v7_a_r), \
105c7a68eb7Smrg			  march?armv7+fp=march?$(ARCH) \
106c7a68eb7Smrg			  march?armv7+fp=march?$(ARCH)+fp)
107c7a68eb7Smrg
108c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach ARCH, $(all_v8_archs), \
109c7a68eb7Smrg			  march?armv7+fp=march?$(ARCH) \
110c7a68eb7Smrg			  $(foreach FPARCH, $(v8_fps), \
111c7a68eb7Smrg			    march?armv7+fp=march?$(ARCH)+$(FPARCH)))
112c7a68eb7Smrg
113c7a68eb7SmrgMULTILIB_MATCHES     += $(foreach ARCH, armv7e-m armv8-m.mainline, \
114c7a68eb7Smrg			  march?armv7+fp=march?$(ARCH)+fp.dp)
115c7a68eb7Smrg
116c7a68eb7Smrg# PART 4 - Reuse rules
117c7a68eb7Smrg
118c7a68eb7SmrgMULTILIB_REUSE	     += mthumb=mthumb/mfpu.auto
119c7a68eb7SmrgMULTILIB_REUSE	     += mthumb=mthumb/mfpu.auto/march.armv5te+fp
120c7a68eb7SmrgMULTILIB_REUSE	     += mthumb=mthumb/march.armv5te+fp
121c7a68eb7SmrgMULTILIB_REUSE	     += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=marm/march.armv5te+fp/mfloat-abi.hard
122c7a68eb7SmrgMULTILIB_REUSE	     += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=march.armv5te+fp/mfloat-abi.hard
123c7a68eb7SmrgMULTILIB_REUSE	     += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=mfpu.auto/march.armv5te+fp/mfloat-abi.hard
124c7a68eb7SmrgMULTILIB_REUSE	     += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mthumb/march.armv7+fp/mfloat-abi.hard
125c7a68eb7SmrgMULTILIB_REUSE	     += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mfpu.auto/march.armv7+fp/mfloat-abi.hard
126c7a68eb7SmrgMULTILIB_REUSE	     += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=march.armv7+fp/mfloat-abi.hard
127