Merge branch 'vendor/GCC50' - gcc 5.0 snapshot 1 FEB 2015
[dragonfly.git] / contrib / gcc-5.0 / libgcc / config / t-softfp
1 # Copyright (C) 2006-2015 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 # Targets using soft-fp should define the following variables:
20 #
21 # softfp_float_modes: a list of soft-float floating-point modes,
22 #                     e.g. sf df
23 # softfp_int_modes: a list of integer modes for which to define conversions,
24 #                   e.g. si di
25 # softfp_extensions: a list of extensions between floating-point modes,
26 #                    e.g. sfdf
27 # softfp_truncations: a list of truncations between floating-point modes,
28 #                     e.g. dfsf
29 #
30 # Extensions and truncations should include those where only one mode
31 # is a soft-float mode; for example, sftf where sf is hard-float and
32 # tf is soft-float.
33 #
34 # If some additional functions should be built that are not implied by
35 # the above settings, also define softfp_extras as a list of those
36 # functions, e.g. unorddf2.
37 #
38 # If the functions should only be built as compat symbols for shared
39 # libgcc, not available for new links, also define:
40 #
41 # softfp_compat := y
42 #
43 # If the libgcc2.c functions should not be replaced, also define:
44 #
45 # softfp_exclude_libgcc2 := y
46 #
47 # Avoiding replacing the libgcc2.c functions is a temporary measure
48 # for targets with both hard-float and soft-float multilibs, since
49 # these variables apply for all multilibs.  With toplevel libgcc,
50 # soft-fp can be used conditionally on the multilib instead.
51 #
52 # If the code should not be compiled at all for some multilibs, define:
53 #
54 # softfp_wrap_start: text to put at the start of wrapper source files,
55 #                    output with echo
56 #                    e.g. '#ifndef __powerpc64__'
57 # softfp_wrap_end: text to put at the end of wrapper source files,
58 #                  e.g. '#endif'
59 #
60 # This is another temporary measure, and cannot be used together with
61 # softfp_compat.
62
63 softfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \
64   neg$(m)2 sub$(m)3 unord$(m)2
65 softfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \
66   float$(i)$(m) floatun$(i)$(m)
67
68 softfp_func_list := \
69   $(foreach m,$(softfp_float_modes), \
70               $(softfp_float_funcs) \
71               $(foreach i,$(softfp_int_modes), \
72                           $(softfp_floatint_funcs))) \
73   $(foreach e,$(softfp_extensions),extend$(e)2) \
74   $(foreach t,$(softfp_truncations),trunc$(t)2) \
75   $(softfp_extras)
76
77 ifeq ($(softfp_exclude_libgcc2),y)
78 # This list is taken from mklibgcc.in and doesn't presently allow for
79 # 64-bit targets where si should become di and di should become ti.
80 softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \
81   fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \
82   floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \
83   floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list))
84 endif
85
86 ifeq ($(softfp_compat),y)
87 softfp_file_list := $(addsuffix .c,$(softfp_func_list))
88
89 ifeq ($(enable_shared),yes)
90 softfp_map_dep := libgcc.map.in
91 else
92 softfp_map_dep :=
93 endif
94 softfp_set_symver = echo "asm (\".symver $(1),$(1)@`$(AWK) -f $(srcdir)/find-symver.awk -v symbol=$(1) libgcc.map.in`\");" >> $@
95 $(softfp_file_list): $(softfp_map_dep)
96         echo '#ifdef SHARED' > $@
97         echo '#include "soft-fp/$@"' >> $@
98 ifeq ($(enable_shared),yes)
99         $(call softfp_set_symver,__$(*F))
100         if grep strong_alias $(srcdir)/soft-fp/$@ > /dev/null; then \
101           alias=`grep strong_alias $(srcdir)/soft-fp/$@ | sed -e 's/.*, *//' -e 's/).*//'`; \
102           $(call softfp_set_symver,$$alias); \
103         fi
104 endif
105         echo '#endif' >> $@
106 else ifneq ($(softfp_wrap_start),)
107 softfp_file_list := $(addsuffix .c,$(softfp_func_list))
108
109 $(softfp_file_list):
110         echo $(softfp_wrap_start) > $@
111         echo '#include "soft-fp/$@"' >> $@
112         echo $(softfp_wrap_end) >> $@
113 else
114 softfp_file_list := \
115   $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list)))
116 endif
117
118 # Disable missing prototype and type limit warnings.  The prototypes
119 # for the functions in the soft-fp files have not been brought across
120 # from glibc.
121
122 soft-fp-objects-base = $(basename $(notdir $(softfp_file_list)))
123
124 soft-fp-objects = $(addsuffix $(objext), $(soft-fp-objects-base)) \
125   $(addsuffix _s$(objext), $(soft-fp-objects-base))
126
127 $(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits
128
129 LIB2ADD += $(softfp_file_list)
130
131 ifneq ($(softfp_exclude_libgcc2),y)
132 # Functions in libgcc2.c are excluded for each soft-float mode (a
133 # target may have both soft-float and hard-float modes), for the fixed
134 # list of integer modes (si and di) for which libgcc2.c defines any
135 # such functions.  Depending on the target, the si and di symbols may
136 # in fact define di and ti functions.
137
138 LIB2FUNCS_EXCLUDE += \
139   $(addprefix _,$(foreach m,$(softfp_float_modes), \
140                             $(foreach i,si di, \
141                                         $(softfp_floatint_funcs))))
142 endif