1 1.1.1.12 mrg # Copyright (C) 2006-2024 Free Software Foundation, Inc. 2 1.1.1.2 mrg 3 1.1.1.2 mrg # This file is part of GCC. 4 1.1.1.2 mrg 5 1.1.1.2 mrg # GCC is free software; you can redistribute it and/or modify 6 1.1.1.2 mrg # it under the terms of the GNU General Public License as published by 7 1.1.1.2 mrg # the Free Software Foundation; either version 3, or (at your option) 8 1.1.1.2 mrg # any later version. 9 1.1.1.2 mrg 10 1.1.1.2 mrg # GCC is distributed in the hope that it will be useful, 11 1.1.1.2 mrg # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1.1.2 mrg # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1.1.2 mrg # GNU General Public License for more details. 14 1.1.1.2 mrg 15 1.1.1.2 mrg # You should have received a copy of the GNU General Public License 16 1.1.1.2 mrg # along with GCC; see the file COPYING3. If not see 17 1.1.1.2 mrg # <http://www.gnu.org/licenses/>. 18 1.1.1.2 mrg 19 1.1.1.2 mrg # Targets using soft-fp should define the following variables: 20 1.1.1.2 mrg # 21 1.1.1.2 mrg # softfp_float_modes: a list of soft-float floating-point modes, 22 1.1.1.2 mrg # e.g. sf df 23 1.1.1.2 mrg # softfp_int_modes: a list of integer modes for which to define conversions, 24 1.1.1.2 mrg # e.g. si di 25 1.1.1.2 mrg # softfp_extensions: a list of extensions between floating-point modes, 26 1.1.1.2 mrg # e.g. sfdf 27 1.1.1.2 mrg # softfp_truncations: a list of truncations between floating-point modes, 28 1.1.1.2 mrg # e.g. dfsf 29 1.1.1.2 mrg # 30 1.1.1.2 mrg # Extensions and truncations should include those where only one mode 31 1.1.1.2 mrg # is a soft-float mode; for example, sftf where sf is hard-float and 32 1.1.1.2 mrg # tf is soft-float. 33 1.1.1.2 mrg # 34 1.1.1.3 mrg # If some additional functions should be built that are not implied by 35 1.1.1.3 mrg # the above settings, also define softfp_extras as a list of those 36 1.1.1.3 mrg # functions, e.g. unorddf2. 37 1.1.1.3 mrg # 38 1.1.1.3 mrg # If the functions should only be built as compat symbols for shared 39 1.1.1.3 mrg # libgcc, not available for new links, also define: 40 1.1.1.3 mrg # 41 1.1.1.3 mrg # softfp_compat := y 42 1.1.1.3 mrg # 43 1.1.1.2 mrg # If the libgcc2.c functions should not be replaced, also define: 44 1.1.1.2 mrg # 45 1.1.1.2 mrg # softfp_exclude_libgcc2 := y 46 1.1.1.2 mrg # 47 1.1.1.2 mrg # Avoiding replacing the libgcc2.c functions is a temporary measure 48 1.1.1.2 mrg # for targets with both hard-float and soft-float multilibs, since 49 1.1.1.2 mrg # these variables apply for all multilibs. With toplevel libgcc, 50 1.1.1.2 mrg # soft-fp can be used conditionally on the multilib instead. 51 1.1.1.2 mrg # 52 1.1.1.2 mrg # If the code should not be compiled at all for some multilibs, define: 53 1.1.1.2 mrg # 54 1.1.1.2 mrg # softfp_wrap_start: text to put at the start of wrapper source files, 55 1.1.1.2 mrg # output with echo 56 1.1.1.2 mrg # e.g. '#ifndef __powerpc64__' 57 1.1.1.2 mrg # softfp_wrap_end: text to put at the end of wrapper source files, 58 1.1.1.2 mrg # e.g. '#endif' 59 1.1.1.2 mrg # 60 1.1.1.3 mrg # This is another temporary measure, and cannot be used together with 61 1.1.1.3 mrg # softfp_compat. 62 1.1.1.2 mrg 63 1.1.1.2 mrg softfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \ 64 1.1.1.2 mrg neg$(m)2 sub$(m)3 unord$(m)2 65 1.1.1.2 mrg softfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \ 66 1.1.1.2 mrg float$(i)$(m) floatun$(i)$(m) 67 1.1.1.12 mrg softfp_floatbitint_funcs = fix$(m)bitint floatbitint$(m) 68 1.1.1.12 mrg softfp_bid_list := 69 1.1.1.12 mrg ifeq ($(decimal_float),yes) 70 1.1.1.12 mrg ifeq ($(enable_decimal_float),bid) 71 1.1.1.12 mrg softfp_bid_list += bitintpow10 \ 72 1.1.1.12 mrg $(foreach m,sd dd td,fix$(m)bitint floatbitint$(m) \ 73 1.1.1.12 mrg fix$(m)ti fixuns$(m)ti \ 74 1.1.1.12 mrg floatti$(m) floatunti$(m)) 75 1.1.1.12 mrg endif 76 1.1.1.12 mrg endif 77 1.1.1.2 mrg 78 1.1.1.2 mrg softfp_func_list := \ 79 1.1.1.2 mrg $(foreach m,$(softfp_float_modes), \ 80 1.1.1.2 mrg $(softfp_float_funcs) \ 81 1.1.1.2 mrg $(foreach i,$(softfp_int_modes), \ 82 1.1.1.2 mrg $(softfp_floatint_funcs))) \ 83 1.1.1.12 mrg $(foreach m,sf df,$(softfp_floatbitint_funcs)) \ 84 1.1.1.2 mrg $(foreach e,$(softfp_extensions),extend$(e)2) \ 85 1.1.1.3 mrg $(foreach t,$(softfp_truncations),trunc$(t)2) \ 86 1.1.1.3 mrg $(softfp_extras) 87 1.1.1.2 mrg 88 1.1.1.2 mrg ifeq ($(softfp_exclude_libgcc2),y) 89 1.1.1.2 mrg # This list is taken from mklibgcc.in and doesn't presently allow for 90 1.1.1.2 mrg # 64-bit targets where si should become di and di should become ti. 91 1.1.1.2 mrg softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \ 92 1.1.1.2 mrg fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \ 93 1.1.1.2 mrg floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \ 94 1.1.1.2 mrg floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list)) 95 1.1.1.2 mrg endif 96 1.1.1.2 mrg 97 1.1.1.3 mrg ifeq ($(softfp_compat),y) 98 1.1.1.3 mrg softfp_file_list := $(addsuffix .c,$(softfp_func_list)) 99 1.1.1.3 mrg 100 1.1.1.3 mrg ifeq ($(enable_shared),yes) 101 1.1.1.3 mrg softfp_map_dep := libgcc.map.in 102 1.1.1.2 mrg else 103 1.1.1.3 mrg softfp_map_dep := 104 1.1.1.3 mrg endif 105 1.1.1.3 mrg softfp_set_symver = echo "asm (\".symver $(1),$(1)@`$(AWK) -f $(srcdir)/find-symver.awk -v symbol=$(1) libgcc.map.in`\");" >> $@ 106 1.1.1.3 mrg $(softfp_file_list): $(softfp_map_dep) 107 1.1.1.3 mrg echo '#ifdef SHARED' > $@ 108 1.1.1.3 mrg echo '#include "soft-fp/$@"' >> $@ 109 1.1.1.3 mrg ifeq ($(enable_shared),yes) 110 1.1.1.3 mrg $(call softfp_set_symver,__$(*F)) 111 1.1.1.3 mrg if grep strong_alias $(srcdir)/soft-fp/$@ > /dev/null; then \ 112 1.1.1.3 mrg alias=`grep strong_alias $(srcdir)/soft-fp/$@ | sed -e 's/.*, *//' -e 's/).*//'`; \ 113 1.1.1.3 mrg $(call softfp_set_symver,$$alias); \ 114 1.1.1.3 mrg fi 115 1.1.1.3 mrg endif 116 1.1.1.3 mrg echo '#endif' >> $@ 117 1.1.1.4 mrg else 118 1.1.1.4 mrg ifneq ($(softfp_wrap_start),) 119 1.1.1.2 mrg softfp_file_list := $(addsuffix .c,$(softfp_func_list)) 120 1.1.1.2 mrg 121 1.1.1.2 mrg $(softfp_file_list): 122 1.1.1.2 mrg echo $(softfp_wrap_start) > $@ 123 1.1.1.2 mrg echo '#include "soft-fp/$@"' >> $@ 124 1.1.1.2 mrg echo $(softfp_wrap_end) >> $@ 125 1.1.1.3 mrg else 126 1.1.1.3 mrg softfp_file_list := \ 127 1.1.1.3 mrg $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list))) 128 1.1.1.2 mrg endif 129 1.1.1.4 mrg endif 130 1.1.1.12 mrg softfp_bid_file_list := \ 131 1.1.1.12 mrg $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_bid_list))) 132 1.1.1.2 mrg 133 1.1 mrg # Disable missing prototype and type limit warnings. The prototypes 134 1.1 mrg # for the functions in the soft-fp files have not been brought across 135 1.1 mrg # from glibc. 136 1.1 mrg 137 1.1.1.3 mrg soft-fp-objects-base = $(basename $(notdir $(softfp_file_list))) 138 1.1.1.3 mrg 139 1.1.1.3 mrg soft-fp-objects = $(addsuffix $(objext), $(soft-fp-objects-base)) \ 140 1.1.1.3 mrg $(addsuffix _s$(objext), $(soft-fp-objects-base)) 141 1.1 mrg 142 1.1.1.2 mrg $(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits 143 1.1 mrg 144 1.1.1.2 mrg LIB2ADD += $(softfp_file_list) 145 1.1.1.12 mrg LIB2ADD_ST += $(softfp_bid_file_list) 146 1.1 mrg 147 1.1.1.2 mrg ifneq ($(softfp_exclude_libgcc2),y) 148 1.1.1.2 mrg # Functions in libgcc2.c are excluded for each soft-float mode (a 149 1.1.1.2 mrg # target may have both soft-float and hard-float modes), for the fixed 150 1.1.1.2 mrg # list of integer modes (si and di) for which libgcc2.c defines any 151 1.1.1.2 mrg # such functions. Depending on the target, the si and di symbols may 152 1.1.1.2 mrg # in fact define di and ti functions. 153 1.1.1.2 mrg 154 1.1.1.2 mrg LIB2FUNCS_EXCLUDE += \ 155 1.1.1.2 mrg $(addprefix _,$(foreach m,$(softfp_float_modes), \ 156 1.1.1.2 mrg $(foreach i,si di, \ 157 1.1.1.2 mrg $(softfp_floatint_funcs)))) 158 1.1.1.2 mrg endif 159