Add elf_add_plt_entry as a separate entry point
- That calls into OS and ARCH callbacks as required and has the same
interface. This also adds os_elf_add_plt_entry.
- arch_elf_add_func_entry was added as well for symmetry.
diff --git a/ltrace-elf.h b/ltrace-elf.h
index 57ed87d..ea14512 100644
--- a/ltrace-elf.h
+++ b/ltrace-elf.h
@@ -81,6 +81,22 @@
* point address is stored to *ENTRYP. */
struct library *ltelf_read_main_binary(struct process *proc, const char *path);
+/* This is called for every PLT relocation R in ELF file LTE, that
+ * ltrace is about to add to a library constructed in process PROC.
+ * The corresponding PLT entry is for symbol called NAME, and it's
+ * I-th relocation in the file. *RET shall be initialized and
+ * symbol(s) corresponding to the given PLT entry will be added to the
+ * front. Returns 0 for success, or a negative value for failures.
+ *
+ * This calls os_elf_add_plt_entry and arch_elf_add_plt_entry in the
+ * background (see backend.h for documentation). The arch callback is
+ * called first. If it returns PLT_DEFAULT, the os callback is called
+ * next. If that returns PLT_DEFAULT, default_elf_add_plt_entry is
+ * called. */
+int elf_add_plt_entry(struct process *proc, struct ltelf *lte,
+ const char *name, GElf_Rela *rela, size_t idx,
+ struct library_symbol **ret);
+
/* Create a default PLT entry. This can be used instead (or in
* addition to) returning PLT_DEFAULT from arch_elf_add_plt_entry.
* RET shall be initialized, the created symbol will be added to the