From nobody Fri Apr 08 01:25:25 2022 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 B17F81A836CE; Fri, 8 Apr 2022 01:25:25 +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 4KZLCn4YXDz3FLn; Fri, 8 Apr 2022 01:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649381125; 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=TnxCvm+4G9orZMqZw7WIBeP1Rljagiyh3FOpqwMyJdc=; b=LQs0OPOD7UFtay/+QdC9DtQvMzvwzzYgu88OBcroP2b4l4BthJYHEyu8wwKqzsPHQJ1vT0 eFn4kXGyKwrZovdtRzJPqEI0OUSgoJ7FDQjz19M2OAmm7pl5y+JtayeUKM74KLUk/2/jzm l9OHOddVoN4Eq8gLcZrf/nyxwGDve7LckyfUOcMRAxfH6QwdGWyTZJDzZoG3K43ozOXziT N1Qx9kLxeKkIk06X16sqFIMebdICEOUA+lqEWydW7wCWeIUtOGY06XN17BIggyN6s3TPmr ppNeXEvXB3wniHCDNlUnQaPQ92U6c/6Aa2bMK835XIFovFxsTaOMVtLPOlQaRQ== 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 7B0081B532; Fri, 8 Apr 2022 01:25:25 +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 2381PPsn095112; Fri, 8 Apr 2022 01:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2381PPs5095111; Fri, 8 Apr 2022 01:25:25 GMT (envelope-from git) Date: Fri, 8 Apr 2022 01:25:25 GMT Message-Id: <202204080125.2381PPs5095111@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: 61bb7ef55105 - stable/13 - rtld: extract calculation of the format strings for trace into a helper 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 61bb7ef5510535bc3660cd3ab2f969ef44af1ccc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649381125; 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=TnxCvm+4G9orZMqZw7WIBeP1Rljagiyh3FOpqwMyJdc=; b=dJfV/pRq1NlP9IbzArs6N7YT/KuBzqxl6fQcH73qcbcIkfkH/Oil9YSO5e6e9tbLlz+I3F wQC3jcAq+PgW8hKd10IueN6aA37hno5Sxvj40nX9cubPtLeAhXUpn0Uoqp3DVEkMgSvXJG om6Ng33ekwIexrYviffD4t6n8hyZS4RTnCoxfku3uVKH90qzi4VajY+QI33pczPD/Mj02E HwI2OF+tmWEnP4POCNuCEmm0Cchc0pwPlmLCT+8HunxErxqUvKldgGbtmQm9m/Gtv2ANv9 4Oq8xJ6JIC9OolbU5AkXmdylEkfP8WGj2N1eWe4/pYhD6sYyVqlBESdS5LsDoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649381125; a=rsa-sha256; cv=none; b=nztk/rv0jOusFqd5vvkJ7LGwEP/6FXLL9bGJZdCuNxxgqZ1X23xpMzbRMxqgXhKB4SuvYT ruxsJAW1gu1mC821RWK3tfr0ib2+ls1/wQkAYlajA/cl2G7PtgrRsFUWHuQSC3S5JPcX1I hMvXO/TCKGTtHbtfTvVE96ErKFonBkAy+60do8IZREG8onLyqfznKpRR/7THUozTWtk77h yDaHEroS0NGdbFS1AalML9CGQMx8YJ/q4Tq1Kk+717utgZIVueWvRJYMiJZddR4+KcYI0y So+9vrVLDtSQYZ7Rf84nmteoXlm/Gdz3VO8HYj4xGcxYZLt4BzLzmzH78Av2ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=61bb7ef5510535bc3660cd3ab2f969ef44af1ccc commit 61bb7ef5510535bc3660cd3ab2f969ef44af1ccc Author: Konstantin Belousov AuthorDate: 2022-03-30 20:35:37 +0000 Commit: Konstantin Belousov CommitDate: 2022-04-08 01:25:17 +0000 rtld: extract calculation of the format strings for trace into a helper (cherry picked from commit c25f36f630fce4b7af39d4bd0a3e23a2dc3396ff) --- libexec/rtld-elf/rtld.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index b495c5f5d8a8..f0263ec487d4 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -4966,21 +4966,28 @@ symlook_obj1_gnu(SymLook *req, const Obj_Entry *obj) } static void -trace_loaded_objects(Obj_Entry *obj) +trace_calc_fmts(const char **main_local, const char **fmt1, const char **fmt2) { - const char *fmt1, *fmt2, *fmt, *main_local, *list_containers; - int c; + *main_local = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_PROGNAME); + if (*main_local == NULL) + *main_local = ""; - if ((main_local = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_PROGNAME)) == - NULL) - main_local = ""; + *fmt1 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT1); + if (*fmt1 == NULL) + *fmt1 = "\t%o => %p (%x)\n"; - if ((fmt1 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT1)) == NULL) - fmt1 = "\t%o => %p (%x)\n"; + *fmt2 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT2); + if (*fmt2 == NULL) + *fmt2 = "\t%o (%x)\n"; +} - if ((fmt2 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT2)) == NULL) - fmt2 = "\t%o (%x)\n"; +static void +trace_loaded_objects(Obj_Entry *obj) +{ + const char *fmt1, *fmt2, *fmt, *main_local, *list_containers; + int c; + trace_calc_fmts(&main_local, &fmt1, &fmt2); list_containers = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_ALL); for (; obj != NULL; obj = TAILQ_NEXT(obj, next)) {