From nobody Fri Nov 11 10:06:48 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 4N7vWD40tDz4XDv2; Fri, 11 Nov 2022 10:06:48 +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 4N7vWD3Vzsz3HtB; Fri, 11 Nov 2022 10:06:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668161208; 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=ucHzc5KOdGqjZzuVx0dVUX72S1eFLgYPh33A1xwQwxk=; b=m/8XoZGolzyu/hY8BpIxJta40ouIzeFhYVajoapEOdd9NvCZRLpjuVzgNR5ZXpKcKEfDCl yajrvKI+/8OVKIN2H7XGUDAJTv94DMuFmSFQOuL5cXiNJJiJSvtc3lvY1sqA84WnT4wgSs lbUVerBEzt7YcQo96iw4zIXaxps3Ai1GDkBdoa2i84JvpuV7kmvXft7HKvlFp+3sjYe/Ch Vk51XGfT+R6tUvzKUWCDT1OnW6RL2T0RK3fkrFSb3B/41KWPmUioCNdtzynfjYzO/6jbvu LIgt4GZJIGA0UnQR4p9mt9rIPoKIdDlOfb90CyRYUARB1FO8GnOSuoJuHb0BPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668161208; 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=ucHzc5KOdGqjZzuVx0dVUX72S1eFLgYPh33A1xwQwxk=; b=NwzJ8XBZIs+We7Vozf42aMa2RwzpAhrcYRJigiJgBO5T9/n76UlKKuZr+B8TAfmcsyI/Gd Lx93uUM1dXfNASPTRhYFbgHlc8CBbm65CgPb/N2E5qQHhUyn+f18fYrk+94mjR3ZfEIPzB CJ7BWcRTP12sf5HejA/IBqWZaEbn1hfTVtfSQhLLjL2F1RZLmiP6Qj6SV0hWQLH1KfFmX9 mRUEJU0r/p02mL0aCa/KWm5ZOB+V54Vb8V4fa8GXRy0OYwr26Mi7mSbOZAu/lr6S5mvKfX jFRs71SKjAvIryhJTcxha//gfwA/rat4VtxmjFbyfkCobLAcWUJr4EYbqgimaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668161208; a=rsa-sha256; cv=none; b=DEgIsQ5dGAtiVlWuYNATmPjPHacJw7esxFiNa8lULCrCOL8RI26LKo/irGUzub5anO0d08 OMx0b7ClgAhKAmwnKw5XDH8ZntnhdzzhtzUjJQ1RabD9UrGRRmYlNCv3XcQ3o78gZk2ZMa EZovmlXCevkov5d8g5k+l2p7kcC0VysDHy7nzeTKMAp+8ymnDhYaKielJFwUN6k7OM/54j JsPl8F0IqnE38FUt1mFYzy+qUH6FNBr4ckdtasb4xi6aKAytTW2Q2Sh2D8+qjMbi2iR7jw HSiG2bG69xn+aKe5xlmgzXeUffqWo9llJtYZeb/y+O02pSg2qwgFqopbW+VOGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N7vWD2YbKzdbf; Fri, 11 Nov 2022 10:06:48 +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 2ABA6mWi067069; Fri, 11 Nov 2022 10:06:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABA6mNp067068; Fri, 11 Nov 2022 10:06:48 GMT (envelope-from git) Date: Fri, 11 Nov 2022 10:06:48 GMT Message-Id: <202211111006.2ABA6mNp067068@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: 8cc44a1e59f6 - main - rtld: add support for the $LIB token 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: 8cc44a1e59f648eb5bea5afe6d9aa1d7f927c9d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8cc44a1e59f648eb5bea5afe6d9aa1d7f927c9d7 commit 8cc44a1e59f648eb5bea5afe6d9aa1d7f927c9d7 Author: Konstantin Belousov AuthorDate: 2022-11-10 16:35:00 +0000 Commit: Konstantin Belousov CommitDate: 2022-11-11 10:06:30 +0000 rtld: add support for the $LIB token similar to the same token in glibc. Requested and reviewed by: bapt Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37329 --- libexec/rtld-elf/rtld.1 | 10 +++++++++- libexec/rtld-elf/rtld.c | 2 ++ libexec/rtld-elf/rtld_paths.h | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index c29d1fb1f90c..4ae811455609 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2021 +.Dd November 10, 2022 .Dt RTLD 1 .Os .Sh NAME @@ -76,6 +76,14 @@ Translated to the name of the operating system implementation. Translated to the release level of the operating system. .It Pa $PLATFORM Translated to the machine hardware platform. +.It Pa $LIB +Translated to the system library path component on the platform. +It is +.Pa lib +for native binaries, and typically +.Pa lib32 +for compat32 binaries. +Other translations might exist for other ABIs supported on the platform. .El .Pp The diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 2e99ba4d69cf..2a142d333740 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1200,6 +1200,8 @@ static const struct { { .kw = "${OSREL}", .pass_obj = false, .subst = uts.release }, { .kw = "$PLATFORM", .pass_obj = false, .subst = uts.machine }, { .kw = "${PLATFORM}", .pass_obj = false, .subst = uts.machine }, + { .kw = "$LIB", .pass_obj = false, .subst = TOKEN_LIB }, + { .kw = "${LIB}", .pass_obj = false, .subst = TOKEN_LIB }, }; static char * diff --git a/libexec/rtld-elf/rtld_paths.h b/libexec/rtld-elf/rtld_paths.h index ae4d1c473271..c051db7b580f 100644 --- a/libexec/rtld-elf/rtld_paths.h +++ b/libexec/rtld-elf/rtld_paths.h @@ -45,6 +45,7 @@ #define _BASENAME_RTLD _COMPAT32_BASENAME_RTLD #define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32" #define LD_ "LD_32_" +#define TOKEN_LIB "lib32" #endif #ifndef _PATH_ELF_HINTS @@ -75,6 +76,10 @@ #define LD_ "LD_" #endif +#ifndef TOKEN_LIB +#define TOKEN_LIB "lib" +#endif + #ifdef IN_RTLD extern const char *ld_elf_hints_default; extern const char *ld_path_libmap_conf;