From nobody Mon Oct 25 17:47:56 2021 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 967C918179D3; Mon, 25 Oct 2021 17:47:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMqc3sXmz3PDk; Mon, 25 Oct 2021 17:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 64E865490; Mon, 25 Oct 2021 17:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHluLe017806; Mon, 25 Oct 2021 17:47:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHlugL017805; Mon, 25 Oct 2021 17:47:56 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:47:56 GMT Message-Id: <202110251747.19PHlugL017805@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: 40ddde6ef9f3 - main - rtld: Print currently configured search path for libraries for -v 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: 40ddde6ef9f38fd238fd1d84d77750f96c96a157 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40ddde6ef9f38fd238fd1d84d77750f96c96a157 commit 40ddde6ef9f38fd238fd1d84d77750f96c96a157 Author: Konstantin Belousov AuthorDate: 2021-10-25 16:16:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:41:53 +0000 rtld: Print currently configured search path for libraries for -v Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8b1f84c6901a..05afe5f42c3e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -466,6 +466,13 @@ rtld_init_env_vars(char **env) rtld_init_env_vars_for_prefix(env, ld_env_prefix); } +static void +set_ld_elf_hints_path(void) +{ + if (ld_elf_hints_path == NULL || strlen(ld_elf_hints_path) == 0) + ld_elf_hints_path = ld_elf_hints_default; +} + /* * Main entry point for dynamic linking. The first argument is the * stack pointer. The stack is expected to be laid out as described @@ -723,9 +730,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); ld_utrace = ld_get_env_var(LD_UTRACE); - if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) - ld_elf_hints_path = ld_elf_hints_default; - + set_ld_elf_hints_path(); if (ld_debug != NULL && *ld_debug != '\0') debug = 1; dbg("%s is initialized, base address = %p", __progname, @@ -5972,16 +5977,23 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, mib[1] = HW_MACHINE; sz = sizeof(machine); sysctl(mib, nitems(mib), machine, &sz, NULL, 0); + ld_elf_hints_path = ld_get_env_var( + LD_ELF_HINTS_PATH); + set_ld_elf_hints_path(); rtld_printf( "FreeBSD ld-elf.so.1 %s\n" "FreeBSD_version %d\n" "Default lib path %s\n" + "Hints lib path %s\n" "Env prefix %s\n" + "Default hint file %s\n" "Hint file %s\n" "libmap file %s\n", machine, __FreeBSD_version, ld_standard_library_path, + gethints(false), ld_env_prefix, ld_elf_hints_default, + ld_elf_hints_path, ld_path_libmap_conf); _exit(0); } else {