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
This commit is contained in:
Konstantin Belousov 2022-11-10 18:35:00 +02:00
parent 9142f3a885
commit 8cc44a1e59
3 changed files with 16 additions and 1 deletions

View file

@ -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

View file

@ -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 *

View file

@ -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;