linker: clarify comments in call_ifunc_resolvers().

Change-Id: I5a9b9d5ab9d1acdcd574f079edc79a1749f1905c
This commit is contained in:
Elliott Hughes 2024-03-28 14:54:30 +00:00
parent 8ba5f48907
commit f67f27b040

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) {