| 433 | } |
| 434 | |
| 435 | static int populate_rmodule_info(struct rmod_context *ctx) |
| 436 | { |
| 437 | int i; |
| 438 | struct parsed_elf *pelf; |
| 439 | Elf64_Ehdr *ehdr; |
| 440 | int nsyms; |
| 441 | |
| 442 | pelf = &ctx->pelf; |
| 443 | ehdr = &pelf->ehdr; |
| 444 | |
| 445 | /* Determine number of symbols. */ |
| 446 | nsyms = 0; |
| 447 | for (i = 0; i < ehdr->e_shnum; i++) { |
| 448 | if (pelf->shdr[i].sh_type != SHT_SYMTAB) |
| 449 | continue; |
| 450 | |
| 451 | nsyms = pelf->shdr[i].sh_size / pelf->shdr[i].sh_entsize; |
| 452 | break; |
| 453 | } |
| 454 | |
| 455 | if (populate_sym(ctx, "_rmodule_params", &ctx->parameters_begin, nsyms, 1)) |
| 456 | return -1; |
| 457 | |
| 458 | if (populate_sym(ctx, "_ermodule_params", &ctx->parameters_end, nsyms, 1)) |
| 459 | return -1; |
| 460 | |
| 461 | if (populate_sym(ctx, "_bss", &ctx->bss_begin, nsyms, 0)) |
| 462 | return -1; |
| 463 | |
| 464 | if (populate_sym(ctx, "_ebss", &ctx->bss_end, nsyms, 0)) |
| 465 | return -1; |
| 466 | |
| 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | static int |
| 471 | add_section(struct elf_writer *ew, struct buffer *data, const char *name, |
no test coverage detected