From nobody Thu Sep 22 11:20:55 2022 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 4MYCWq1v3Hz4d6Tg; Thu, 22 Sep 2022 11:20:55 +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 4MYCWq1NzFz3vX4; Thu, 22 Sep 2022 11:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663845655; 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=esr2Ov2T7dPWd0yxMaHpSpWNnaXVxP1HPZKSTrWuZXc=; b=GlwSgsn7m8KY4Jo2f9fcgyUpGc8xv0DcrwU59h4YLpO0VQyIZN/TJg5BacEg9RNSB8czU9 0+kB97J9yxw1C2ho6f36iWcp/VCqMhVz3Hjl3iOZjgkQ5a3r5cTYCP36LA8h4jtAlwn0Mq EahkRXOI1LttjkCgZ8GX9dqsstbd63uJtheh4+iHX4H+/WQmUd4KcXOC0HQt40CdLPEcn+ yEDtDyJ+jfpSL+tyx4IicohO4FEhQ5dgNV7X/RHRSGLcsV7/gxlCXDX+pu18Wj8YijpRd5 sjsD3VkptCeHtzJSnlv43+yMAsADzqOkpi8Pzrew0SghAFn3+X1KmCyoXWlitA== 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 4MYCWq0SdqzNpg; Thu, 22 Sep 2022 11:20:55 +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 28MBKtwN087231; Thu, 22 Sep 2022 11:20:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28MBKtTu087230; Thu, 22 Sep 2022 11:20:55 GMT (envelope-from git) Date: Thu, 22 Sep 2022 11:20:55 GMT Message-Id: <202209221120.28MBKtTu087230@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: 2f72ee987d49 - main - ldd: remove '[preloaded]' marker for the preloaded objects 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: 2f72ee987d492b3dc9116c5cf49777edd2474b11 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663845655; 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=esr2Ov2T7dPWd0yxMaHpSpWNnaXVxP1HPZKSTrWuZXc=; b=WHoUTMvwzL+KoQLGJxBUKZt58ewhO8/bxoN6KTny8/jKaCqjh5EMtgsWU1lvz97eQcRfxg q6rTWaZFeEn2OAcd4oqdrzeGSZ492Hns3ZwHqCtLte9s2vb+A8i0nqG0DLXib00W8NZsGY lhahi3OtKccyUGMBVs2YgtBwAA737o177/VEdm35Bp7GXKuSSMh93e6F6XZ/fPpbR5wXG4 qSctRMNxx4oj9xbbQXWTnxCa3wFcg8yUnBn6yqv9Qrn7q3ya03mLa/hTCuZIDGao6Wv3Wt +K6C6pJxtSCgaR4b7laZRadWo5WlMX2wCQSsQNHrXnxNWxLHVPIf2O3ez61Ejw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663845655; a=rsa-sha256; cv=none; b=xGfpvXnU3zMlnW/VM+7lojVVnSXxyqmffHkA2VmjBi7vmFGQdGGL5qOxsuDPwD55JoHD3w JcBntF/xEa3iAQKZZF+kUs93nCUAAanqHEgeN4Co7A5G+tww8wOp9mcvX4G36yP5wJ3bQ+ j2abG6X8PR6MbTMooO2QV1mC2xrbnGz0xJI3x4kUq9DGXTSbnnDAme/DRePqfnnBa9Ozfi DmBap/+SxbNyox5kE8tUBknFoRww5YX0oh+KuUx4d+dY3am91E7zAPuHhaaruvuGCdWmtz qDbmRoipBEoh1i0O98yLZUe/U72+CTrXR1AGBFxrwcP3v3FBlT4G5q3zlMnS8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f72ee987d492b3dc9116c5cf49777edd2474b11 commit 2f72ee987d492b3dc9116c5cf49777edd2474b11 Author: Konstantin Belousov AuthorDate: 2022-09-18 00:49:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-22 11:20:13 +0000 ldd: remove '[preloaded]' marker for the preloaded objects for the default output. For '-a' (per-object needed printout) the [preloaded] banner is kept. Instead, use special format2 for printing the preloaded objects (and vdso), which does not include DT_NEEDED, since there is no object needing the printed one. In this way, the output is more compatible with glibc. Example: LD_PRELOAD=/lib/libthr.so.3 LD_TRACE_LOADED_OBJECTS=1 /libexec/ld-elf.so.1 /bin/ls libutil.so.9 => /lib/libutil.so.9 (0x801099000) libncursesw.so.9 => /lib/libncursesw.so.9 (0x8010b0000) libc.so.7 => /lib/libc.so.7 (0x801123000) [vdso] (0x7ffffffff000) /lib/libthr.so.3 (0x80106c000) Note the absense of the part before and including '=>' for preloaded libthr.so.3, and for vdso. PR: 265750 Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36616 --- libexec/rtld-elf/rtld.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 86515ef416d3..d40cd9f90f0b 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -4956,7 +4956,12 @@ trace_print_obj(Obj_Entry *obj, const char *name, const char *path, const char *fmt; int c; - fmt = strncmp(name, "lib", 3) == 0 ? fmt1 : fmt2; /* XXX bogus */ + if (fmt1 == NULL) + fmt = fmt2; + else + /* XXX bogus */ + fmt = strncmp(name, "lib", 3) == 0 ? fmt1 : fmt2; + while ((c = *fmt++) != '\0') { switch (c) { default: @@ -5038,19 +5043,23 @@ trace_loaded_objects(Obj_Entry *obj, bool show_preload) } if (show_preload) { + if (ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT2) == NULL) + fmt2 = "\t%p (%x)\n"; first_spurious = true; + TAILQ_FOREACH(obj, &obj_list, next) { if (obj->marker || obj == obj_main || obj->traced) continue; - if (first_spurious) { + if (list_containers && first_spurious) { rtld_printf("[preloaded]\n"); first_spurious = false; } + Name_Entry *fname = STAILQ_FIRST(&obj->names); name = fname == NULL ? "" : fname->name; trace_print_obj(obj, name, obj->path, main_local, - fmt1, fmt2); + NULL, fmt2); } } }