Add IFUNC support for arm64 and IRELATIVE reloc
There are number of changes in the way IFUNC related relocations are done:
1. IRELATIVE relocations are now supported for x86/x86_64 and arm64.
2. IFUNC relocations are now relying on static linker to generate
them in correct order - this removes necessety of additional
relocation pass for ifuncs.
3. Related to 2: rela?.dyn relocations are preformed before .plt ones.
4. Ifunc are resolved on symbol lookup this approach allowed to avoid
mprotect(PROT_WRITE) call on r-x program segments.
Bug: 17399706
Bug: 17177284
(cherry picked from commit 9aea164457c269c475592da36b4655d45f55c7bc)
Change-Id: Ie19d900fc203beb93faf8943b0d06d534a6de4ad
diff --git a/libc/arch-x86_64/include/machine/elf_machdep.h b/libc/arch-x86_64/include/machine/elf_machdep.h
index 20f8c6d..bf1f273 100644
--- a/libc/arch-x86_64/include/machine/elf_machdep.h
+++ b/libc/arch-x86_64/include/machine/elf_machdep.h
@@ -46,6 +46,8 @@
#define R_X86_64_GOTTPOFF 22
#define R_X86_64_TPOFF32 23
+#define R_X86_64_IRELATIVE 37
+
#define R_TYPE(name) __CONCAT(R_X86_64_,name)
#else /* !__i386__ */