1fac669cf3
- Find libraries in LD_LIBRARY_PATH if relative path is found in debug link_map - Skip main executable - Skip /system/bin/linker and [vdso] - Only set proc->e_machine once, as it might be set wrongly if we later try to load library that we couldn't find
31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
diff --git a/ltrace-elf.c b/ltrace-elf.c
|
|
index f439cb0..60f1941 100644
|
|
--- a/ltrace-elf.c
|
|
+++ b/ltrace-elf.c
|
|
@@ -423,7 +423,9 @@ ltelf_destroy(struct ltelf *lte)
|
|
debug(DEBUG_FUNCTION, "close_elf()");
|
|
elf_end(lte->elf);
|
|
close(lte->fd);
|
|
- VECT_DESTROY(<e->plt_relocs, GElf_Rela, NULL, NULL);
|
|
+ if (lte->plt_relocs.elt_size) {
|
|
+ VECT_DESTROY(<e->plt_relocs, GElf_Rela, NULL, NULL);
|
|
+ }
|
|
}
|
|
|
|
static void
|
|
@@ -1149,9 +1151,11 @@ read_module(struct library *lib, struct process *proc,
|
|
* determine whether ABI is supported. This is to get
|
|
* reasonable error messages when trying to run 64-bit binary
|
|
* with 32-bit ltrace. It is desirable to preserve this. */
|
|
- proc->e_machine = lte.ehdr.e_machine;
|
|
- proc->e_class = lte.ehdr.e_ident[EI_CLASS];
|
|
- get_arch_dep(proc);
|
|
+ if (proc->e_machine == 0) {
|
|
+ proc->e_machine = lte.ehdr.e_machine;
|
|
+ proc->e_class = lte.ehdr.e_ident[EI_CLASS];
|
|
+ get_arch_dep(proc);
|
|
+ }
|
|
|
|
/* Find out the base address. For PIE main binaries we look
|
|
* into auxv, otherwise we scan phdrs. */
|