From patchwork Tue Apr 16 05:37:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Chestnykh X-Patchwork-Id: 1923992 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=VkG4NlXm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (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 4VJXqD5FzTz1yZh for ; Tue, 16 Apr 2024 15:37:10 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 801AD3528287; Tue, 16 Apr 2024 07:36:58 +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=VkG4NlXm; dkim-atps=neutral Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by helium.openadk.org (Postfix) with ESMTPS id 4A3C43521167 for ; Tue, 16 Apr 2024 07:36:16 +0200 (CEST) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-516ced2f94cso1444670e87.1 for ; Mon, 15 Apr 2024 22:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713245775; x=1713850575; 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=o5z1p30SNm9zm5GLEmTczz03R/ceHcGg8S3w+cG+/Qo=; b=VkG4NlXmVbbfmdz4eBYkSDJhY6tX+yh3Z7sZWwQq9Aa1hgb7lmW0ZjVz8uE6CvjRph 9q9IeLiG3KbYlUK7zxtXiPk8oCOTwQSgqtV5FuG+TNo5FZvtmhfZizDXHUfmsKz9A4J0 Cw9YXZ88TwbnyENdK2PctVf59Wb4ukYHjBMFYHVGVTT/XktoXUSwp1RqymfX6fz33dnI vAySo6MFt+qIn+EUmOEvnf43NRPIdfuoH/HJFl+d1auuL2lgYOKERW/94KwJ9Po39UP+ en+BqV6l/DA4AnQkBIxUnHneiH0xI/iRw0EfbF+WtCkYm/eudtLxXKY16PE88PU7vaRZ 59sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713245775; x=1713850575; 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=o5z1p30SNm9zm5GLEmTczz03R/ceHcGg8S3w+cG+/Qo=; b=DqOfY6oy9z/GVrkKtZNuZYdrJXs6iyVEvKWKsSAnKkRj2haQQ0NJ47Yu8pxXW7/GOn fSeleDbrohK8T5T7ATxh4rBEjDPe/LgLoYK4xjRtxPEexLP8Te4UI4GJwr1oes6JbKDk IPnjuD6ODeX9C1bp2+1xqNBHE3JwosFwtNbJnM/qVWp9t3CqwhkMgdxoCYDIZyf9+OHQ qgzuIx2647Pg8jSCd5zg9yJhidB4PVNw+mUN6xFs4wnbiWyG6E/xZz3zTyC6GL+1dh2o C8Ob+j+PSwsaYNVyYTV8ms4pMCyhiqDVjMm92SMf54x19pYpSvrnqgBzsvd4eeouFLt2 dTww== X-Gm-Message-State: AOJu0Yw7ah2OgEd/27Zl+qMS/kx1crQuqVKKsij+itVKKYczoL1OFzLy bIOguBXU3j4GJiUjtC3eqU2SWDe+QQPkje4NkDfGscg10YQkhfIt3Y0PEg== X-Google-Smtp-Source: AGHT+IGQF90TyT3ZwkqXjSOBh1aiiofNfilAYp83fKz2chmr2ga2VFljZRJiEy+dIIKJBP6id6LHPg== X-Received: by 2002:a19:9157:0:b0:517:5434:5345 with SMTP id y23-20020a199157000000b0051754345345mr7300491lfj.2.1713245774605; Mon, 15 Apr 2024 22:36:14 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:817a:d2b8:b7de:6cff:8d95:8d3b]) by smtp.gmail.com with ESMTPSA id v15-20020a056512048f00b00516c9a8120asm1471581lfq.226.2024.04.15.22.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 22:36:14 -0700 (PDT) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Tue, 16 Apr 2024 08:37:15 +0300 Message-ID: <20240416053716.874210-1-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Message-ID-Hash: 6O7SIUHPPJAK7WOCAB5LENXKPQOZEEKL X-Message-ID-Hash: 6O7SIUHPPJAK7WOCAB5LENXKPQOZEEKL 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 1/2] Generalize vDSO code. List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - Add macroses for vDSO functions names because in some architectures these names differ from the default ones. - Add header guards in dl-syscalls.h . Signed-off-by: Dmitry Chestnykh --- ldso/ldso/arm/dl-syscalls.h | 8 +++++++- ldso/ldso/dl-vdso.c | 14 +++++++++++--- ldso/ldso/mips/dl-syscalls.h | 8 +++++++- ldso/ldso/x86_64/dl-syscalls.h | 8 +++++++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h index 5cbb94d30..5f6f7a883 100644 --- a/ldso/ldso/arm/dl-syscalls.h +++ b/ldso/ldso/arm/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */ +#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) #include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __arm_vdso_gettimeofday(struct timeval *tv, __ #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __arm_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __arm_vdso_clock_gettime(clock_id, tp) -#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + diff --git a/ldso/ldso/dl-vdso.c b/ldso/ldso/dl-vdso.c index c23fd8b72..196cbbb3b 100755 --- a/ldso/ldso/dl-vdso.c +++ b/ldso/ldso/dl-vdso.c @@ -3,6 +3,14 @@ #include #include "sys/auxv.h" +#define __ARCH_VDSO_GETTIMEOFDAY_NAME "__vdso_gettimeofday" +#define __ARCH_VDSO_CLOCK_GETTIME_NAME "__vdso_clock_gettime" + +#if defined(__UCLIBC_USE_TIME64__) +#define __ARCH_VDSO_CLOCK_GETTIME64_NAME "__vdso_clock_gettime64" +#endif + +/* Maybe override default vDSO functions names by arch-specific */ #include "ldso.h" #include "generated/autoconf.h" @@ -321,7 +329,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ continue; } - if ( 0 == _dl_strcmp( name, "__vdso_gettimeofday" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_GETTIMEOFDAY_NAME ) ){ _dl__vdso_gettimeofday = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ @@ -330,7 +338,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ #endif continue; } - if ( 0 == _dl_strcmp( name, "__vdso_clock_gettime" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_CLOCK_GETTIME_NAME ) ){ _dl__vdso_clock_gettime = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ @@ -341,7 +349,7 @@ void load_vdso(void *sys_info_ehdr, char **envp ){ } #if defined(__UCLIBC_USE_TIME64__) - if ( 0 == _dl_strcmp( name, "__vdso_clock_gettime64" ) ){ + if ( 0 == _dl_strcmp( name, __ARCH_VDSO_CLOCK_GETTIME64_NAME ) ){ _dl__vdso_clock_gettime64 = func_addr; #ifdef __SUPPORT_LD_DEBUG__ if ( _dl_debug_vdso != 0 ){ diff --git a/ldso/ldso/mips/dl-syscalls.h b/ldso/ldso/mips/dl-syscalls.h index 46fd07bfa..d8407f17c 100644 --- a/ldso/ldso/mips/dl-syscalls.h +++ b/ldso/ldso/mips/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */ +#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) #include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __mips_vdso_gettimeofday(struct timeval *tv, _ #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __mips_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __mips_vdso_clock_gettime(clock_id, tp) -#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + diff --git a/ldso/ldso/x86_64/dl-syscalls.h b/ldso/ldso/x86_64/dl-syscalls.h index 0ec7a7dbb..3f953aa83 100644 --- a/ldso/ldso/x86_64/dl-syscalls.h +++ b/ldso/ldso/x86_64/dl-syscalls.h @@ -1,5 +1,8 @@ /* stub for arch-specific syscall issues/specific implementations */ +#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + #if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) #include "../dl-vdso-calls.h" @@ -19,4 +22,7 @@ static int __attribute__ ((used)) __x86_64_vdso_gettimeofday(struct timeval *tv, #define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __x86_64_vdso_gettimeofday(tv, tz) #define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __x86_64_vdso_clock_gettime(clock_id, tp) -#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ \ No newline at end of file +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + From patchwork Tue Apr 16 05:37:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Chestnykh X-Patchwork-Id: 1923993 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=KIWh4GU9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (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 4VJXqD5D0fz1yYB for ; Tue, 16 Apr 2024 15:37:10 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 6C1523528289; Tue, 16 Apr 2024 07:36:59 +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=KIWh4GU9; dkim-atps=neutral Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by helium.openadk.org (Postfix) with ESMTPS id 043563521167 for ; Tue, 16 Apr 2024 07:36:26 +0200 (CEST) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5191b61caf6so108509e87.3 for ; Mon, 15 Apr 2024 22:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713245785; x=1713850585; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GI3T4tlqPnENFJ1erUWtZ4ncugVWsFpir+wCtOm/uis=; b=KIWh4GU9Fns6Cl9NuI/Rra0s3e96XVC6QcqetwDkH+TIZh30xN9VtwvQj9+5+gWUA4 f06RAnQob0pK3bL182Ow+PzAw3d7nci0hWxBNmk8PYdbTzNKAj4boP2EoDZGoJ0mYJcM py9T2k6CqTyNIA7Ik/Kyh2UwNk6K9XHZvj2U/o77oqohqj5Bx3vhjpol2wlUxBZcWxy+ 4Qct94od5ttIELSf2m6YSyL8a+FcikyHDp1FnQLs3WlkHiMqy/XmRJ0ySDuCxtnzNayo nZ1rIkE2Jwhf6PRWvd0t8oRY8VF3AI+v8NcH0K40ZFh6x2ubpvbbI1NyA5XyBTh67Jsj 1nmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713245785; x=1713850585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GI3T4tlqPnENFJ1erUWtZ4ncugVWsFpir+wCtOm/uis=; b=Qx2YwU57JM2IngXXq0RPT4ayKEn2leC50yp5TdoXDKbdGijEFwT8kw3QRVvqkOZD1B 13TZWvQvwieQHthBI7V6Wulb9XPRNpRXfd1xIOIHFSaDG58Aa6ss2Az5vLNAnBA9X+KT QPLBLaD8aMszTuSfrmu4+OFmxwwuIs3wPe2/fo21Vh82goyPk7AR1xH5ADaDOaHQP02f 3rmWVUBfx+S/8OCliWQKAbXsiDloTLtMEh41HbzBMZf9SCFsnLOHxhdq+HEqZ8KZmLfN sdRX1yFWTtpRYYpUIPaaOxJmHm/Z5sliY0zdVjbLbcQfXX3I4mmrHKDQdeFYdQ2Vdn+D 3Awg== X-Gm-Message-State: AOJu0Yz9BkSKecUCilhGT5bDMwgRowcGKvRr39hkg5rDv2UjLRkEe9lK ryZMkvKwty77mv76xt9U6Q/LjGWY+yJa4rLwIzl8nCvKRYmdHyLTXIfWoA== X-Google-Smtp-Source: AGHT+IFF2oknUMnLK2n+OZN0suDyTtybpYIMsn+mJ+6bo4kl4LHUQ4fyJqMDUmOWUWyxKTvwG+Izdg== X-Received: by 2002:a19:5f5b:0:b0:516:c7e0:6493 with SMTP id a27-20020a195f5b000000b00516c7e06493mr5755296lfj.6.1713245784634; Mon, 15 Apr 2024 22:36:24 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:817a:d2b8:b7de:6cff:8d95:8d3b]) by smtp.gmail.com with ESMTPSA id v15-20020a056512048f00b00516c9a8120asm1471581lfq.226.2024.04.15.22.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 22:36:24 -0700 (PDT) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Tue, 16 Apr 2024 08:37:16 +0300 Message-ID: <20240416053716.874210-2-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416053716.874210-1-dm.chestnykh@gmail.com> References: <20240416053716.874210-1-dm.chestnykh@gmail.com> MIME-Version: 1.0 Message-ID-Hash: H6XVK52TSMJNGWLUYKP5WRXLY5UWW5FV X-Message-ID-Hash: H6XVK52TSMJNGWLUYKP5WRXLY5UWW5FV 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 2/2] Add vDSO support for aarch64. List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Dmitry Chestnykh --- extra/Configs/Config.aarch64 | 1 + ldso/ldso/aarch64/dl-syscalls.h | 39 ++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/extra/Configs/Config.aarch64 b/extra/Configs/Config.aarch64 index d666cc595..6074878f2 100644 --- a/extra/Configs/Config.aarch64 +++ b/extra/Configs/Config.aarch64 @@ -13,6 +13,7 @@ config FORCE_OPTIONS_FOR_ARCH select ARCH_ANY_ENDIAN select ARCH_HAS_MMU select ARCH_USE_MMU + select ARCH_VDSO_SUPPORT select UCLIBC_HAS_FPU choice diff --git a/ldso/ldso/aarch64/dl-syscalls.h b/ldso/ldso/aarch64/dl-syscalls.h index f40c4fd31..7f3566d6b 100644 --- a/ldso/ldso/aarch64/dl-syscalls.h +++ b/ldso/ldso/aarch64/dl-syscalls.h @@ -1 +1,38 @@ -/* stub for arch-specific syscall issues */ +/* stub for arch-specific syscall issues/specific implementations */ +#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + +#ifdef __ARCH_VDSO_GETTIMEOFDAY_NAME +#undef __ARCH_VDSO_GETTIMEOFDAY_NAME +#endif + +#ifdef __ARCH_VDSO_CLOCK_GETTIME_NAME +#undef __ARCH_VDSO_CLOCK_GETTIME_NAME +#endif + +#define __ARCH_VDSO_GETTIMEOFDAY_NAME "__kernel_gettimeofday" +#define __ARCH_VDSO_CLOCK_GETTIME_NAME "__kernel_clock_gettime" + +#if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) + +#include "../dl-vdso-calls.h" + +static int __attribute__ ((used)) __aarch64_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp); +static int __attribute__ ((used)) __aarch64_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp) +{ + return __generic_vdso_clock_gettime(clock_id, tp); +} + +static int __attribute__ ((used)) __aarch64_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz); +static int __attribute__ ((used)) __aarch64_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz) +{ + return __generic_vdso_gettimeofday(tv, tz); +} + +#define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __aarch64_vdso_gettimeofday(tv, tz) +#define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __aarch64_vdso_clock_gettime(clock_id, tp) + +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ +