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 */ +