diff options
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/Symbol.map | 1 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/libexec/rtld-elf/Symbol.map b/libexec/rtld-elf/Symbol.map index 9ad6251..5ea7d7e 100644 --- a/libexec/rtld-elf/Symbol.map +++ b/libexec/rtld-elf/Symbol.map @@ -30,4 +30,5 @@ FBSDprivate_1.0 { _rtld_atfork_post; _rtld_addr_phdr; _rtld_get_stack_prot; + _r_debug_postinit; }; diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index ad37745..344a6d9 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -161,6 +161,7 @@ static bool matched_symbol(SymLook *, const Obj_Entry *, Sym_Match_Result *, const unsigned long); void r_debug_state(struct r_debug *, struct link_map *) __noinline; +void _r_debug_postinit(struct link_map *) __noinline; /* * Data declarations. @@ -635,6 +636,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) if (obj_main->crt_no_init) preinit_main(); objlist_call_init(&initlist, &lockstate); + _r_debug_postinit(&obj_main->linkmap); objlist_clear(&initlist); dbg("loading filtees"); for (obj = obj_list->next; obj != NULL; obj = obj->next) { @@ -3497,7 +3499,20 @@ r_debug_state(struct r_debug* rd, struct link_map *m) * even when marked __noinline. However, gdb depends on those * calls being made. */ - __asm __volatile("" : : : "memory"); + __compiler_membar(); +} + +/* + * A function called after init routines have completed. This can be used to + * break before a program's entry routine is called, and can be used when + * main is not available in the symbol table. + */ +void +_r_debug_postinit(struct link_map *m) +{ + + /* See r_debug_state(). */ + __compiler_membar(); } /* |