From 6af943a484ba1a7b62c04544c8ba359444dd46a7 Mon Sep 17 00:00:00 2001 From: marcel Date: Sat, 19 Oct 2002 18:43:37 +0000 Subject: Non-functional change in preparation of the next commit: Move link_elf_add_gdb(), link_elf_delete_gdb() and link_elf_error() near the top of the file. The *_gdb() functions are moved inside the #ifdef DDB already present there. --- sys/kern/link_elf.c | 77 +++++++++++++++++++++++-------------------------- sys/kern/link_elf_obj.c | 77 +++++++++++++++++++++++-------------------------- 2 files changed, 72 insertions(+), 82 deletions(-) (limited to 'sys') 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) -- cgit v1.1