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

Function symtab_init

util/cbfstool/elfheaders.c:729–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727}
728
729static void symtab_init(struct elf_writer *ew, size_t max_entries)
730{
731 struct buffer b;
732 Elf64_Shdr shdr;
733
734 memset(&shdr, 0, sizeof(shdr));
735 shdr.sh_type = SHT_SYMTAB;
736
737 if (ew->bit64) {
738 shdr.sh_entsize = sizeof(Elf64_Sym);
739 shdr.sh_addralign = sizeof(Elf64_Addr);
740 } else {
741 shdr.sh_entsize = sizeof(Elf32_Sym);
742 shdr.sh_addralign = sizeof(Elf32_Addr);
743 }
744
745 shdr.sh_size = shdr.sh_entsize * max_entries;
746
747 ew->symtab.syms = calloc(max_entries, sizeof(Elf64_Sym));
748 ew->symtab.num_entries = 1;
749 ew->symtab.max_entries = max_entries;
750
751 buffer_init(&b, NULL, ew->symtab.syms, shdr.sh_size);
752
753 elf_writer_add_section(ew, &shdr, &b, ".symtab");
754 ew->symtab_sec = last_section(ew);
755}
756
757struct elf_writer *elf_writer_init(const Elf64_Ehdr *ehdr)
758{

Callers 1

elf_writer_initFunction · 0.85

Calls 5

buffer_initFunction · 0.85
elf_writer_add_sectionFunction · 0.85
last_sectionFunction · 0.85
memsetFunction · 0.50
callocFunction · 0.50

Tested by

no test coverage detected