diff options
author | Joseph Myers <joseph@codesourcery.com> | 2014-11-04 17:39:39 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2014-11-04 17:39:39 +0000 |
commit | 4243cbea6d30ce32b58abd8f1103156f8df617fa (patch) | |
tree | 434ef397cb91424e48b123ca704e8176795f2161 /elf/rtld.c | |
parent | 2004e7fb76bd6806253436d63ab3bda7e24c9cc1 (diff) | |
download | glibc-4243cbea6d30ce32b58abd8f1103156f8df617fa.tar.gz glibc-4243cbea6d30ce32b58abd8f1103156f8df617fa.tar.xz glibc-4243cbea6d30ce32b58abd8f1103156f8df617fa.zip |
Don't use INTDEF/INTUSE with _dl_argv (bug 14132).
Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this patch replaces its use for _dl_argv with rtld_hidden_data_def and rtld_hidden_proto. Some places in .S files that previously used _dl_argv_internal or INTUSE(_dl_argv) now use __GI__dl_argv directly (there are plenty of existing examples of such direct use of __GI_*). A single place in rtld.c previously used _dl_argv without INTUSE, apparently accidentally, while the rtld_hidden_proto mechanism avoids such accidential omissions. As a consequence, this patch *does* change the contents of stripped ld.so. However, the installed stripped shared libraries are identical to those you get if instead of this patch you change that single _dl_argv use to use INTUSE, without any other changes. Tested for x86_64 (testsuite as well as comparison of installed stripped shared libraries as described above). [BZ #14132] * sysdeps/generic/ldsodefs.h (_dl_argv): Use rtld_hidden_proto. [IS_IN_rtld] (_dl_argv_internal): Do not declare. (rtld_progname): Make macro definition unconditional. * elf/rtld.c (_dl_argv): Use rtld_hidden_data_def instead of INTDEF. (dlmopen_doit): Do not use INTUSE with _dl_argv. (dl_main): Likewise. * elf/dl-sysdep.c (_dl_sysdep_start): Likewise. * sysdeps/alpha/dl-machine.h (RTLD_START): Use __GI__dl_argv instead of _dl_argv_internal. * sysdeps/powerpc/powerpc32/dl-start.S (_dl_start_user): Use __GI__dl_argv instead of INTUSE(_dl_argv). * sysdeps/powerpc/powerpc64/dl-machine.h (RTLD_START): Use __GI__dl_argv instead of _dl_argv_internal.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index d5e007f9d6..537fc43744 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -83,7 +83,7 @@ int _dl_argc attribute_relro attribute_hidden; char **_dl_argv attribute_relro = NULL; unsigned int _dl_skip_args attribute_relro attribute_hidden; #endif -INTDEF(_dl_argv) +rtld_hidden_data_def (_dl_argv) #ifndef THREAD_SET_STACK_GUARD /* Only exported for architectures that don't store the stack guard canary @@ -492,7 +492,7 @@ dlmopen_doit (void *a) args->map = _dl_open (args->fname, (RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT | __RTLD_SECURE), - dl_main, LM_ID_NEWLM, _dl_argc, INTUSE(_dl_argv), + dl_main, LM_ID_NEWLM, _dl_argc, _dl_argv, __environ); } @@ -804,55 +804,55 @@ dl_main (const ElfW(Phdr) *phdr, GL(dl_rtld_map).l_name = rtld_progname; while (_dl_argc > 1) - if (! strcmp (INTUSE(_dl_argv)[1], "--list")) + if (! strcmp (_dl_argv[1], "--list")) { mode = list; GLRO(dl_lazy) = -1; /* This means do no dependency analysis. */ ++_dl_skip_args; --_dl_argc; - ++INTUSE(_dl_argv); + ++_dl_argv; } - else if (! strcmp (INTUSE(_dl_argv)[1], "--verify")) + else if (! strcmp (_dl_argv[1], "--verify")) { mode = verify; ++_dl_skip_args; --_dl_argc; - ++INTUSE(_dl_argv); + ++_dl_argv; } - else if (! strcmp (INTUSE(_dl_argv)[1], "--inhibit-cache")) + else if (! strcmp (_dl_argv[1], "--inhibit-cache")) { GLRO(dl_inhibit_cache) = 1; ++_dl_skip_args; --_dl_argc; - ++INTUSE(_dl_argv); + ++_dl_argv; } - else if (! strcmp (INTUSE(_dl_argv)[1], "--library-path") + else if (! strcmp (_dl_argv[1], "--library-path") && _dl_argc > 2) { - library_path = INTUSE(_dl_argv)[2]; + library_path = _dl_argv[2]; _dl_skip_args += 2; _dl_argc -= 2; - INTUSE(_dl_argv) += 2; + _dl_argv += 2; } - else if (! strcmp (INTUSE(_dl_argv)[1], "--inhibit-rpath") + else if (! strcmp (_dl_argv[1], "--inhibit-rpath") && _dl_argc > 2) { - GLRO(dl_inhibit_rpath) = INTUSE(_dl_argv)[2]; + GLRO(dl_inhibit_rpath) = _dl_argv[2]; _dl_skip_args += 2; _dl_argc -= 2; - INTUSE(_dl_argv) += 2; + _dl_argv += 2; } - else if (! strcmp (INTUSE(_dl_argv)[1], "--audit") && _dl_argc > 2) + else if (! strcmp (_dl_argv[1], "--audit") && _dl_argc > 2) { - process_dl_audit (INTUSE(_dl_argv)[2]); + process_dl_audit (_dl_argv[2]); _dl_skip_args += 2; _dl_argc -= 2; - INTUSE(_dl_argv) += 2; + _dl_argv += 2; } else break; @@ -886,7 +886,7 @@ of this helper program; chances are you did not intend to run this program.\n\ ++_dl_skip_args; --_dl_argc; - ++INTUSE(_dl_argv); + ++_dl_argv; /* The initialization of _dl_stack_flags done below assumes the executable's PT_GNU_STACK may have been honored by the kernel, and @@ -1800,7 +1800,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", ElfW(Addr) loadbase; lookup_t result; - result = _dl_lookup_symbol_x (INTUSE(_dl_argv)[i], main_map, + result = _dl_lookup_symbol_x (_dl_argv[i], main_map, &ref, main_map->l_scope, NULL, ELF_RTYPE_CLASS_PLT, DL_LOOKUP_ADD_DEPENDENCY, NULL); @@ -1808,7 +1808,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", loadbase = LOOKUP_VALUE_ADDRESS (result); _dl_printf ("%s found at 0x%0*Zd in object at 0x%0*Zd\n", - INTUSE(_dl_argv)[i], + _dl_argv[i], (int) sizeof ref->st_value * 2, (size_t) ref->st_value, (int) sizeof loadbase * 2, (size_t) loadbase); |