t-softfp 5.3 KB

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