File ltrace-ppc64le_git11.patch of Package ltrace

--- sysdeps/linux-gnu/trace.c.ori
+++ sysdeps/linux-gnu/trace.c
@@ -1240,17 +1240,14 @@ irelative_name_cb(GElf_Sym *symbol, const char *name, void *d)
 	return CBS_CONT;
 }
 
-enum plt_status
-linux_elf_add_plt_entry_irelative(struct Process *proc, struct ltelf *lte,
-				  GElf_Rela *rela, size_t ndx,
-				  struct library_symbol **ret)
-
+char *
+linux_elf_find_irelative_name(struct ltelf *lte, GElf_Rela *rela)
 {
 	struct irelative_name_data_t data = { rela->r_addend, NULL };
 	if (rela->r_addend != 0
 	    && elf_each_symbol(lte, 0,
 			       irelative_name_cb, &data).status < 0)
-		return -1;
+		return NULL;
 
 	const char *name;
 	if (data.found_name != NULL) {
@@ -1265,8 +1262,17 @@ linux_elf_add_plt_entry_irelative(struct Process *proc, struct ltelf *lte,
 #undef NAME
 	}
 
-	if (default_elf_add_plt_entry(proc, lte, name, rela, ndx, ret) < 0)
-		return plt_fail;
+	return strdup(name);
+}
 
-	return plt_ok;
+enum plt_status
+linux_elf_add_plt_entry_irelative(struct Process *proc, struct ltelf *lte,
+				  GElf_Rela *rela, size_t ndx,
+				  struct library_symbol **ret)
+
+{
+	char *name = linux_elf_find_irelative_name(lte, rela);
+	int i = default_elf_add_plt_entry(proc, lte, name, rela, ndx, ret);
+	free(name);
+	return i < 0 ? plt_fail : plt_ok;
 }
--- sysdeps/linux-gnu/trace.h.ori
+++ sysdeps/linux-gnu/trace.h
@@ -136,4 +136,10 @@ enum plt_status linux_elf_add_plt_entry_irelative(struct Process *proc,
 						  GElf_Rela *rela, size_t ndx,
 						  struct library_symbol **ret);
 
+/* Service routine of the above.  Determines a name corresponding to
+ * RELA, or invents a new one.  Returns NULL on failures, otherwise it
+ * returns a malloc'd pointer that the caller is responsible for
+ * freeing.  */
+char *linux_elf_find_irelative_name(struct ltelf *lte, GElf_Rela *rela);
+
 #endif /* _LTRACE_LINUX_TRACE_H_ */