aboutsummaryrefslogtreecommitdiff
path: root/library.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-04-17 03:07:04 +0200
committerPetr Machata <pmachata@redhat.com>2012-04-19 01:53:59 +0200
commit994ad6d3da0bea9bed176ce600ec513bfca238c2 (patch)
treed2e4c1b12a84bfc63ef6e1a61bc1e0c0bc7705e0 /library.c
parent05058b79e6f995e4d328952ecd73cf090d89cb13 (diff)
downloadltrace-994ad6d3da0bea9bed176ce600ec513bfca238c2.tar.gz
Add ARCH_HAVE_LIBRARY_DATA customization point
Diffstat (limited to 'library.c')
-rw-r--r--library.c74
1 files changed, 51 insertions, 23 deletions
diff --git a/library.c b/library.c
index 1e6dbb9..92fccea 100644
--- a/library.c
+++ b/library.c
@@ -29,6 +29,43 @@
#include "debug.h"
#include "common.h" // for arch_library_symbol_init, arch_library_init
+#ifndef ARCH_HAVE_LIBRARY_DATA
+void
+arch_library_init(struct library *lib)
+{
+}
+
+void
+arch_library_destroy(struct library *lib)
+{
+}
+
+void
+arch_library_clone(struct library *retp, struct library *lib)
+{
+}
+#endif
+
+#ifndef ARCH_HAVE_LIBRARY_SYMBOL_DATA
+int
+arch_library_symbol_init(struct library_symbol *libsym)
+{
+ return 0;
+}
+
+void
+arch_library_symbol_destroy(struct library_symbol *libsym)
+{
+}
+
+int
+arch_library_symbol_clone(struct library_symbol *retp,
+ struct library_symbol *libsym)
+{
+ return 0;
+}
+#endif
+
unsigned int
target_address_hash(const void *key)
{
@@ -71,26 +108,6 @@ strdup_if_owned(const char **retp, const char *str, int owned)
}
}
-#ifndef ARCH_HAVE_LIBRARY_SYMBOL_DATA
-int
-arch_library_symbol_init(struct library_symbol *libsym)
-{
- return 0;
-}
-
-void
-arch_library_symbol_destroy(struct library_symbol *libsym)
-{
-}
-
-int
-arch_library_symbol_clone(struct library_symbol *retp,
- struct library_symbol *libsym)
-{
- return 0;
-}
-#endif
-
static void
private_library_symbol_init(struct library_symbol *libsym,
target_address_t addr,
@@ -185,8 +202,9 @@ library_symbol_equal_cb(struct library_symbol *libsym, void *u)
return library_symbol_cmp(libsym, standard) == 0 ? CBS_STOP : CBS_CONT;
}
-void
-library_init(struct library *lib, enum library_type type)
+
+static void
+private_library_init(struct library *lib, enum library_type type)
{
lib->next = NULL;
lib->soname = NULL;
@@ -197,6 +215,13 @@ library_init(struct library *lib, enum library_type type)
lib->type = type;
}
+void
+library_init(struct library *lib, enum library_type type)
+{
+ private_library_init(lib, type);
+ arch_library_init(lib);
+}
+
int
library_clone(struct library *retp, struct library *lib)
{
@@ -210,9 +235,10 @@ library_clone(struct library *retp, struct library *lib)
return -1;
}
- library_init(retp, lib->type);
+ private_library_init(retp, lib->type);
library_set_soname(retp, soname, lib->own_soname);
library_set_soname(retp, pathname, lib->own_pathname);
+ arch_library_clone(retp, lib);
struct library_symbol *it;
struct library_symbol **nsymp = &retp->symbols;
@@ -236,6 +262,8 @@ library_destroy(struct library *lib)
{
if (lib == NULL)
return;
+
+ arch_library_destroy(lib);
library_set_soname(lib, NULL, 0);
library_set_pathname(lib, NULL, 0);