about summary refs log tree commit diff
path: root/support/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-07-13 16:15:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-07-14 04:42:58 -0700
commitf896fc0f2bfc9f3f8df0563a7c99dcbf24bab655 (patch)
treec141461a47a577e88373c197e10e3c7cbf5a6caa /support/Makefile
parent5500cdba4018ddbda7909bc7f4f9718610b43cf0 (diff)
downloadglibc-f896fc0f2bfc9f3f8df0563a7c99dcbf24bab655.tar.gz
glibc-f896fc0f2bfc9f3f8df0563a7c99dcbf24bab655.tar.xz
glibc-f896fc0f2bfc9f3f8df0563a7c99dcbf24bab655.zip
Correct timespec implementation [BZ #26232]
commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f
Author: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
Date:   Fri Jul 10 19:41:06 2020 -0300

    Fix time/tst-cpuclock1 intermitent failures

has 2 issues:

1. It assumes time_t == long which is false on x32.
2. tst-timespec.c is compiled without -fexcess-precision=standard which
generates incorrect results on i686 in support_timespec_check_in_range:

  double ratio = (double)observed_norm / expected_norm;
  return (lower_bound <= ratio && ratio <= upper_bound);

This patch does

1. Compile tst-timespec.c with -fexcess-precision=standard.
2. Replace long with time_t.
3. Replace LONG_MIN and LONG_MAX with TYPE_MINIMUM (time_t) and
TYPE_MAXIMUM (time_t).
Diffstat (limited to 'support/Makefile')
-rw-r--r--support/Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/support/Makefile b/support/Makefile
index e74e0dd519..93faafddf9 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -196,6 +196,13 @@ CFLAGS-support_paths.c = \
 		-DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
 		-DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
 
+# In support_timespec_check_in_range we may be passed a very tight
+# range for which we should produce a correct result for expected
+# being withing the observed range.  The code uses double internally
+# in support_timespec_check_in_range and for that computation we use
+# -fexcess-precision=standard.
+CFLAGS-timespec.c += -fexcess-precision=standard
+
 ifeq (,$(CXX))
 LINKS_DSO_PROGRAM = links-dso-program-c
 else