Changeset 985e0f15 in mainline
- Timestamp:
- 2019-05-18T21:42:02Z (6 years ago)
- Children:
- 87bc11f
- Parents:
- 1e8b633
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-05-17 13:04:30)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-05-18 21:42:02)
- Location:
- uspace/lib/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/dlfcn.c
r1e8b633 r985e0f15 35 35 */ 36 36 37 #include <errno.h> 37 38 #include <stdio.h> 38 39 #include <stdlib.h> … … 53 54 if (m == NULL) { 54 55 m = module_load(runtime_env, path, mlf_local); 55 module_load_deps(m, mlf_local); 56 if (module_load_deps(m, mlf_local) != EOK) { 57 return NULL; 58 } 59 56 60 /* Now relocate. */ 57 61 module_process_relocs(m); -
uspace/lib/c/generic/rtld/module.c
r1e8b633 r985e0f15 187 187 if (m == NULL) { 188 188 printf("malloc failed\n"); 189 exit(1);189 goto error; 190 190 } 191 191 … … 198 198 if (str_size(name) > NAME_BUF_SIZE - 2) { 199 199 printf("soname too long. increase NAME_BUF_SIZE\n"); 200 exit(1);200 goto error; 201 201 } 202 202 … … 210 210 if (rc != EE_OK) { 211 211 printf("Failed to load '%s'\n", name_buf); 212 exit(1);212 goto error; 213 213 } 214 214 … … 220 220 printf("Error: '%s' is not a dynamically-linked object.\n", 221 221 name_buf); 222 exit(1);222 goto error; 223 223 } 224 224 … … 243 243 244 244 return m; 245 246 error: 247 if (m) 248 free(m); 249 250 return NULL; 245 251 } 246 252 247 253 /** Load all modules on which m (transitively) depends. 248 254 */ 249 voidmodule_load_deps(module_t *m, mlflags_t flags)255 errno_t module_load_deps(module_t *m, mlflags_t flags) 250 256 { 251 257 elf_dyn_t *dp; … … 274 280 /* There are no dependencies, so we are done. */ 275 281 m->deps = NULL; 276 return ;282 return EOK; 277 283 } 278 284 … … 280 286 if (!m->deps) { 281 287 printf("malloc failed\n"); 282 exit(1);288 return ENOMEM; 283 289 } 284 290 … … 294 300 if (!dm) { 295 301 dm = module_load(m->rtld, dep_name, flags); 296 module_load_deps(dm, flags); 302 errno_t rc = module_load_deps(dm, flags); 303 if (rc != EOK) { 304 return rc; 305 } 297 306 } 298 307 … … 302 311 ++dp; 303 312 } 313 314 return EOK; 304 315 } 305 316 -
uspace/lib/c/generic/rtld/rtld.c
r1e8b633 r985e0f15 125 125 126 126 DPRINTF("Load all program dependencies\n"); 127 module_load_deps(prog, 0); 127 errno_t rc = module_load_deps(prog, 0); 128 if (rc != EOK) { 129 return rc; 130 } 128 131 129 132 /* Compute static TLS size */ -
uspace/lib/c/include/rtld/module.h
r1e8b633 r985e0f15 45 45 extern module_t *module_find(rtld_t *, const char *); 46 46 extern module_t *module_load(rtld_t *, const char *, mlflags_t); 47 extern voidmodule_load_deps(module_t *, mlflags_t);47 extern errno_t module_load_deps(module_t *, mlflags_t); 48 48 extern module_t *module_by_id(rtld_t *, unsigned long); 49 49
Note:
See TracChangeset
for help on using the changeset viewer.