path: root/dynamic.list
Commit message (Collapse)AuthorAgeFilesLines
* fix regression in access to optopt objectRich Felker2018-11-191-0/+1
| | | | | | | | commit b9410061e2ad6fe91bb3910c3adc7d4a315b7ce9 inadvertently omitted optopt from the "dynamic list", causing it to be split into separate objects that don't share their value if the main program contains a copy relocation for it (for non-PIE executables that access it, and some PIE ones, depending on arch and toolchain versions/options).
* allow interposition/replacement of allocator (malloc)Rich Felker2018-04-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | replacement is subject to conditions on the replacement functions. they may only call functions which are async-signal-safe, as specified either by POSIX or as an implementation-defined extension. if any allocator functions are replaced, at least malloc, realloc, and free must be provided. if calloc is not provided, it will behave as malloc+memset. any of the memalign-family functions not provided will fail with ENOMEM. in order to implement the above properties, calloc and __memalign check that they are using their own malloc or free, respectively. choice to check malloc or free is based on considerations of supporting __simple_malloc. in order to make this work, calloc is split into separate versions for __simple_malloc and full malloc; commit ba819787ee93ceae94efd274f7849e317c1bff58 already did most of the split anyway, and completing it saves an extra call frame. previously, use of -Bsymbolic-functions made dynamic interposition impossible. now, we are using an explicit dynamic-list, so add allocator functions to the list. most are not referenced anyway, but all are added for completeness.
* use explicit dynamic-list rather than symbolic-functions for linkingRich Felker2018-04-171-0/+35
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 f3ddd173806fd5c60b3f034528ca24542aecc5b9 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.