| 1 |
# Copyright (C) 2016-2025 Free Software Foundation, Inc. |
| 2 |
# |
| 3 |
# This file is part of GCC. |
| 4 |
# |
| 5 |
# GCC is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3, or (at your option) |
| 8 |
# any later version. |
| 9 |
# |
| 10 |
# GCC is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with GCC; see the file COPYING3. If not see |
| 17 |
# <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
# This is a target makefile fragment that attempts to get |
| 20 |
# multilibs built for the range of CPU's, FPU's and ABI's that |
| 21 |
# are relevant for the ARM architecture. It should not be used in |
| 22 |
# conjunction with another make file fragment and assumes --with-arch, |
| 23 |
# --with-cpu, --with-fpu, --with-float, --with-mode have their default |
| 24 |
# values during the configure step. We enforce this during the |
| 25 |
# top-level configury. |
| 26 |
|
| 27 |
|
| 28 |
# Arch and FPU variants to build libraries with |
| 29 |
|
| 30 |
MULTI_ARCH_OPTS_RM = march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+fp/march=armv7e-m+fp.dp/march=armv8-m.base/march=armv8-m.main/march=armv8-m.main+fp/march=armv8-m.main+fp.dp/march=armv8.1-m.main+mve/march=armv8.1-m.main+pacbti/march=armv8.1-m.main+pacbti+fp/march=armv8.1-m.main+pacbti+fp.dp/march=armv8.1-m.main+pacbti+mve |
| 31 |
MULTI_ARCH_DIRS_RM = v6-m v7-m v7e-m v7e-m+fp v7e-m+dp v8-m.base v8-m.main v8-m.main+fp v8-m.main+dp v8.1-m.main+mve v8.1-m.main+pacbti v8.1-m.main+pacbti+fp v8.1-m.main+pacbti+dp v8.1-m.main+pacbti+mve |
| 32 |
|
| 33 |
MULTI_ARCH_OPTS_RM += mbranch-protection=standard |
| 34 |
MULTI_ARCH_DIRS_RM += bp |
| 35 |
|
| 36 |
# Base M-profile (no fp) |
| 37 |
MULTILIB_REQUIRED += mthumb/march=armv6s-m/mfloat-abi=soft |
| 38 |
MULTILIB_REQUIRED += mthumb/march=armv7-m/mfloat-abi=soft |
| 39 |
MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=soft |
| 40 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.base/mfloat-abi=soft |
| 41 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.main/mfloat-abi=soft |
| 42 |
|
| 43 |
# ARMv7e-M with FP (single and double precision variants) |
| 44 |
MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp/mfloat-abi=hard |
| 45 |
MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp/mfloat-abi=softfp |
| 46 |
MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp.dp/mfloat-abi=hard |
| 47 |
MULTILIB_REQUIRED += mthumb/march=armv7e-m+fp.dp/mfloat-abi=softfp |
| 48 |
|
| 49 |
# ARMv8-M with FP (single and double precision variants) |
| 50 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp/mfloat-abi=hard |
| 51 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp/mfloat-abi=softfp |
| 52 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp.dp/mfloat-abi=hard |
| 53 |
MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp.dp/mfloat-abi=softfp |
| 54 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+mve/mfloat-abi=hard |
| 55 |
|
| 56 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti/mbranch-protection=standard/mfloat-abi=soft |
| 57 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp/mbranch-protection=standard/mfloat-abi=softfp |
| 58 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp/mbranch-protection=standard/mfloat-abi=hard |
| 59 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp.dp/mbranch-protection=standard/mfloat-abi=softfp |
| 60 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp.dp/mbranch-protection=standard/mfloat-abi=hard |
| 61 |
MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+mve/mbranch-protection=standard/mfloat-abi=hard |
| 62 |
|
| 63 |
# Arch Matches |
| 64 |
MULTILIB_MATCHES += march?armv6s-m=march?armv6-m |
| 65 |
|
| 66 |
# For all MULITIB_MATCHES for v8-m and above add mlibarch? on the right hand side |
| 67 |
# of = in the variant string instead of march?. This is needed because all the |
| 68 |
# MULITIB_MATCHES variant strings are compared with mlibarch option for multilib |
| 69 |
# linking. |
| 70 |
|
| 71 |
# Map all v8-m.main+dsp FP variants down to the variant without DSP. |
| 72 |
MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8-m.main+dsp \ |
| 73 |
$(foreach FP, +fp +fp.dp, \ |
| 74 |
march?armv8-m.main$(FP)=mlibarch?armv8-m.main+dsp$(FP)) |
| 75 |
|
| 76 |
# For single-precision only fpv5, use the base fp libraries |
| 77 |
MULTILIB_MATCHES += march?armv7e-m+fp=march?armv7e-m+fpv5 |
| 78 |
|
| 79 |
# Softfp but no FP. Use the soft-float libraries. |
| 80 |
MULTILIB_REUSE += $(foreach ARCH, armv6s-m armv7-m armv7e-m armv8-m\.base armv8-m\.main, \ |
| 81 |
mthumb/march.$(ARCH)/mfloat-abi.soft=mthumb/march.$(ARCH)/mfloat-abi.softfp) |
| 82 |
|
| 83 |
# Map v8.1-M to v8-M. |
| 84 |
MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8.1-m.main |
| 85 |
MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8.1-m.main+dsp |
| 86 |
MULTILIB_REUSE += mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+mve/mfloat-abi.soft |
| 87 |
MULTILIB_REUSE += mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+mve/mfloat-abi.softfp |
| 88 |
|
| 89 |
v8_1m_sp_variants = +fp +dsp+fp +mve.fp +fp+mve |
| 90 |
v8_1m_dp_variants = +fp.dp +dsp+fp.dp +fp.dp+mve +fp.dp+mve.fp |
| 91 |
|
| 92 |
# Map all v8.1-m.main FP sp variants down to v8-m. |
| 93 |
MULTILIB_MATCHES += $(foreach FP, $(v8_1m_sp_variants), \ |
| 94 |
march?armv8-m.main+fp=mlibarch?armv8.1-m.main$(FP)) |
| 95 |
|
| 96 |
# Map all v8.1-m.main FP dp variants down to v8-m. |
| 97 |
MULTILIB_MATCHES += $(foreach FP, $(v8_1m_dp_variants), \ |
| 98 |
march?armv8-m.main+fp.dp=mlibarch?armv8.1-m.main$(FP)) |
| 99 |
|
| 100 |
# Map all mbranch-protection values other than 'none' to 'standard'. |
| 101 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti |
| 102 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret |
| 103 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+leaf |
| 104 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+bti |
| 105 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+leaf+bti |
| 106 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti+pac-ret |
| 107 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti+pac-ret+leaf |
| 108 |
MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?standard+leaf |
| 109 |
|
| 110 |
# For all the MULTILIB_REQUIRED for v8-m and above, add MULTILIB_MATCHES which |
| 111 |
# maps mlibarch with march for multilib linking. |
| 112 |
MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8-m.main |
| 113 |
MULTILIB_MATCHES += march?armv8-m.main+fp=mlibarch?armv8-m.main+fp |
| 114 |
MULTILIB_MATCHES += march?armv8-m.main+fp.dp=mlibarch?armv8-m.main+fp.dp |
| 115 |
MULTILIB_MATCHES += march?armv8.1-m.main+mve=mlibarch?armv8.1-m.main+mve |
| 116 |
|
| 117 |
# For -mbranch-protection=none and +pacbti reuses the existing non pacbti |
| 118 |
# multilibs. |
| 119 |
MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ |
| 120 |
mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.softfp=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.softfp) |
| 121 |
MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ |
| 122 |
mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.hard) |
| 123 |
|
| 124 |
MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ |
| 125 |
mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.soft) |
| 126 |
MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ |
| 127 |
mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.softfp) |
| 128 |
|
| 129 |
MULTILIB_REUSE += mthumb/march.armv8\.1-m\.main+mve/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+mve/mfloat-abi.hard |
| 130 |
|
| 131 |
pacbti_fp_variants = fp fp+mve mve.fp fp+mve.fp |
| 132 |
pacbti_dp_variants = fp.dp fp.dp+mve fp.dp+mve.fp |
| 133 |
|
| 134 |
# For -mbranch-protection=standard and +pacbti linking to existing pacbti |
| 135 |
# multlibs. |
| 136 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti |
| 137 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti+dsp |
| 138 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+dsp+pacbti |
| 139 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+mve |
| 140 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+dsp+mve |
| 141 |
MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+dsp+pacbti+mve |
| 142 |
|
| 143 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ |
| 144 |
march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) |
| 145 |
|
| 146 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ |
| 147 |
march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) |
| 148 |
|
| 149 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ |
| 150 |
march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) |
| 151 |
|
| 152 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ |
| 153 |
march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) |
| 154 |
|
| 155 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ |
| 156 |
march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) |
| 157 |
|
| 158 |
MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ |
| 159 |
march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) |