summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/malloc_hooks.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2019-11-01 17:18:28 -0700
committerRyan Prichard <rprichard@google.com>2019-11-05 10:41:15 -0800
commit772bcbb0c2f7a87b18021849528240ef0c617d94 (patch)
tree5602c9b665f11d5c062b81dceb76150544d0a27e /libc/malloc_hooks/malloc_hooks.cpp
parent5adf402ee9d65c803b71d93b9e3de77b36ccb027 (diff)
Use ifuncs in the linker
Using ifuncs allows the linker to select faster versions of libc functions like strcmp, making linking faster. The linker continues to first initialize TLS, then call the ifunc resolvers. There are small amounts of code in Bionic that need to avoid calling functions selected using ifuncs (generally string.h APIs). I've tried to compile those pieces with -ffreestanding. Maybe it's unnecessary, but maybe it could help avoid compiler-inserted memset calls, and maybe it will be useful later on. The ifuncs are called in a special early pass using special __rel[a]_iplt_start / __rel[a]_iplt_end symbols. The linker will encounter the ifuncs again as R_*_IRELATIVE dynamic relocations, so they're skipped on the second pass. Break linker_main.cpp into its own liblinker_main library so it can be compiled with -ffreestanding. On walleye, this change fixes a recent 2.3% linker64 start-up time regression (156.6ms -> 160.2ms), but it also helps the 32-bit time by about 1.9% on the same benchmark. I'm measuring the run-time using a synthetic benchmark based on loading libandroid_servers.so. Test: bionic unit tests, manual benchmarking Bug: none Change-Id: Ieb9446c2df13a66fc0d377596756becad0af6995
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
0 files changed, 0 insertions, 0 deletions