# HG changeset patch # Parent 347c5dea12d8c73419c95a3ccf6644e8e2f3853e If md_exec_hook is defined, provide a way to create the strings for the environment variables we look up at runtime. Otherwise, there's no way they will change, optimize it at compile time. diff -r 347c5dea12d8 libexec/rtld-elf/rtld.c --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -204,8 +204,6 @@ extern Elf_Dyn _DYNAMIC; #define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL) #endif -#define _LD(x) LD_ x - int dlclose(void *) __exported; char *dlerror(void) __exported; void *dlopen(const char *, int) __exported; @@ -325,6 +323,24 @@ ld_utrace_log(int event, void *handle, v utrace(&ut, sizeof(ut)); } +#ifdef RTLD_VARIANT_ENV_NAMES +/* + * construct the env variable based on the type of binary that's + * running. + */ +static inline const char * +_LD(const char *var) +{ + static char buffer[128]; + + strlcpy(buffer, ld_env_prefix, sizeof(buffer)); + strlcat(buffer, var, sizeof(buffer)); + return buffer; +} +#else +#define _LD(x) LD_ x +#endif + /* * Main entry point for dynamic linking. The first argument is the * stack pointer. The stack is expected to be laid out as described @@ -419,7 +435,7 @@ func_ptr_type trust = !issetugid(); - md_exec_hook(aux_info); + md_abi_variant_hook(aux_info); ld_bind_now = getenv(_LD("BIND_NOW")); /*