ltrace: Fix incompatibilities with Android linker
[termux-packages] / disabled-packages / ltrace / ltrace-elf.c.patch
index eaa1812..7e5f824 100644 (file)
@@ -1,6 +1,8 @@
---- ltrace-2def9f1217374cc8371105993003b2c663aefda7/ltrace-elf.c       2016-04-11 21:30:04.000000000 +0200
-+++ src/ltrace-elf.c   2016-05-07 21:23:17.999754862 +0200
-@@ -423,7 +423,9 @@
+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);
  }
  
  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.  */