MCPcopy Create free account
hub / github.com/coreboot/coreboot / populate_sym

Function populate_sym

util/cbfstool/rmodule.c:406–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406static int
407populate_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
435static int populate_rmodule_info(struct rmod_context *ctx)
436{

Callers 1

populate_rmodule_infoFunction · 0.85

Calls 1

strcmpFunction · 0.50

Tested by

no test coverage detected