diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 --- 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 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 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1200,6 +1200,8 @@ { .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 --- 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;