From nobody Mon Jul 29 23:58:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WXwLV5DCFz5SFFZ; Mon, 29 Jul 2024 23:58:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WXwLV38wHz4DNG; Mon, 29 Jul 2024 23:58:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722297538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9bvBe9oSfI0yaIpPvImMbGEUoRS5wuBc+HwHwOorgyU=; b=gIsnhHxp0FmP97M5hOXnUAXVNDFESLcLh/+goE2j72H5NbOrVJ0wOq1bf2xglVvJnB3gqu OmXvfzmXzF/9phhQgtYTt54LvKDP2IWgPNTCjUPusEZHoWpv/kE75WHIvfzVJKcD+gCsBj yZrAzbx4RWX7BYUGYSlztJle/oB7dON5jCbW9i/wESoVJM5fa/pUHWTlllvsP5MxPc+QKC /U/JSwtieM2ewCQ/FwLW6hi98KYnEuDjEa24lVeT/DaxV65RlMBSFOdkKBjtahw332P8JL BKJVI/UcbBOcZ1piFwXnZw8tDIfVK3LKV5x8ZybNoxewxAN7GVhlgcG+mtpLQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722297538; a=rsa-sha256; cv=none; b=hQJvK22M4Vbqci5YsZA1mwHQbap8NhuVdk6+ENOVmaXMPqF2Duz2ky615EWuOkuPsR5nWe QrGQNwlIMsQFLVoA8VS3D2hnbA5C48KyZGopu1HvwKZPFo3xWzJF1tJgLTn8RessuGSNiK YBwUk5zJXKsqBZ95wfzuBc5jDGYj1O3lFYbrXUrzfFa8jUCV3QjvqkMIlTJYi1b6cB6RUZ kliw3Q4UfI/yr+3UWYyIu/bgtCKeE/1ro1+C3rnMf5srvTCDwviFN6CMmHsU1WBbwbmoI7 3VtPdCrKe24xAJFPNu/kLrlf+d4lCeTvqXW4UsLOr8vlI7I8Mew/lgkD85lfsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722297538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9bvBe9oSfI0yaIpPvImMbGEUoRS5wuBc+HwHwOorgyU=; b=hpPYX7UrVX//cBwvPOCvRPOt9mQl7DpK8eV6GIAvpPjFarprhZNEeZM1xZYRH9h/AUzV59 +8qdCozkrIg+YH+jUNCAYeNl0iBAohsdJW7JNMNYuPVKxqsFC93R374W+9wGcdPq4Kgzkt 9Vz6SxX1eHB3xVKhU1yWMeMpS6smDyHv7H+PeNxu/KLbpaKYDhuwPCRd40AyECIPmZ9TgJ 6An77toInbIm7zZmKN0k3CZPypvxVrKu5ACM6gHvPWfSHAvcLnyotsIt3Mw91qfayNql9v aVOvwbHwVQ3dUbjNAd1Wr3rLBDQltBhq/vKwaL/YMh/eTvsVh0sQiHogBT+6AA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WXwLV2V9Mzvdq; Mon, 29 Jul 2024 23:58:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46TNwwg5051668; Mon, 29 Jul 2024 23:58:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TNwwJq051665; Mon, 29 Jul 2024 23:58:58 GMT (envelope-from git) Date: Mon, 29 Jul 2024 23:58:58 GMT Message-Id: <202407292358.46TNwwJq051665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 47315d6d3562 - main - rtld: make ld_get_env_var() usable for all rtld source files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47315d6d3562111883142bb09320d35f05d34a58 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=47315d6d3562111883142bb09320d35f05d34a58 commit 47315d6d3562111883142bb09320d35f05d34a58 Author: Konstantin Belousov AuthorDate: 2024-07-17 03:59:24 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-29 23:57:33 +0000 rtld: make ld_get_env_var() usable for all rtld source files Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 28 +--------------------------- libexec/rtld-elf/rtld.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index ef34a9d36bc3..f49c429d0061 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -343,32 +343,6 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize, utrace(&ut, sizeof(ut)); } -enum { - LD_BIND_NOW = 0, - LD_PRELOAD, - LD_LIBMAP, - LD_LIBRARY_PATH, - LD_LIBRARY_PATH_FDS, - LD_LIBMAP_DISABLE, - LD_BIND_NOT, - LD_DEBUG, - LD_ELF_HINTS_PATH, - LD_LOADFLTR, - LD_LIBRARY_PATH_RPATH, - LD_PRELOAD_FDS, - LD_DYNAMIC_WEAK, - LD_TRACE_LOADED_OBJECTS, - LD_UTRACE, - LD_DUMP_REL_PRE, - LD_DUMP_REL_POST, - LD_TRACE_LOADED_OBJECTS_PROGNAME, - LD_TRACE_LOADED_OBJECTS_FMT1, - LD_TRACE_LOADED_OBJECTS_FMT2, - LD_TRACE_LOADED_OBJECTS_ALL, - LD_SHOW_AUXV, - LD_STATIC_TLS_EXTRA, -}; - struct ld_env_var_desc { const char * const n; const char *val; @@ -403,7 +377,7 @@ static struct ld_env_var_desc ld_env_vars[] = { LD_ENV_DESC(STATIC_TLS_EXTRA, false), }; -static const char * +const char * ld_get_env_var(int idx) { return (ld_env_vars[idx].val); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 9df5b4ec8f59..fcd42f3841b3 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -352,6 +352,32 @@ typedef struct Struct_SymLook { struct Struct_RtldLockState *lockstate; } SymLook; +enum { + LD_BIND_NOW = 0, + LD_PRELOAD, + LD_LIBMAP, + LD_LIBRARY_PATH, + LD_LIBRARY_PATH_FDS, + LD_LIBMAP_DISABLE, + LD_BIND_NOT, + LD_DEBUG, + LD_ELF_HINTS_PATH, + LD_LOADFLTR, + LD_LIBRARY_PATH_RPATH, + LD_PRELOAD_FDS, + LD_DYNAMIC_WEAK, + LD_TRACE_LOADED_OBJECTS, + LD_UTRACE, + LD_DUMP_REL_PRE, + LD_DUMP_REL_POST, + LD_TRACE_LOADED_OBJECTS_PROGNAME, + LD_TRACE_LOADED_OBJECTS_FMT1, + LD_TRACE_LOADED_OBJECTS_FMT2, + LD_TRACE_LOADED_OBJECTS_ALL, + LD_SHOW_AUXV, + LD_STATIC_TLS_EXTRA, +}; + void _rtld_error(const char *, ...) __printflike(1, 2) __exported; void rtld_die(void) __dead2; const char *rtld_strerror(int); @@ -373,6 +399,7 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_long); /* * Function declarations. */ +const char *ld_get_env_var(int idx); uintptr_t rtld_round_page(uintptr_t); uintptr_t rtld_trunc_page(uintptr_t); Elf32_Word elf_hash(const char *);