| 404 | } |
| 405 | |
| 406 | static int |
| 407 | populate_sym(struct rmod_context *ctx, const char *sym_name, Elf64_Addr *addr, |
| 408 | int nsyms, int optional) |
| 409 | { |
| 410 | int i; |
| 411 | Elf64_Sym *syms; |
| 412 | |
| 413 | syms = ctx->pelf.syms; |
| 414 | |
| 415 | for (i = 0; i < nsyms; i++) { |
| 416 | if (syms[i].st_name == 0) |
| 417 | continue; |
| 418 | if (strcmp(sym_name, &ctx->strtab[syms[i].st_name])) |
| 419 | continue; |
| 420 | DEBUG("%s -> 0x%llx\n", sym_name, (long long)syms[i].st_value); |
| 421 | *addr = syms[i].st_value; |
| 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | if (optional) { |
| 426 | DEBUG("optional symbol '%s' not found.\n", sym_name); |
| 427 | *addr = 0; |
| 428 | return 0; |
| 429 | } |
| 430 | |
| 431 | ERROR("symbol '%s' not found.\n", sym_name); |
| 432 | return -1; |
| 433 | } |
| 434 | |
| 435 | static int populate_rmodule_info(struct rmod_context *ctx) |
| 436 | { |
no test coverage detected