git: 47315d6d3562 - main - rtld: make ld_get_env_var() usable for all rtld source files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jul 2024 23:58:58 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=47315d6d3562111883142bb09320d35f05d34a58 commit 47315d6d3562111883142bb09320d35f05d34a58 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-07-17 03:59:24 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-07-29 23:57:33 +0000 rtld: make ld_get_env_var() usable for all rtld source files Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 28 +--------------------------- libexec/rtld-elf/rtld.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index ef34a9d36bc3..f49c429d0061 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -343,32 +343,6 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize, utrace(&ut, sizeof(ut)); } -enum { - LD_BIND_NOW = 0, - LD_PRELOAD, - LD_LIBMAP, - LD_LIBRARY_PATH, - LD_LIBRARY_PATH_FDS, - LD_LIBMAP_DISABLE, - LD_BIND_NOT, - LD_DEBUG, - LD_ELF_HINTS_PATH, - LD_LOADFLTR, - LD_LIBRARY_PATH_RPATH, - LD_PRELOAD_FDS, - LD_DYNAMIC_WEAK, - LD_TRACE_LOADED_OBJECTS, - LD_UTRACE, - LD_DUMP_REL_PRE, - LD_DUMP_REL_POST, - LD_TRACE_LOADED_OBJECTS_PROGNAME, - LD_TRACE_LOADED_OBJECTS_FMT1, - LD_TRACE_LOADED_OBJECTS_FMT2, - LD_TRACE_LOADED_OBJECTS_ALL, - LD_SHOW_AUXV, - LD_STATIC_TLS_EXTRA, -}; - struct ld_env_var_desc { const char * const n; const char *val; @@ -403,7 +377,7 @@ static struct ld_env_var_desc ld_env_vars[] = { LD_ENV_DESC(STATIC_TLS_EXTRA, false), }; -static const char * +const char * ld_get_env_var(int idx) { return (ld_env_vars[idx].val); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 9df5b4ec8f59..fcd42f3841b3 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -352,6 +352,32 @@ typedef struct Struct_SymLook { struct Struct_RtldLockState *lockstate; } SymLook; +enum { + LD_BIND_NOW = 0, + LD_PRELOAD, + LD_LIBMAP, + LD_LIBRARY_PATH, + LD_LIBRARY_PATH_FDS, + LD_LIBMAP_DISABLE, + LD_BIND_NOT, + LD_DEBUG, + LD_ELF_HINTS_PATH, + LD_LOADFLTR, + LD_LIBRARY_PATH_RPATH, + LD_PRELOAD_FDS, + LD_DYNAMIC_WEAK, + LD_TRACE_LOADED_OBJECTS, + LD_UTRACE, + LD_DUMP_REL_PRE, + LD_DUMP_REL_POST, + LD_TRACE_LOADED_OBJECTS_PROGNAME, + LD_TRACE_LOADED_OBJECTS_FMT1, + LD_TRACE_LOADED_OBJECTS_FMT2, + LD_TRACE_LOADED_OBJECTS_ALL, + LD_SHOW_AUXV, + LD_STATIC_TLS_EXTRA, +}; + void _rtld_error(const char *, ...) __printflike(1, 2) __exported; void rtld_die(void) __dead2; const char *rtld_strerror(int); @@ -373,6 +399,7 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_long); /* * Function declarations. */ +const char *ld_get_env_var(int idx); uintptr_t rtld_round_page(uintptr_t); uintptr_t rtld_trunc_page(uintptr_t); Elf32_Word elf_hash(const char *);