From nobody Mon Aug 05 00:32:41 2024 X-Original-To: dev-commits-src-all@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 4Wccpd37wYz5S8bB; Mon, 05 Aug 2024 00:32:41 +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 4Wccpd1l7xz4DF1; Mon, 5 Aug 2024 00:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722817961; 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=g4Pe8Xd6xEsyS40JCaeqdd23qoS0EYdOgKaq96C+iXQ=; b=psBSj4YJpOElRlvV0HG1m/4CaVS9TJRc7KgxvmmAwvT76Wl2brxjQiMMZ5lifkyqVMbx8K 0ecJHZJnUHFRuf+gip+sRO+TDbt1G0eJmgYoVZO/Qmmn8oWEP0cwe2mRSrQFNaTylzKZ/s qWR+KjLboBz5yuBFT9hpOYWnBlqc3yzrpjJLryRzAdYAT2OUhw8EzmS3B+CIRjeWZcLmM6 ajg9SAKrPbKU27ciIqLY19rgYhS2tEpnSiiQLxCrWU+CebAxvdfQoS7vyx3bH64ladja+W jsagFtDPb73yUHYUWzmktVK+IwKtTis6ZyA+5j9qYIiwTUtrFPXvGJAK3d+hSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722817961; a=rsa-sha256; cv=none; b=ntBW9V9FhGC/Yp25/b31Y/m+SB9igvLV6u3hFCYzGyM1XZ+81/KjCD5x1AS+ZtyvHxpQjg ulwTQTho6BIclJbgHC15Z/X39uimKrTOzyhVSWWrJ452pw4fOu2iEV7QVtLnYeEUgRj5g6 MwPsXWcHBhvksIqx9l9AxnUJggfEzfpUoVqb28v+cL1LrZBIo975FJqluMsYn5v5uqLDUX uPlemF5wfBEwIci9I75etMu2y8pBEZY5iFypAHF16FgIoyzDXs1rynVh4fH8o9xu4wcFH+ 3O/F7nI423SjKD9Vv3D5ucHnZ90OcEZq87xgc4su9ykfn0CRxnXdtKzXrg118w== 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=1722817961; 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=g4Pe8Xd6xEsyS40JCaeqdd23qoS0EYdOgKaq96C+iXQ=; b=Gxr5rTv3SGtPb6ST2IYB7T97UU98mZyMnuFirKR3dEuw6DcAxsS04aZF6Zz9/a7r33pZWG w7zAyMaO4TRsYdw6IedmXhddUpyhwdqxTq9Xnwq5aG7+NPjkUREHlq4ifXrI+O+o0lwFxF xGQM5MIE5mUfwKZQS0EgfXvHfTa8T5ffSNnmM+hHCmBnx2v9H/kn0I+KsX23faP8nibm6D ylfiDxErB59plx1GDeYfBI7T4IL+TKzphAlPO8IlaUQTKPaLr6N/RCk70rBLAB5dGB8pMY LFzPLtjvAicGk6xKH2wBDQGwBZXpF1JLLGe0Sd2tDbQmwD8gbDy2iSVhI8do+g== 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 4Wccpd12tQz1Ghp; Mon, 5 Aug 2024 00:32:41 +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 4750WfFM003109; Mon, 5 Aug 2024 00:32:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4750Wfld003106; Mon, 5 Aug 2024 00:32:41 GMT (envelope-from git) Date: Mon, 5 Aug 2024 00:32:41 GMT Message-Id: <202408050032.4750Wfld003106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: da32a0616bdc - stable/14 - rtld: make ld_get_env_var() usable for all rtld source files List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: da32a0616bdc84e12791e280d9d92acc34f5dd70 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=da32a0616bdc84e12791e280d9d92acc34f5dd70 commit da32a0616bdc84e12791e280d9d92acc34f5dd70 Author: Konstantin Belousov AuthorDate: 2024-07-17 03:59:24 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-05 00:32:11 +0000 rtld: make ld_get_env_var() usable for all rtld source files (cherry picked from commit 47315d6d3562111883142bb09320d35f05d34a58) --- 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 96042f7b5af3..411fe7956873 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -344,32 +344,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; @@ -404,7 +378,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 a4f2c35cc03f..96a9da3c4ea3 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -359,6 +359,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); @@ -380,6 +406,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 *);