git: c23f077cc4ab - stable/13 - rtld: add support for the $LIB token
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Nov 2022 02:16:13 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=c23f077cc4ab90a2f9d8821a352c739cd5643f72
commit c23f077cc4ab90a2f9d8821a352c739cd5643f72
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-11-10 16:35:00 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
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;