static void _elf64_update_shdr(Elf * elf, size_t index) { Elf64_Shdr *shdr; Elf_Scn *scn; ((Elf64_Ehdr *) elf->e_ehdr)->e_shnum = elf->e_scn_n->s_index + 1; for (scn = elf->e_scn_1; scn; scn = scn->s_link) { shdr = &scn->s_shdr64; switch (shdr->sh_type) { case SHT_REL: case SHT_RELA: shdr->sh_info = _newindex(shdr->sh_info, index); /* fall through */ case SHT_DYNSYM: case SHT_DYNAMIC: case SHT_HASH: case SHT_SYMTAB: #if __LIBELF_SYMBOL_VERSIONS #if __LIBELF_SUN_SYMBOL_VERSIONS case SHT_SUNW_verdef: case SHT_SUNW_verneed: case SHT_SUNW_versym: #else /* __LIBELF_SUN_SYMBOL_VERSIONS */ case SHT_GNU_verdef: case SHT_GNU_verneed: case SHT_GNU_versym: #endif /* __LIBELF_SUN_SYMBOL_VERSIONS */ #endif /* __LIBELF_SYMBOL_VERSIONS */ shdr->sh_link = _newindex(shdr->sh_link, index); /* fall through */ default: break; } } }
static void _cgcef32_update_shdr(CGCEf *cgcef, size_t index) { CGCEf32_Shdr *shdr; CGCEf_Scn *scn; ((CGCEf32_Ehdr*)cgcef->e_ehdr)->e_shnum = cgcef->e_scn_n->s_index + 1; for (scn = cgcef->e_scn_1; scn; scn = scn->s_link) { shdr = &scn->s_shdr32; switch (shdr->sh_type) { case SHT_REL: case SHT_RELA: shdr->sh_info = _newindex(shdr->sh_info, index); /* fall through */ case SHT_DYNSYM: case SHT_DYNAMIC: case SHT_HASH: case SHT_SYMTAB: #if __LIBCGCEF_SYMBOL_VERSIONS #if __LIBCGCEF_SUN_SYMBOL_VERSIONS case SHT_SUNW_verdef: case SHT_SUNW_verneed: case SHT_SUNW_versym: #else /* __LIBCGCEF_SUN_SYMBOL_VERSIONS */ case SHT_GNU_verdef: case SHT_GNU_verneed: case SHT_GNU_versym: #endif /* __LIBCGCEF_SUN_SYMBOL_VERSIONS */ #endif /* __LIBCGCEF_SYMBOL_VERSIONS */ shdr->sh_link = _newindex(shdr->sh_link, index); /* fall through */ default: break; } } }