From patchwork Fri Mar 6 20:37:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38477 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 3870 invoked by alias); 6 Mar 2020 20:37:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3740 invoked by uid 89); 6 Mar 2020 20:37:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=narrower X-HELO: mx0a-001b2d01.pphosted.com From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Date: Fri, 6 Mar 2020 14:37:16 -0600 Message-Id: <20200306203721.15886-9-murphyp@linux.vnet.ibm.com> In-Reply-To: <20200306203721.15886-1-murphyp@linux.vnet.ibm.com> References: <20200306203721.15886-1-murphyp@linux.vnet.ibm.com> MIME-Version: 1.0 I have observed a bug on 7.4.0 whereby __mulkc3 calls are swapped with __multc3 depending on ABI selection. For the sake of being overly cautious, build all _Float128 files with ibm128 to workaround these compilers. Likewise, non-math files built with _Float128 are assumed to have ibm long double. Explicilty preserve this assumption. Finally, add some bootstrapping code to avoid applying these options until IEEE long double is enabled as they require GCC 7 and above. --- sysdeps/powerpc/powerpc64/le/Makefile | 90 ++++++++++--------- .../powerpc64/le/fpu/multiarch/Makefile | 4 +- 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile index f9dd44c1a2..8c92331b4d 100644 --- a/sysdeps/powerpc/powerpc64/le/Makefile +++ b/sysdeps/powerpc/powerpc64/le/Makefile @@ -1,5 +1,6 @@ # When building float128 we need to ensure -mfloat128 is # passed to all such object files. +type-float128-CFLAGS := -mfloat128 # libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built with # a binary128 type. That symbol is provided by the loader on dynamically @@ -16,29 +17,34 @@ type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS) no-gnu-attribute-CFLAGS = -mno-gnu-attribute endif +# All _Float128 files should be built assuming an ibm128 long double. +# Likewise, this avoids some old GCC 7 compiler bugs whereby calls +# to __mulkc3 are swapped with __multc3, or worse. +type-float128-CFLAGS += $(type-ldouble-CFLAGS) + ifeq ($(subdir),math) # sqrtf128 requires emulation before POWER9. CPPFLAGS += -I../soft-fp # float128 requires adding a handful of extra flags. # Similarly, disable -$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128 -$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += -mfloat128 -$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128 -$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf)): CFLAGS += -mfloat128 +$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += $(type-float128-CFLAGS) +$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += $(type-float128-CFLAGS) +$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += $(type-float128-CFLAGS) +$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf)): CFLAGS += $(type-float128-CFLAGS) # Pairs of types with _Float128 / _Float64x as the wider type but not # the narrower one. f128-pairs = float32-float64x float32-float128 float64-float64x \ float64-float128 float32x-float64x float32x-float128 -$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += -mfloat128 -CFLAGS-libm-test-support-float128.c += -mfloat128 -CFLAGS-libm-test-support-float64x.c += -mfloat128 -CFLAGS-test-math-iscanonical.cc += -mfloat128 -CFLAGS-test-math-iseqsig.cc += -mfloat128 -CFLAGS-test-math-issignaling.cc += -mfloat128 -CFLAGS-test-math-iszero.cc += -mfloat128 +$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += $(type-float128-CFLAGS) +CFLAGS-libm-test-support-float128.c += $(type-float128-CFLAGS) +CFLAGS-libm-test-support-float64x.c += $(type-float128-CFLAGS) +CFLAGS-test-math-iscanonical.cc += $(type-float128-CFLAGS) +CFLAGS-test-math-iseqsig.cc += $(type-float128-CFLAGS) +CFLAGS-test-math-issignaling.cc += $(type-float128-CFLAGS) +CFLAGS-test-math-iszero.cc += $(type-float128-CFLAGS) $(foreach test,\ basic-test \ bug-nextafter \ @@ -101,25 +107,26 @@ $(foreach suf,$(all-object-suffixes),\ ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS)) endif + # Append flags to string <-> _Float128 routines. ifneq ($(filter $(subdir),wcsmbs stdlib),) -$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS) -CFLAGS-bug-strtod.c += -mfloat128 -CFLAGS-bug-strtod2.c += -mfloat128 -CFLAGS-tst-strtod-round.c += -mfloat128 -CFLAGS-tst-wcstod-round.c += -mfloat128 -CFLAGS-tst-strtod-nan-locale.c += -mfloat128 -CFLAGS-tst-wcstod-nan-locale.c += -mfloat128 -CFLAGS-tst-strtod6.c += -mfloat128 -CFLAGS-tst-strfrom.c += -mfloat128 -CFLAGS-tst-strfrom-locale.c += -mfloat128 -CFLAGS-strfrom-skeleton.c += -mfloat128 -CFLAGS-tst-strtod-nan-sign.c += -mfloat128 -CFLAGS-tst-wcstod-nan-sign.c += -mfloat128 +$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) +CFLAGS-bug-strtod.c += $(type-float128-CFLAGS) +CFLAGS-bug-strtod2.c += $(type-float128-CFLAGS) +CFLAGS-tst-strtod-round.c += $(type-float128-CFLAGS) +CFLAGS-tst-wcstod-round.c += $(type-float128-CFLAGS) +CFLAGS-tst-strtod-nan-locale.c += $(type-float128-CFLAGS) +CFLAGS-tst-wcstod-nan-locale.c += $(type-float128-CFLAGS) +CFLAGS-tst-strtod6.c += $(type-float128-CFLAGS) +CFLAGS-tst-strfrom.c += $(type-float128-CFLAGS) +CFLAGS-tst-strfrom-locale.c += $(type-float128-CFLAGS) +CFLAGS-strfrom-skeleton.c += $(type-float128-CFLAGS) +CFLAGS-tst-strtod-nan-sign.c += $(type-float128-CFLAGS) +CFLAGS-tst-wcstod-nan-sign.c += $(type-float128-CFLAGS) $(foreach test, \ bug-strtod \ @@ -143,20 +150,23 @@ $(foreach test, \ # Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in # sysdeps. This is avoided with the use sysdep-CFLAGS instead of CFLAGS. sysdep-CFLAGS += $(sysdep-CFLAGS-$(