public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	GLIBC patches <libc-alpha@sourceware.org>
Subject: Re: [PATCH v3 18/24] y2038: Add support for 64-bit time on legacy ABIs
Date: Thu, 14 Oct 2021 06:50:40 +0900	[thread overview]
Message-ID: <YWdUsFyyTYkPdxqo@antec> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2110132043310.4099675@digraph.polyomino.org.uk>

On Wed, Oct 13, 2021 at 08:47:39PM +0000, Joseph Myers wrote:
> On Wed, 13 Oct 2021, Stafford Horne via Libc-alpha wrote:
> 
> > Now, I am trying to build with
> > CFLAGS="-g -Og -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64",
> > but this is causing build failures.
> 
> glibc can't be built with those options.  All the setup for building 
> functions with the correct names and aliases assumes that those macros are 
> not defined when building glibc itself; defining them will cause function 
> redirections that are only appropriate for user applications, not for 
> building glibc itself.

OK, thank's for the clarification I missed that part of the documentation.

But that explains all of the build failures.

> > > +@item
> > > +@code{_TIME_BITS=64} and port from the outset uses 64-bit
> > > +@code{time_t} and word size equals to @w{32 bits} (e.g. ARC, RV32)
> > > +- no action
> > 
> > OpenRISC falls into this category.  We have 64-bit support but word size is
> > 32 bits.
> > 
> > What does "no action" mean here? Does it mean as long as I set _TIME_BITS=64
> > no extra porting effort is needed?
> 
> "no action" means _TIME_BITS does nothing and the user gets 64-bit time 
> regardless.
> 
> As with any port, the architecture-specific files need to be set up 
> appropriately for the choices made by the port, and new ports may 
> sometimes encounter issues in architecture-independent files for ports not 
> needing various kinds of compatibility.

OK, this makes sense now.  Its a bit confusing saying _TIME_BITS=64, because
_TIME_BITS does not have to be defined at all.  Let me read the docs again maybe
there is a patch in there to help clarify for the next reader too.

> > Is this correct? We only use __USE_TIME_BITS64 on machines where
> > __TIMESIZE==32?
> 
> The purpose of __USE_TIME_BITS64 is to enable header redirections to 
> different function names on systems that support both 32-bit and 64-bit 
> time_t.

I see, thats a much more clear explaination.

> For an architecture that only supports 64-bit time_t, no such redirections 
> should ever be in effect and no separate function names for 64-bit time_t 
> should exist, so __USE_TIME_BITS64 should not be defined.  OpenRISC should 
> be just like x86_64 in this regard.

OK, makes sense.

Thanks for clarifying, I am still having the issue with struct timex using
__USE_TIME_BITS64 and choosing a 32-bit implementation.

I think I can go over all of the code again and add some clarifications via
comments and doc's, then I will probably understand enough to know the right
approach to fix the timex issue.

Just for reference/brain dump, sysdeps/unix/sysv/linux/bits/timex.h defines:

    struct timex {
    # ifdef __USE_TIME_BITS64
    ...
       long long offset;
    ...
    # else
    ...
       __syscall_slong_t offset;
    ...
    # endif

For the above on openrisc I need offset (and other fields) to be 64-bit.

But there are 2 problems:
  1. __syscall_slong_t is 32-bit
  2. __USE_TIME_BITS64 is not defined for openrisc (as per above)

So options:
  1. Use a different type other __syscall_slong_t, i.e. time_t
  2. Use a different macro other than __USE_TIME_BITS64

Timex is defined 3 times:
  - 2 times          (external) sysdeps/unix/sysv/linux/bits/timex.h
  - 1 time __timex64 (internal) sysdeps/unix/sysv/linux/include/sys/timex.h

-Stafford

  reply	other threads:[~2021-10-13 21:50 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 20:35 [PATCH v3 00/24] Add 64 bit time support " Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 01/24] linux: mips: Split librt.abilist in n32 and n64 Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 02/24] linux: mips: Split libanl.abilist " Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 03/24] linux: s390: Add libanl.abilist in s390 and s390x Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 04/24] linux: Add fallback for 64-bit time_t SO_{RCV, SND}TIMEO Adhemerval Zanella
2021-06-14 14:52   ` [PATCH v3 04/24] linux: Add fallback for 64-bit time_t SO_{RCV,SND}TIMEO Carlos O'Donell
2021-06-07 20:35 ` [PATCH v3 05/24] linux: Add fallback for 64-bit time_t SO_TIMESTAMP{NS} Adhemerval Zanella
2021-06-25 15:20   ` Florian Weimer
2021-06-25 18:11     ` Adhemerval Zanella
2021-06-25 19:16       ` Florian Weimer
2021-06-28 13:36         ` Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 06/24] linux: Add recvvmsg " Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 07/24] y2038: Add __USE_TIME_BITS64 support for time_t Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 08/24] y2038: Add __USE_TIME_BITS64 support for struct timeval Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 09/24] y2038: Add __USE_TIME_BITS64 support for struct timespec Adhemerval Zanella
2021-06-07 20:35 ` [PATCH v3 10/24] y2038: Add __USE_TIME_BITS64 support for struct utimbuf Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 11/24] y2038: linux: Add __USE_TIME_BITS64 support for struct timex Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 12/24] y2038: Use a common definition for stat Adhemerval Zanella
2021-06-14 14:52   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 13/24] y2038: Use a common definition for msqid_ds Adhemerval Zanella
2021-06-14 14:52   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 14/24] y2038: Use a common definition for semid_ds Adhemerval Zanella
2021-06-14 14:52   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 15/24] y2038: Use a common definition for shmid_ds Adhemerval Zanella
2021-06-14 14:59   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 16/24] y2038: Add __USE_TIME_BITS64 support for socket-constants.h Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 17/24] time: Add 64-bit time support for getdate Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 18/24] y2038: Add support for 64-bit time on legacy ABIs Adhemerval Zanella
2021-10-13 11:44   ` Stafford Horne
2021-10-13 16:45     ` Paul Eggert
2021-10-13 21:51       ` Stafford Horne
2021-10-13 20:47     ` Joseph Myers
2021-10-13 21:50       ` Stafford Horne [this message]
2021-06-07 20:36 ` [PATCH v3 19/24] posix: Add glob64 with 64-bit time_t support Adhemerval Zanella
2021-06-14 14:52   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 20/24] io: Add fts64 " Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 21/24] io: Add ftw64 " Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 22/24] libsupport: Add 64-bit time_t support for time functions Adhemerval Zanella
2021-06-14 14:52   ` Carlos O'Donell
2021-06-07 20:36 ` [PATCH v3 23/24] libsupport: Add 64-bit time_t support for stat functions Adhemerval Zanella
2021-06-07 20:36 ` [PATCH v3 24/24] y2038: Add test coverage Adhemerval Zanella

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=YWdUsFyyTYkPdxqo@antec \
    --to=shorne@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@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).