Full support of IFUNC tracing on PPC32
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index 220486c..e648b8f 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -1291,8 +1291,8 @@
return i < 0 ? PLT_FAIL : PLT_OK;
}
-static struct prototype *
-void_prototype(void)
+struct prototype *
+linux_IFUNC_prototype(void)
{
static struct prototype ret;
if (ret.return_info == NULL) {
@@ -1323,6 +1323,18 @@
return 0;
}
+char *
+linux_append_IFUNC_to_name(const char *name)
+{
+#define S ".IFUNC"
+ char *tmp_name = malloc(strlen(name) + sizeof S);
+ if (tmp_name == NULL)
+ return NULL;
+ sprintf(tmp_name, "%s%s", name, S);
+#undef S
+ return tmp_name;
+}
+
enum plt_status
os_elf_add_func_entry(struct process *proc, struct ltelf *lte,
const GElf_Sym *sym,
@@ -1338,8 +1350,7 @@
#endif
if (ifunc) {
-#define S ".IFUNC"
- char *tmp_name = malloc(strlen(name) + sizeof S);
+ char *tmp_name = linux_append_IFUNC_to_name(name);
struct library_symbol *tmp = malloc(sizeof *tmp);
if (tmp_name == NULL || tmp == NULL) {
fail:
@@ -1347,13 +1358,11 @@
free(tmp);
return PLT_FAIL;
}
- sprintf(tmp_name, "%s%s", name, S);
-#undef S
if (library_symbol_init(tmp, addr, tmp_name, 1,
LS_TOPLT_NONE) < 0)
goto fail;
- tmp->proto = void_prototype();
+ tmp->proto = linux_IFUNC_prototype();
tmp->os.is_ifunc = 1;
*ret = tmp;