use explicit dynamic-list rather than symbolic-functions for linking

we have always bound symbols at libc.so link time rather than runtime
to minimize startup-time relocations and overhead of calls through the
PLT, and possibly also to preclude interposition that would not work
correctly anyway if allowed. historically, binding at link-time was
also necessary for the dynamic linker to work, but the dynamic linker
bootstrap overhaul in commit f3ddd17380
made it unnecessary.

our use of -Bsymbolic-functions, rather than -Bsymbolic, was chosen
because the latter is incompatible with public global data; it makes
it incompatible with copy relocations in the main program. however,
not all global data needs to be public. by using --dynamic-list
instead with an explicit list, we can reduce the number of symbolic
relocations left for runtime.

this change will also allow us to permit interposition of specific
functions (e.g. the allocator) if/when we want to, by adding them to
the dynamic list.
This commit is contained in:
Rich Felker
2018-04-17 19:23:00 -04:00
parent 4bf0717e51
commit b9410061e2
2 changed files with 41 additions and 4 deletions
+35
View File
@@ -0,0 +1,35 @@
{
environ;
__environ;
stdin;
stdout;
stderr;
timezone;
daylight;
tzname;
__timezone;
__daylight;
__tzname;
signgam;
__signgam;
optarg;
optind;
opterr;
optreset;
__optreset;
getdate_err;
h_errno;
program_invocation_name;
program_invocation_short_name;
__progname;
__progname_full;
__stack_chk_guard;
};