From nobody Fri Nov 18 02:16:13 2022 X-Original-To: dev-commits-src-branches@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 4ND0l22Sncz4dB6j; Fri, 18 Nov 2022 02:16:14 +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 4ND0l21txpz3wXS; Fri, 18 Nov 2022 02:16:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668737774; 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=rg3S6SN3Ym7C4o3CYhLTW26OTo1kTvrNyUnAYgOAsIM=; b=qD/6rukPbDsWzt9fSLDBKDZnKIKdJ2x3DbeX4JJGrblvmyxgrpfqBiIWbTlk1U8RwckS/W U00oEtC605ExA4qEgWXw5krLsK7fUTiY8ESuTc1/o8uubxnN4OyAUYHcEOeq0bY8HWg+yM DqkGsKLP1ozig2UaL5rZtCfI3AMf8mqUeZ5Vhht8DLb7lUl/RbXo8SFCH0Brybc1hSyfTM 299qsHZSTYknjX6a4KiFgCRYkkWeUWjJYMWwp4RXlOAlIDeTAElXroKh1HsC+lVedj5htR mPjHrCV7M84IKslvl2tj8lFhl1YcDCIQAnckBtvDjUxl1XEGFCt8EsT6yhKNJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668737774; 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=rg3S6SN3Ym7C4o3CYhLTW26OTo1kTvrNyUnAYgOAsIM=; b=ct9FKvkGY0gGTQQiH6a3qjTpHJS07RQL4Ijs/8p+gSmNzi/ucX4yR8Ty1zE/K551rFgLw0 mOTM+WFiHLpTYMyJ0Ttty+wpwkjjK07B7uCh46f8FBWAt68AMiG+eh5ZU+9zqh7nfBPJDH 65WwBM+OMoSfCLoeg7AI8TefJPfVElhnJuHDZtPlFMox4yU1CeepZGzPtgzjq+CTN2TxAL He7zqZo9RZ3BWkC8OgbsIq4KZuHu+MLim84ttKbLo8S//vZR1nfkGtneWzf148Mxn1sgnJ xxG4cqQuGc+45Hq5s1hDFmmVNqmqVimLyQ7b7Wk48gPkdD3lzzJ97iQLLEXjOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668737774; a=rsa-sha256; cv=none; b=rZ8s9sTsFR6fDLVJEh6qAPMK6k1armNUYeCqesj2iQpnwQ7Q6/7Vp/XtW8HaqlB8u7fieb tbJAWBgIVP8qBhfpJdT+ryvEebEpLHosUgteFYfQpYiD6hrV3xl1y41+NGODXVZJC0qy5G Rl83bJ/LWL3t8E92h9f6ZrqIQOt4/eK4SW6jT5T1oj/ZJxMpkA2lDdGAgeJ19kVr0k/uq6 qB9nyRB/xJHVBM6WrFHWrtO46e66f0QRnoXNi4KtiTgCH2yeSCOL/KtKruGso/vRzbhGza 5BCR5JFAI4Xda2TtMze06hWX8eMAt8ryYFnzQP7oQwnT3W3pA8dhAEO7pDwHoQ== 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 4ND0l20dDfz145X; Fri, 18 Nov 2022 02:16:14 +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 2AI2GD8x049011; Fri, 18 Nov 2022 02:16:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AI2GD3C049010; Fri, 18 Nov 2022 02:16:13 GMT (envelope-from git) Date: Fri, 18 Nov 2022 02:16:13 GMT Message-Id: <202211180216.2AI2GD3C049010@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: c23f077cc4ab - stable/13 - rtld: add support for the $LIB token List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: c23f077cc4ab90a2f9d8821a352c739cd5643f72 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c23f077cc4ab90a2f9d8821a352c739cd5643f72 commit c23f077cc4ab90a2f9d8821a352c739cd5643f72 Author: Konstantin Belousov AuthorDate: 2022-11-10 16:35:00 +0000 Commit: Konstantin Belousov CommitDate: 2022-11-18 02:15:18 +0000 rtld: add support for the $LIB token MFC note: the arm soft case is not handled, it is probably worth expanding $LIB to libsoft there. (cherry picked from commit 8cc44a1e59f648eb5bea5afe6d9aa1d7f927c9d7) --- 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 b103ffe69d9d..8e2cd0dfcb24 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1204,6 +1204,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 6ead517e8feb..2b8b2698a421 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 @@ -81,6 +82,10 @@ #define SOFT_STANDARD_LIBRARY_PATH "/usr/libsoft" #define LD_SOFT_ "LD_SOFT_" +#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;