public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 2
Date: Thu, 13 Sep 2018 15:58:00 -0000	[thread overview]
Message-ID: <20180913155834.70934.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e3ddbeb84c36e3bf6aec7a70be9c2ed8ad6ef9bd

commit e3ddbeb84c36e3bf6aec7a70be9c2ed8ad6ef9bd
Author: Hans-Peter Nilsson <hp@bitrange.com>
Date:   Thu Sep 13 17:48:48 2018 +0200

    Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 2
    
    It's been a while...  I see the CRIS port broke with the
    time_t-default-to-64-bit change, observable by a few test-cases in the gcc
    fortran(!) tests failing, regressing when trying a recent newlib.
    
    This is a two-part belt-and-suspenders change: adjust the CRIS port
    gettimeofday syscall (the only one in newlib/CRIS passing a time_t or
    struct timeval) to handle a userspace 64-bit time_t and secondly default
    time_t to 32-bit long anyway.  I considered making the local
    "kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t
    being 64 bits, but thought it not worth bothering with the few move insns.
    The effect of a 64-bit time_t is however observable as longer simulation
    time when running the gcc testsuite and as bigger binaries without any
    actual upside from the larger time_t size, so I thought better make the
    default for this port go back to being a "long" again.
    
    Tested by running the gcc testsuite over the three combinations of two
    parts of the patch and observing the expected changes.  Committed.
    
    newlib:
    	* configure.host (cris, crisv32): Default to "long" time_t.
    
    Signed-off-by: Hans-Peter Nilsson <hp@axis.com>

Diff:
---
 newlib/configure.host | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/newlib/configure.host b/newlib/configure.host
index 7e9336a..c5b7734 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -135,6 +135,12 @@ case "${host_cpu}" in
 	machine_dir=cr16
        ;;
   cris | crisv32)
+	# The size of the (kernel_)time_t passed from or to a
+	# simulator or a Linux kernel is mandated by the
+	# gettimeofday and time system calls and fixed to 32 bits, the
+	# size of a long.  Instead of churning as 64 bits what is anyway
+	# 32 bits, it makes more sense to default to long.
+	test -z "${enable_newlib_long_time_t}" && newlib_long_time_t=yes
 	machine_dir=cris
 	;;
   crx*)


                 reply	other threads:[~2018-09-13 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180913155834.70934.qmail@sourceware.org \
    --to=hp@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).