+
+static int elf_find_section(char *map, const char *section, unsigned int *offset, unsigned int *size)
+{
+ int clazz = map[EI_CLASS];
+
+ if (clazz == ELFCLASS32)
+ return elf32_find_section(map, section, offset, size);
+ else if (clazz == ELFCLASS64)
+ return elf64_find_section(map, section, offset, size);
+
+ ULOG_ERR("unknown elf format %d\n", clazz);
+
+ return -1;
+}
+
+static struct module_node *
+alloc_module_node(const char *name, struct module *m, bool is_alias)
+{
+ struct module_node *mn;
+ char *_name;
+
+ mn = calloc_a(sizeof(*mn),
+ &_name, strlen(name) + 1);
+ if (mn) {
+ mn->avl.key = strcpy(_name, name);
+ mn->m = m;
+ mn->is_alias = is_alias;
+ avl_insert(&modules, &mn->avl);
+ m->refcnt += 1;
+ }
+ return mn;
+}