This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
- From: Vineet Gupta <vineetg76 at gmail dot com>
- To: Alistair Francis <alistair23 at gmail dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Arnd Bergmann <arnd at arndb dot de>, Palmer Dabbelt <palmerdabbelt at google dot com>, Zong Li <zongbox at gmail dot com>, Alistair Francis <alistair dot francis at wdc dot com>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, "Maciej W. Rozycki" <macro at wdc dot com>, arcml <linux-snps-arc at lists dot infradead dot org>, Joseph Myers <joseph at codesourcery dot com>
- Date: Tue, 11 Feb 2020 17:42:37 -0800
- Subject: Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
- References: <cover.1578824547.git.alistair.francis@wdc.com> <4e95f95966d8d7c6a8339160dc62d81c1f6a1bfb.1578824547.git.alistair.francis@wdc.com> <00574bfb-981a-3a1c-cbdf-b2fee4eddc32@gmail.com> <CAKmqyKMyf2psPp+-EHoidvbPbSXv0=dP26GjVQnT5BUriLc1gA@mail.gmail.com>
On 2/11/20 4:14 PM, Alistair Francis wrote:
> On Tue, Feb 11, 2020 at 4:14 PM Vineet Gupta <vineetg76@gmail.com> wrote:
>>> diff --git a/sysdeps/unix/sysv/linux/riscv/bits/typesizes.h b/sysdeps/unix/sysv/linux/riscv/bits/typesizes.h
>>> new file mode 100644
>>> index 0000000000..0da3bdeb5d
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/riscv/bits/typesizes.h
>>
>> I was hoping newer arches could simply use the asm-generic one ?
>
> We need to specify that RV32 uses a 64-bit time_t. The generic ones
> don't do that for 32-bit arches.
Right. It pains to see that each new port (despite using asm-generic syscall ABI)
will have to make their own copy of something so fundamental as typesizes.h where
only a few things will change. The generic file is no longer generic :-(
Oh well !
>>> +/* Tell the libc code that off_t and off64_t are actually the same type
>>> + for all ABI purposes, even if possibly expressed as different base types
>>> + for C type-checking purposes. */
>>> +# define __OFF_T_MATCHES_OFF64_T 1
>>
>> This is orthogonal to time_t but since we are on topic of newer ports, how are you
>> doing this. The asm-generic uapi defines
>>
>> typedef __kernel_long_t __kernel_off_t;
>>
>> and types.h defines
>>
>> typedef __kernel_off_t off_t;
>>
>> And I presume long on RV32 is 32-bits
>
> Can you point me to the code? Last time I looked the kernel used the
> 64-bit versions for the syscalls on RV32.
You are right. I got confused with the types above: asm-generic syscalls on 32-bit
arches use struct stat64 etc which has 64-bit inode. Similarly sys_llseek uses
low/high parts for offset.
>>> +/* Same for ino_t and ino64_t. */
>>> +# define __INO_T_MATCHES_INO64_T 1
I'm surprised that ARC port doesn't define this in glibc, yet we use the
asm-generic syscall interface where this is true. I need to investigate more.
Thx,
-vineet