Merge "linker: clarify comments in call_ifunc_resolvers()." into main

This commit is contained in:
Treehugger Robot 2024-03-28 20:07:49 +00:00 committed by Gerrit Code Review
commit 8827343088

View file

@ -636,8 +636,8 @@ static void call_ifunc_resolvers_for_section(RelType* begin, RelType* end) {
}
static void call_ifunc_resolvers() {
// Find the IRELATIVE relocations using the DT_JMPREL and DT_PLTRELSZ, or DT_RELA? and DT_RELA?SZ
// dynamic tags.
// Find the IRELATIVE relocations using the DT_JMPREL and DT_PLTRELSZ, or
// DT_RELA/DT_RELASZ (DT_REL/DT_RELSZ on ILP32).
auto ehdr = reinterpret_cast<ElfW(Addr)>(&__ehdr_start);
auto* phdr = reinterpret_cast<ElfW(Phdr)*>(ehdr + __ehdr_start.e_phoff);
for (size_t i = 0; i != __ehdr_start.e_phnum; ++i) {
@ -647,7 +647,7 @@ static void call_ifunc_resolvers() {
auto *dyn = reinterpret_cast<ElfW(Dyn)*>(ehdr + phdr[i].p_vaddr);
ElfW(Addr) pltrel = 0, pltrelsz = 0, rel = 0, relsz = 0;
for (size_t j = 0, size = phdr[i].p_filesz / sizeof(ElfW(Dyn)); j != size; ++j) {
// We can't handle IRELATIVE relocations in DT_ANDROID_REL[A].
// We don't currently handle IRELATIVE relocations in DT_ANDROID_REL[A].
// We disabled DT_ANDROID_REL[A] at build time; verify that it was actually disabled.
CHECK(dyn[j].d_tag != DT_ANDROID_REL && dyn[j].d_tag != DT_ANDROID_RELA);
if (dyn[j].d_tag == DT_JMPREL) {