diff options
author | Petr Machata <pmachata@redhat.com> | 2013-11-04 17:01:43 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2013-11-04 17:01:43 +0100 |
commit | 0ed5399f5cbb2b505a95bcac634c0ad5d7bbd6b8 (patch) | |
tree | c5119054ff584415d2817f7f1915b31e34ff5272 | |
parent | d8286ed3496bcd69cd4796f57a5b5c04859d2378 (diff) | |
download | ltrace-0ed5399f5cbb2b505a95bcac634c0ad5d7bbd6b8.tar.gz |
Properly publish read_relplt interface, rename it to elf_read_relocs
-rw-r--r-- | ltrace-elf.c | 8 | ||||
-rw-r--r-- | ltrace-elf.h | 6 | ||||
-rw-r--r-- | sysdeps/linux-gnu/ppc/plt.c | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/ltrace-elf.c b/ltrace-elf.c index a468ee3..9100c46 100644 --- a/ltrace-elf.c +++ b/ltrace-elf.c @@ -505,8 +505,8 @@ rel_to_rela(struct ltelf *lte, const GElf_Rel *rel, GElf_Rela *rela) } int -read_relplt(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr, - struct vect *rela_vec) +elf_read_relocs(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr, + struct vect *rela_vec) { if (vect_reserve_additional(rela_vec, lte->ehdr.e_shnum) < 0) return -1; @@ -661,8 +661,8 @@ ltelf_read_elf(struct ltelf *lte, const char *filename) } if (shdr.sh_addr == relplt_addr && shdr.sh_size == relplt_size) { - if (read_relplt(lte, scn, &shdr, - <e->plt_relocs) < 0) { + if (elf_read_relocs(lte, scn, &shdr, + <e->plt_relocs) < 0) { fprintf(stderr, "Couldn't get .rel*.plt" " data from \"%s\": %s\n", filename, elf_errmsg(-1)); diff --git a/ltrace-elf.h b/ltrace-elf.h index 8e3da5a..57ed87d 100644 --- a/ltrace-elf.h +++ b/ltrace-elf.h @@ -117,6 +117,12 @@ struct elf_each_symbol_t { void *data), void *data); +/* Read relocations from relocation section SCN with header SHDR and + * add them to RELA_VEC, which is a vector of GElf_Rela. Return 0 on + * success, or a negative value on failure. */ +int elf_read_relocs(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr, + struct vect *rela_vec); + /* Read, respectively, 1, 2, 4, or 8 bytes from Elf data at given * OFFSET, and store it in *RETP. Returns 0 on success or a negative * value if there's not enough data. */ diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c index 45b7f7b..8b8b68c 100644 --- a/sysdeps/linux-gnu/ppc/plt.c +++ b/sysdeps/linux-gnu/ppc/plt.c @@ -587,8 +587,6 @@ arch_elf_init(struct ltelf *lte, struct library *lib) * section, and as such are stored in .rela.dyn (where all * non-PLT relocations are stored) instead of .rela.plt. Add * these to lte->plt_relocs. */ - extern int read_relplt(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr, - struct vect *ret); GElf_Addr rela, relasz; Elf_Scn *rela_sec; @@ -601,7 +599,7 @@ arch_elf_init(struct ltelf *lte, struct library *lib) struct vect v; VECT_INIT(&v, GElf_Rela); - int ret = read_relplt(lte, rela_sec, &rela_shdr, &v); + int ret = elf_read_relocs(lte, rela_sec, &rela_shdr, &v); if (ret >= 0 && VECT_EACH(&v, GElf_Rela, NULL, reloc_copy_if_irelative, lte) != NULL) |