mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
elf: Add glibc-hwcaps support for LD_LIBRARY_PATH
This hacks non-power-set processing into _dl_important_hwcaps. Once the legacy hwcaps handling goes away, the subdirectory handling needs to be reworked, but it is premature to do this while both approaches are still supported. ld.so supports two new arguments, --glibc-hwcaps-prepend and --glibc-hwcaps-mask. Each accepts a colon-separated list of glibc-hwcaps subdirectory names. The prepend option adds additional subdirectories that are searched first, in the specified order. The mask option restricts the automatically selected subdirectories to those listed in the option argument. For example, on systems where /usr/lib64 is on the library search path, --glibc-hwcaps-prepend=valgrind:debug causes the dynamic loader to search the directories /usr/lib64/glibc-hwcaps/valgrind and /usr/lib64/glibc-hwcaps/debug just before /usr/lib64 is searched. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
18
elf/rtld.c
18
elf/rtld.c
@ -290,6 +290,8 @@ dl_main_state_init (struct dl_main_state *state)
|
||||
state->library_path_source = NULL;
|
||||
state->preloadlist = NULL;
|
||||
state->preloadarg = NULL;
|
||||
state->glibc_hwcaps_prepend = NULL;
|
||||
state->glibc_hwcaps_mask = NULL;
|
||||
state->mode = rtld_mode_normal;
|
||||
state->any_debug = false;
|
||||
state->version_info = false;
|
||||
@ -1253,6 +1255,22 @@ dl_main (const ElfW(Phdr) *phdr,
|
||||
{
|
||||
argv0 = _dl_argv[2];
|
||||
|
||||
_dl_skip_args += 2;
|
||||
_dl_argc -= 2;
|
||||
_dl_argv += 2;
|
||||
}
|
||||
else if (strcmp (_dl_argv[1], "--glibc-hwcaps-prepend") == 0
|
||||
&& _dl_argc > 2)
|
||||
{
|
||||
state.glibc_hwcaps_prepend = _dl_argv[2];
|
||||
_dl_skip_args += 2;
|
||||
_dl_argc -= 2;
|
||||
_dl_argv += 2;
|
||||
}
|
||||
else if (strcmp (_dl_argv[1], "--glibc-hwcaps-mask") == 0
|
||||
&& _dl_argc > 2)
|
||||
{
|
||||
state.glibc_hwcaps_mask = _dl_argv[2];
|
||||
_dl_skip_args += 2;
|
||||
_dl_argc -= 2;
|
||||
_dl_argv += 2;
|
||||
|
Reference in New Issue
Block a user