1# When building float128 we need to ensure -mfloat128 is 2# passed to all such object files. 3type-float128-CFLAGS := -mfloat128 4 5# Bootstrapping code for enabling IEEE 128. This can be removed and 6# any indirections simplified once IEEE 128 long double is enabled. 7type-ldouble-CFLAGS = 8no-gnu-attribute-CFLAGS = 9ifeq ($(ibm128-fcts),yes) 10ibm128-abi-CFLAGS := -mabi=ibmlongdouble 11type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS) 12no-gnu-attribute-CFLAGS = -mno-gnu-attribute 13 14# This is a very gnarly workaround to static libgcc providing a .gnu.attribute 15# in ibm128 functions. This is not a bug in static libgcc as normal users 16# should only ever link ibm128 or ieee128 routines, never both. We are the 17# exception which allows the decision to be deferred to user libraries or 18# applications. 19# 20# We built an object file and extract the desired .gnu.attributes section 21# to be inserted into lib{c,m}.so. 22ifeq ($(build-shared),yes) 23 24# Build everything with IEEE 128-bit long double. 25sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi $(no-gnu-attribute-CFLAGS) 26 27before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin 28 29$(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c 30 $(filter-out $(no-gnu-attribute-CFLAGS),$(compile.c)) -o $(basename $@).o 31 $(OBJCOPY) --dump-section=.gnu.attributes=$@.tmp $(basename $@).o 32 mv $@.tmp $@ 33 34define after-link 35if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \ 36 echo "Replacing .gnu.attributes in $1"; \ 37 $(OBJCOPY) --update-section=.gnu.attributes=$(common-objpfx)no_ldbl_gnu_attribute.bin $1; \ 38fi 39endef 40 41# Ensure a .gnu.attributes section is present by building an ibm128 file with 42# -mgnu-attribute in both libm and libc shared libraries. Prior to GCC 11 this 43# section was implicitly included via static libgcc ibm128 routines. 44ifeq ($(subdir),math) 45$(objpfx)m_ldexpl.os: CFLAGS += -mgnu-attribute 46$(objpfx)s_ldexpl.os: CFLAGS += -mgnu-attribute 47endif 48 49endif # ifeq ($(build-shared),yes) 50endif # ifeq ($(ibm128-fcts),yes) 51 52# All _Float128 files should be built assuming an ibm128 long double. 53# Likewise, this avoids some old GCC 7 compiler bugs whereby calls 54# to __mulkc3 are swapped with __multc3, or worse. This is noted in 55# GCC BZ 84914, and marked as will-not-fix. 56type-float128-CFLAGS += $(type-ldouble-CFLAGS) 57 58ifeq ($(subdir),math) 59# sqrtf128 requires emulation before POWER9. 60CPPFLAGS += -I../soft-fp 61 62# float128 requires adding a handful of extra flags. 63# Similarly, disable 64$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 65$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 66$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += $(type-float128-CFLAGS) 67$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += $(type-float128-CFLAGS) 68# Pairs of types with _Float128 / _Float64x as the wider type but not 69# the narrower one. 70f128-pairs = float32-float64x float32-float128 float64-float64x \ 71 float64-float128 float32x-float64x float32x-float128 72$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += $(type-float128-CFLAGS) 73CFLAGS-libm-test-support-float128.c += $(type-float128-CFLAGS) 74CFLAGS-libm-test-support-float64x.c += $(type-float128-CFLAGS) 75CFLAGS-test-math-iscanonical.cc += $(type-float128-CFLAGS) 76CFLAGS-test-math-iseqsig.cc += $(type-float128-CFLAGS) 77CFLAGS-test-math-issignaling.cc += $(type-float128-CFLAGS) 78CFLAGS-test-math-iszero.cc += $(type-float128-CFLAGS) 79 80CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS) 81CFLAGS-s_logbl-ppc64.c += $(type-ldouble-CFLAGS) 82 83$(foreach suf,$(all-object-suffixes),\ 84 $(objpfx)s_copysignl$(suf) \ 85 $(objpfx)s_fabsl$(suf)): \ 86 ASFLAGS += $(type-ldouble-CFLAGS) 87 88$(foreach suf,$(all-object-suffixes),\ 89 $(objpfx)libm-test-%ibm128$(suf) \ 90 $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \ 91 CFLAGS += $(type-ldouble-CFLAGS) 92 93# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64 94$(foreach suf,$(all-object-suffixes),\ 95 $(objpfx)test-narrow-macros-ldbl-64$(suf) \ 96 $(objpfx)test-nldbl-redirect$(suf) \ 97 $(objpfx)test-redirection-ldbl-64$(suf) \ 98 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS)) 99 100endif 101 102# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64 103ifeq ($(subdir),misc) 104$(foreach suf,$(all-object-suffixes),\ 105 $(objpfx)tst-nldbl-warn$(suf) \ 106 $(objpfx)tst-nldbl-error$(suf) \ 107 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS)) 108endif 109 110# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64 111ifeq ($(subdir),argp) 112$(foreach suf,$(all-object-suffixes),\ 113 $(objpfx)tst-nldbl-argp$(suf) \ 114 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS)) 115endif 116 117 118# Append flags to string <-> _Float128 routines. 119ifneq ($(filter $(subdir),wcsmbs stdlib),) 120$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 121$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 122$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 123$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 124$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) 125CFLAGS-bug-strtod.c += $(type-float128-CFLAGS) 126CFLAGS-bug-strtod2.c += $(type-float128-CFLAGS) 127CFLAGS-tst-strtod-round.c += $(type-float128-CFLAGS) 128CFLAGS-tst-wcstod-round.c += $(type-float128-CFLAGS) 129CFLAGS-tst-strtod-nan-locale.c += $(type-float128-CFLAGS) 130CFLAGS-tst-wcstod-nan-locale.c += $(type-float128-CFLAGS) 131CFLAGS-tst-strtod6.c += $(type-float128-CFLAGS) 132CFLAGS-tst-strfrom.c += $(type-float128-CFLAGS) 133CFLAGS-tst-strfrom-locale.c += $(type-float128-CFLAGS) 134CFLAGS-strfrom-skeleton.c += $(type-float128-CFLAGS) 135CFLAGS-tst-strtod-nan-sign.c += $(type-float128-CFLAGS) 136CFLAGS-tst-wcstod-nan-sign.c += $(type-float128-CFLAGS) 137 138# When building glibc with support for _Float128, the powers of ten tables in 139# fpioconst.c and in the string conversion functions must be extended. Some 140# Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in 141# sysdeps. This is avoided with the use sysdep-CFLAGS instead of CFLAGS. 142sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F)) 143sysdep-CFLAGS-fpioconst.c += $(type-float128-CFLAGS) 144sysdep-CFLAGS-strtod_l.c += $(type-float128-CFLAGS) 145sysdep-CFLAGS-strtof_l.c += $(type-float128-CFLAGS) 146sysdep-CFLAGS-strtold_l.c += $(type-float128-CFLAGS) 147sysdep-CFLAGS-wcstod_l.c += $(type-float128-CFLAGS) 148sysdep-CFLAGS-wcstof_l.c += $(type-float128-CFLAGS) 149sysdep-CFLAGS-wcstold_l.c += $(type-float128-CFLAGS) 150 151# Build any ibm128 specific stdlib tests with ibm128 ABI. 152$(foreach suf,$(all-object-suffixes),%128ibm$(suf)): CFLAGS += $(type-ldouble-CFLAGS) 153endif 154 155# Append flags to printf routines. 156ifeq ($(subdir),stdio-common) 157CFLAGS-printf_fp.c = $(type-float128-CFLAGS) 158CFLAGS-printf_fphex.c = $(type-float128-CFLAGS) 159CFLAGS-printf_size.c = $(type-float128-CFLAGS) 160endif 161 162# Disable linker noise on files using ieee128 long double internally 163ifeq ($(subdir),time) 164CFLAGS-difftime.c += $(no-gnu-attribute-CFLAGS) 165endif 166 167$(foreach suf,$(all-object-suffixes),$(objpfx)nldbl-%$(suf)): \ 168 CFLAGS += $(type-ldouble-CFLAGS) 169 170ldbl-ibm128-files = $(objpfx)nldbl-%$(suf) \ 171 $(objpfx)libm-test-%ibm128$(suf) \ 172 $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf) \ 173 $(objpfx)test-tgmath3-%$(suf) 174 175# Remove -mabi=ieeelongdouble from ldbl-ibm128 files. 176$(foreach suf,$(all-object-suffixes), $(ldbl-ibm128-files)) \ 177 $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \ 178 $(objpfx)$(r)$(suf)): \ 179 sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS)) 180 181# TODO: a bug in stdc++ will fail if -mabi=ieeelongdouble and -mfloat128 182# are both enabled. The latter is enabled by default in GCC 8+. This is 183# tracked via GCC BZ 94080. 184ifeq ($(subdir),support) 185CFLAGS-links-dso-program.cc += -mno-float128 186endif 187ifeq ($(subdir),nptl) 188CFLAGS-tst-thread_local1.cc += -mno-float128 189CFLAGS-tst-minstack-throw.cc += -mno-float128 190endif 191 192ifeq ($(subdir),elf) 193$(objpfx)tst-glibc-hwcaps: \ 194 $(objpfx)libmarkermod2-1.so $(objpfx)libmarkermod3-1.so 195$(objpfx)tst-glibc-hwcaps.out: \ 196 $(objpfx)libmarkermod2.so \ 197 $(objpfx)glibc-hwcaps/power9/libmarkermod2.so \ 198 $(objpfx)libmarkermod3.so \ 199 $(objpfx)glibc-hwcaps/power9/libmarkermod3.so \ 200 $(objpfx)glibc-hwcaps/power10/libmarkermod3.so \ 201 202$(objpfx)glibc-hwcaps/power9/libmarkermod2.so: $(objpfx)libmarkermod2-2.so 203 $(make-target-directory) 204 cp $< $@ 205$(objpfx)glibc-hwcaps/power9/libmarkermod3.so: $(objpfx)libmarkermod3-2.so 206 $(make-target-directory) 207 cp $< $@ 208$(objpfx)glibc-hwcaps/power10/libmarkermod3.so: $(objpfx)libmarkermod3-3.so 209 $(make-target-directory) 210 cp $< $@ 211 212ifeq (no,$(build-hardcoded-path-in-tests)) 213# This is an ld.so.cache test, and RPATH/RUNPATH in the executable 214# interferes with its test objectives. 215tests-container += tst-glibc-hwcaps-cache 216endif 217 218endif # $(subdir) == elf 219