From patchwork Sat Jul 20 14:23:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Chestnykh X-Patchwork-Id: 1962778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=MpxG5FdE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WR7yd65n1z1yYm for ; Sun, 21 Jul 2024 00:21:43 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 097C33521196; Sat, 20 Jul 2024 16:21:35 +0200 (CEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=MpxG5FdE; dkim-atps=neutral Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by helium.openadk.org (Postfix) with ESMTPS id CA5B1352118A for ; Sat, 20 Jul 2024 16:21:29 +0200 (CEST) Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2ef260c4467so280651fa.0 for ; Sat, 20 Jul 2024 07:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721485288; x=1722090088; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HOdXvonDNcvdac8yjdiNPqd/5yRvb1bgY5yzGVPvyFE=; b=MpxG5FdEinef7/MVW8MPY3UZFHjal3oIrcwWUT1sCz0nbfwr2XyKvSEoI3gKkZXvkN rX3CQRtW/4JcuLrTsvb4NY7VelqHNlnUm9qFG+R3CVW+/018cTn51AcdRg0yX2rNw/U+ jvRsD8vUtnofHlxtbnLbMJt8GQBSvM3UKiOQ8AJaT6Hlk+dNYXklj7S0hLFDOhYNfqjy tHzIoSp1Cwc0oUxUXpKgODNYtmAGPufzYftrQE4W5Cu8yE6SPOPP9Bh97eRuaXLnzN0v 401rVJOm8WMvTXhaZDhWbUAA277aJZYghcltfSHLv4DKmtSTPV68lYn83iDQJy93zxWr mxfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721485288; x=1722090088; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HOdXvonDNcvdac8yjdiNPqd/5yRvb1bgY5yzGVPvyFE=; b=Xh/LkHJ06Fo3/cNhvZu9mCWPv+d9Qff9/0Qz+XvL3YFmUfhnf0CrxQmX8H/tWKQEj9 2+OLpZkArchNgon8g8cC9o6BL3HIJLniRARGRJwWd7exVwKeXNwntdOKRS/S0tY/FrU1 YtpmuteJs/zdr86MStgnVTxdt2KSFLZ+kBVz03gZsJ3Isy3ropU1wG41j0j9gcB14vps QRNyPEIUZ8i00WvZw9Dm5HYD08E5t7ptVE6AEFFketyVryXZ9s9ezdAy8iDfSkyE4fCV wRwUsuGtciKTBk1ove0MFaFjJclcAre7lSc5y26LqlsqRyybM5SvpkvRG8zvYFOe3v9n MifA== X-Gm-Message-State: AOJu0YyGtVqatMWzyB0pFZUescizV/8ZmQbIfgYxRdSUaw5PJk7VwAAP GkuKrWnQvqqE3aWQdUlFE9EGYrDd+Z7VyKROlrgOP+R4dmw5nOPcjzvgcQ== X-Google-Smtp-Source: AGHT+IHY0xnE3m8e+Oos/zTcK1vA3wIWnyA/4dqkhb3oxSdV3KatFcwDhXK7E9EGZzU2ZitQ1z4TRQ== X-Received: by 2002:a05:6512:401b:b0:52e:fb8b:32d0 with SMTP id 2adb3069b0e04-52efb8b33e1mr403415e87.1.1721485288226; Sat, 20 Jul 2024 07:21:28 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:817a:c099:6a41:454e:31cd:c80b]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ef552c4ffsm527861e87.20.2024.07.20.07.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jul 2024 07:21:27 -0700 (PDT) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Sat, 20 Jul 2024 17:23:45 +0300 Message-ID: <20240720142345.773848-1-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Message-ID-Hash: ZRVUQ7UCQ6ZNDW7BEIWPQRMDYWJC3DYB X-Message-ID-Hash: ZRVUQ7UCQ6ZNDW7BEIWPQRMDYWJC3DYB X-MailFrom: dm.chestnykh@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Dmitry Chestnykh X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH v2] [sh4] Fix sh4 compilation with 4.x kernel headers List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - Fallback to __NR_stat syscall in ld.so if we use 4.x kernel headers. 4.x kernel doesn't support 64-bit time so we can use old syscall - Add preprocessor conditions to have fstat64 and fstatat64 in libc with old kernel headers Signed-off-by: Dmitry Chestnykh --- ldso/include/dl-syscall.h | 4 +++- libc/sysdeps/linux/common/fstat64.c | 3 ++- libc/sysdeps/linux/common/fstatat64.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 4f41034ad..9ec0eac60 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -17,6 +17,8 @@ extern int _dl_errno; #define __set_errno(X) {(_dl_errno) = (X);} #endif +#include + /* Pull in the arch specific syscall implementation */ #include /* For MAP_ANONYMOUS -- differs between platforms */ @@ -139,7 +141,7 @@ static __always_inline int _dl_stat(const char *file_name, { return _dl_newfstatat(AT_FDCWD, file_name, buf, 0); } -#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__)) +#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__)) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) # define __NR__dl_stat __NR_stat static __always_inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf) diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 359c22af6..121b21fc8 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -8,8 +8,9 @@ #include <_lfs_64.h> #include +#include -#if defined(__NR_fstat64) && !defined(__UCLIBC_USE_TIME64__) +#if defined(__NR_fstat64) && (!defined(__UCLIBC_USE_TIME64__) || LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) # include # include # include "xstatconv.h" diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c index 16dbf9215..739e84081 100644 --- a/libc/sysdeps/linux/common/fstatat64.c +++ b/libc/sysdeps/linux/common/fstatat64.c @@ -9,6 +9,7 @@ #include <_lfs_64.h> #include #include +#include #if defined __mips__ # include @@ -23,7 +24,7 @@ # define __NR_fstatat64 __NR_newfstatat #endif -#if defined(__NR_fstatat64) && !defined(__UCLIBC_USE_TIME64__) +#if defined(__NR_fstatat64) && (!defined(__UCLIBC_USE_TIME64__) || LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) # include # include "xstatconv.h" int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)