Browse Source

ld.so: Expose some internal data for use by debugger

K. Lange 1 year ago
parent
commit
59e0c80b3c
2 changed files with 12 additions and 0 deletions
  1. 2 0
      libc/dlfcn/dlfcn.c
  2. 10 0
      linker/linker.c

+ 2 - 0
libc/dlfcn/dlfcn.c

@@ -26,3 +26,5 @@ int __cxa_atexit(void (*fn)(void *), void * arg, void *d) {
 	return 0;
 }
 
+void __ld_symbol_table(void) { }
+void __ld_objects_table(void) { }

+ 10 - 0
linker/linker.c

@@ -776,6 +776,14 @@ static char * argv_value(void) {
 	return _argv_value;
 }
 
+static uintptr_t dl_symbol_table_ptr_addr(void) {
+	return (uintptr_t)&dumb_symbol_table;
+}
+
+static uintptr_t dl_objects_table_ptr_addr(void) {
+	return (uintptr_t)&objects_map;
+}
+
 /* Exported methods (dlfcn) */
 typedef struct {
 	char * name;
@@ -787,6 +795,8 @@ ld_exports_t ld_builtin_exports[] = {
 	{"dlclose", dlclose_ld},
 	{"dlerror", dlerror_ld},
 	{"__get_argv", argv_value},
+	{"__ld_symbol_table", dl_symbol_table_ptr_addr},
+	{"__ld_objects_table", dl_objects_table_ptr_addr},
 	{NULL, NULL},
 };