diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-11-10 16:35:00 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-11-18 02:15:18 +0000 |
commit | c23f077cc4ab90a2f9d8821a352c739cd5643f72 (patch) | |
tree | 86f1323c481d2aaa1279087e03991dd859165749 /libexec | |
parent | 37ddf393f85b2d70d34bb85f8ffad3cc2882d50a (diff) | |
download | src-c23f077cc4ab90a2f9d8821a352c739cd5643f72.tar.gz src-c23f077cc4ab90a2f9d8821a352c739cd5643f72.zip |
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)
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/rtld.1 | 10 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 2 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld_paths.h | 5 |
3 files changed, 16 insertions, 1 deletions
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; |