For lack of a more comprehensive solution, tack on the ibm128 ABI
compiler options for the totalorder{,mag}l compat tests which exist
prior to enabling this feature.
$(objpfx)test-strfrom-ieee128: gnulib-tests += $(f128-loader-link)
endif
+ifeq ($(subdir),math)
+# The totalorder{,mag} compatibility tests were added prior to this
+# support. Thus, they can only correctly be used with ibm128.
+CFLAGS-test-ldouble-compat_totalorder.c += -mabi=ibmlongdouble
+CFLAGS-test-ldouble-compat_totalordermag.c += -mabi=ibmlongdouble
+CFLAGS-test-ildouble-compat_totalorder.c += -mabi=ibmlongdouble
+CFLAGS-test-ildouble-compat_totalordermag.c += -mabi=ibmlongdouble
+endif
+
# Add IEEE binary128 files as make targets.
routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))