From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 8C561385840C for ; Mon, 15 Jan 2024 12:52:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C561385840C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=mwa.re Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mwa.re ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8C561385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705323177; cv=none; b=basihGM+7IH3sbdL1BjGq5agleKYuS911hkhyFytGFjIO3PUhFi/w/C3nPniI6EraG59JS2cw0bj6lvgWPirAzQuBrEIc145xerO6sWR9ZjXff3SXkJHkB6qKcIpMeOvJFwAsB9IAbV8OtfGyPjiwmeI3VBemrp4M/f756Q8l0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705323177; c=relaxed/simple; bh=6Y/HEB8adVoleLjjxN6f5iSg95UqHdmT3n5c9CTf5bg=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=CDVVD5QxAasHBBXSprzeGPsbXq88+91X646wEHglHjobGEre56hWiC/GRjZW8DQpX/klJBiSuavMgbLarTONWGjtwYPZpms9dTI1ukZxJbhYuGu63XCrYSGCDpW5bggIGyo01b3Kxw+SyCYU5H/yjiGOGygCacMss4XaX4goUk4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40e80046263so2391835e9.2 for ; Mon, 15 Jan 2024 04:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mwa.re; s=google; t=1705323174; x=1705927974; darn=sourceware.org; h=mime-version:user-agent:content-transfer-encoding:date:cc:to:from :subject:message-id:from:to:cc:subject:date:message-id:reply-to; bh=6Y/HEB8adVoleLjjxN6f5iSg95UqHdmT3n5c9CTf5bg=; b=H9LLOp9JrTOwbAhlDL87VpOH8Ai/kPogktyVydAn2hm3Pn4aXum+xFgKAYttRYyO71 776Af6JecgXwNGL715gfYAPl8Ot1TLguvZPb7xazxxEJsMXr0V9FCY3ZPGWyeDDUjESO 3MFYCGzX6tOwAxGdeFBGmiJ3vKukKh8MVsdCWBNN2C4DSDneuOUjex6Iy3GTepQBxY72 Bcu9Ea8Ml2uhyyUrdNZ18X1moXubpFr/KmeC+XK0OnoDSZXYF89Ve62oDfrg5XtDpOnX +SqvBDpIn1jL2J/8QA+JsL2ryn2bKHWpciCtb2gb8lvasha+mRT24DRX8vqkKCuqOfW5 FBIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705323174; x=1705927974; h=mime-version:user-agent:content-transfer-encoding:date:cc:to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6Y/HEB8adVoleLjjxN6f5iSg95UqHdmT3n5c9CTf5bg=; b=laMwJ4IW77DATBHaW8wl/OQQj+G1pIPfJr1HfEuhLIpa2fMA9L+TQN36vwgvWZlxuY qiqgTmaebcRS+IeJ8EXdhsHuR8eJdWVC9In57kNjrcA/Mib9wWLct2HK09BsTkhTSEJa kcfzVcI8Ss0Hy+WwDwz/y9vOOQDFoDT7pJY+MDHvRYngBKtng8LPpTRfWDkNHoj9uPxb MvWDg5vjJMi7iJZwCxQO+jCT7yIGtv6mHgm9w/CkN5S2rgbx2Cwu3P/T+/KyWJAnzz3V LAempqv1j4JURlcAeT+PB/nQC40E/xsq/XpuWLLjTm+Jca3RPyIbBoJOotq7OOeGDGpx WSCA== X-Gm-Message-State: AOJu0YyaZrlVbeO4tSzA/2ECA/mpI1MQF6qRPaD8yzCITEDRl5HcySn3 ncfaaZbFpOFStqSgtGE0ohGBg1HuVOUN5shFVb/J0HeS5X0= X-Google-Smtp-Source: AGHT+IFn+v56VQuIUdlwMj5wJUXwsdgJceCdnpyzsLqZvN6YNmcTllAK1egVPuNbLO9q7MfXA71PzA== X-Received: by 2002:a05:600c:4d1e:b0:40d:7fbe:e966 with SMTP id u30-20020a05600c4d1e00b0040d7fbee966mr2887609wmp.40.1705323173936; Mon, 15 Jan 2024 04:52:53 -0800 (PST) Received: from electron.fritz.box ([2a0a:a549:33a5:0:44e2:8957:612:a313]) by smtp.gmail.com with ESMTPSA id m26-20020a7bca5a000000b0040e54381a85sm15374156wml.26.2024.01.15.04.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 04:52:53 -0800 (PST) Message-ID: Subject: 64 bit time_t on riscv32 From: Antonios Salios To: libc-help@sourceware.org Cc: Jan Henrik Weinstock , Lukas =?ISO-8859-1?Q?J=FCnger?= Date: Mon, 15 Jan 2024 13:52:52 +0100 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi all! I'm having trouble with timestamps that are sent by the Linux evdev interface to userspace applications (such as evtest). I am using a virtualized riscv32 environment built by Buildroot with glibc 2.37. The kernel and userspace do not agree on how to define the timestamps. The values should be 32-bit, so the kernel uses custom 32-bit __sec & __usec variables instead of a timeval struct. Userspace, on the other hand, wants to use a timeval struct, that uses 64-bit time_t on rv32. The struct in question (input_event) can be found here [1]. According to a kernel maintainer, the __USE_TIME_BITS64 macro should be set on architectures that use 64-bit time [2], otherwise the kernel headers will not be able to pick the correct definition.=20 When I define __USE_TIME_BITS64 manually, the compiler (gcc 13.2) does not recognize the __time64_t type: `unknown type name '__time64_t'`. This is fixed by also defining __LIBC [3], although I'm not sure why this is necessary. However, the preprocessor will then pick the correct definition of the input_event struct. But now the linker cannot find the reference to __ioctl_time64 (and __select64) because it is only defined (as an alias) when __TIMESIZE !=3D 64 [4], which is not the case on rv32. What am I missing? Kind regards [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/inclu= de/uapi/linux/input.h?h=3Dv6.5.6#n28 [2] https://lore.kernel.org/lkml/1a528414-f193-4ac0-a911-af426bb48d64@app.fastm= ail.com/ [3] https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob;f=3Dposix/bits/types.h;h= b=3Dglibc-2.37#l220 [4] https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob;f=3Dsysdeps/unix/sysv/li= nux/ioctl.c;hb=3Dglibc-2.37#l48 --=20 Antonios Salios Software Engineer MachineWare GmbH | www.machineware.de H=C3=BChnermarkt 19, 52062 Aachen, Germany Amtsgericht Aachen HRB25734 Gesch=C3=A4ftsf=C3=BChrung Lukas J=C3=BCnger Dr.-Ing. Jan Henrik Weinstock