summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/link_elf.c77
-rw-r--r--sys/kern/link_elf_obj.c77
2 files changed, 72 insertions, 82 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 596089a..6bab281 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -160,7 +160,36 @@ r_debug_state(struct r_debug *dummy_one __unused,
{
}
-#endif
+static void
+link_elf_add_gdb(struct link_map *l)
+{
+ struct link_map *prev;
+
+ /*
+ * Scan to the end of the list.
+ */
+ for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next)
+ ;
+
+ /* Link in the new entry. */
+ l->l_prev = prev;
+ l->l_next = prev->l_next;
+ prev->l_next = l;
+}
+
+static void
+link_elf_delete_gdb(struct link_map *l)
+{
+ if (l->l_prev == NULL) {
+ if ((r_debug.r_map = l->l_next) != NULL)
+ l->l_next->l_prev = NULL;
+ return;
+ }
+
+ if ((l->l_prev->l_next = l->l_next) != NULL)
+ l->l_next->l_prev = l->l_prev;
+}
+#endif /* DDB */
#ifdef __ia64__
Elf_Addr link_elf_get_gp(linker_file_t);
@@ -172,6 +201,12 @@ Elf_Addr link_elf_get_gp(linker_file_t);
extern struct _dynamic _DYNAMIC;
static void
+link_elf_error(const char *s)
+{
+ printf("kldload: %s\n", s);
+}
+
+static void
link_elf_init(void* arg)
{
Elf_Dyn *dp;
@@ -378,46 +413,6 @@ parse_dynamic(elf_file_t ef)
return 0;
}
-static void
-link_elf_error(const char *s)
-{
- printf("kldload: %s\n", s);
-}
-
-#ifdef DDB
-
-static void
-link_elf_add_gdb(struct link_map *l)
-{
- struct link_map *prev;
-
- /*
- * Scan to the end of the list.
- */
- for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next)
- ;
-
- /* Link in the new entry. */
- l->l_prev = prev;
- l->l_next = prev->l_next;
- prev->l_next = l;
-}
-
-static void
-link_elf_delete_gdb(struct link_map *l)
-{
- if (l->l_prev == NULL) {
- if ((r_debug.r_map = l->l_next) != NULL)
- l->l_next->l_prev = NULL;
- return;
- }
-
- if ((l->l_prev->l_next = l->l_next) != NULL)
- l->l_next->l_prev = l->l_prev;
-}
-
-#endif /* DDB */
-
static int
link_elf_link_preload(linker_class_t cls,
const char* filename, linker_file_t *result)
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index 596089a..6bab281 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -160,7 +160,36 @@ r_debug_state(struct r_debug *dummy_one __unused,
{
}
-#endif
+static void
+link_elf_add_gdb(struct link_map *l)
+{
+ struct link_map *prev;
+
+ /*
+ * Scan to the end of the list.
+ */
+ for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next)
+ ;
+
+ /* Link in the new entry. */
+ l->l_prev = prev;
+ l->l_next = prev->l_next;
+ prev->l_next = l;
+}
+
+static void
+link_elf_delete_gdb(struct link_map *l)
+{
+ if (l->l_prev == NULL) {
+ if ((r_debug.r_map = l->l_next) != NULL)
+ l->l_next->l_prev = NULL;
+ return;
+ }
+
+ if ((l->l_prev->l_next = l->l_next) != NULL)
+ l->l_next->l_prev = l->l_prev;
+}
+#endif /* DDB */
#ifdef __ia64__
Elf_Addr link_elf_get_gp(linker_file_t);
@@ -172,6 +201,12 @@ Elf_Addr link_elf_get_gp(linker_file_t);
extern struct _dynamic _DYNAMIC;
static void
+link_elf_error(const char *s)
+{
+ printf("kldload: %s\n", s);
+}
+
+static void
link_elf_init(void* arg)
{
Elf_Dyn *dp;
@@ -378,46 +413,6 @@ parse_dynamic(elf_file_t ef)
return 0;
}
-static void
-link_elf_error(const char *s)
-{
- printf("kldload: %s\n", s);
-}
-
-#ifdef DDB
-
-static void
-link_elf_add_gdb(struct link_map *l)
-{
- struct link_map *prev;
-
- /*
- * Scan to the end of the list.
- */
- for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next)
- ;
-
- /* Link in the new entry. */
- l->l_prev = prev;
- l->l_next = prev->l_next;
- prev->l_next = l;
-}
-
-static void
-link_elf_delete_gdb(struct link_map *l)
-{
- if (l->l_prev == NULL) {
- if ((r_debug.r_map = l->l_next) != NULL)
- l->l_next->l_prev = NULL;
- return;
- }
-
- if ((l->l_prev->l_next = l->l_next) != NULL)
- l->l_next->l_prev = l->l_prev;
-}
-
-#endif /* DDB */
-
static int
link_elf_link_preload(linker_class_t cls,
const char* filename, linker_file_t *result)
OpenPOWER on IntegriCloud