/third_party/elfutils/tests/ |
D | update4.c | 44 Elf32_Shdr *shdr; in main() local 123 shdr = elf32_getshdr (scn); in main() 124 if (shdr == NULL) in main() 132 shdr->sh_type = SHT_PROGBITS; in main() 133 shdr->sh_flags = SHF_ALLOC | SHF_EXECINSTR; in main() 134 shdr->sh_addr = 0; in main() 135 shdr->sh_link = 0; in main() 136 shdr->sh_info = 0; in main() 137 shdr->sh_entsize = 1; in main() 159 shdr = elf32_getshdr (scn); in main() [all …]
|
D | addsections.c | 134 GElf_Shdr *shdr = gelf_getshdr (shstrtab_scn, &shdr_mem); in add_sections() local 135 if (shdr == NULL) in add_sections() 142 size_t shstrtab_idx = shdr->sh_name; in add_sections() 143 shdr->sh_name = old_shstrtab_idx; in add_sections() 145 if (gelf_update_shdr (shstrtab_scn, shdr) == 0) in add_sections() 196 shdr = gelf_getshdr (scn, &shdr_mem); in add_sections() 197 if (shdr == NULL) in add_sections() 204 shdr->sh_type = SHT_PROGBITS; in add_sections() 205 shdr->sh_flags = 0; in add_sections() 206 shdr->sh_addr = 0; in add_sections() [all …]
|
D | asm-tst1.c | 159 GElf_Shdr *shdr; in main() local 169 shdr = gelf_getshdr (scn, &shdr_mem); in main() 170 if (shdr == NULL) in main() 178 if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 182 elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 187 if (shdr->sh_type != (cnt == 3 ? SHT_STRTAB : SHT_PROGBITS)) in main() 193 if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_EXECINSTR)) in main() 194 || (cnt == 2 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) in main() 195 || (cnt == 3 && shdr->sh_flags != 0)) in main() 201 if (shdr->sh_addr != 0) in main() [all …]
|
D | asm-tst2.c | 175 GElf_Shdr *shdr; in main() local 185 shdr = gelf_getshdr (scn, &shdr_mem); in main() 186 if (shdr == NULL) in main() 194 if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 198 elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 203 if (shdr->sh_type != (cnt == 2 ? SHT_STRTAB : SHT_PROGBITS)) in main() 209 if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) in main() 210 || (cnt == 2 && shdr->sh_flags != 0)) in main() 216 if (shdr->sh_addr != 0) in main() 222 if ((cnt == 1 && shdr->sh_offset != ((sizeof (Elf32_Ehdr) + 15) & ~15)) in main() [all …]
|
D | fillfile.c | 80 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in create_strtab() local 81 if (shdr == NULL) in create_strtab() 88 shdr->sh_type = SHT_STRTAB; in create_strtab() 89 shdr->sh_flags = 0; in create_strtab() 90 shdr->sh_addr = 0; in create_strtab() 91 shdr->sh_link = SHN_UNDEF; in create_strtab() 92 shdr->sh_info = SHN_UNDEF; in create_strtab() 93 shdr->sh_addralign = 1; in create_strtab() 94 shdr->sh_entsize = 0; in create_strtab() 95 shdr->sh_name = add_strtab_entry (scn, ".strtab"); in create_strtab() [all …]
|
D | asm-tst9.c | 209 GElf_Shdr *shdr; in main() local 219 shdr = gelf_getshdr (escn, &shdr_mem); in main() 220 if (shdr == NULL) in main() 228 if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 232 elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in main() 237 if (shdr->sh_type != (cnt == 2 ? SHT_STRTAB : SHT_PROGBITS)) in main() 243 if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) in main() 244 || (cnt == 2 && shdr->sh_flags != 0)) in main() 250 if (shdr->sh_addr != 0) in main() 256 if ((cnt == 1 && shdr->sh_offset != ((sizeof (Elf32_Ehdr) + 15) & ~15)) in main() [all …]
|
D | sectiondump.c | 82 GElf_Shdr *shdr; in handle_section() local 88 shdr = gelf_getshdr (scn, &shdr_mem); in handle_section() 89 if (ehdr == NULL || shdr == NULL) in handle_section() 103 elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), in handle_section() 104 shdr->sh_type, in handle_section() 105 shdr->sh_flags, in handle_section() 106 shdr->sh_addr, in handle_section() 107 shdr->sh_offset, in handle_section() 108 shdr->sh_size, in handle_section() 109 shdr->sh_link, in handle_section() [all …]
|
D | alldts.c | 132 Elf32_Shdr *shdr = elf32_getshdr (scn); in main() local 133 if (shdr == NULL) in main() 143 const Elf32_Off *const dynscn_offset = &shdr->sh_offset; in main() 144 shdr->sh_type = SHT_DYNAMIC; in main() 145 shdr->sh_flags = SHF_ALLOC | SHF_WRITE; in main() 146 shdr->sh_link = SHN_UNDEF; in main() 147 shdr->sh_info = SHN_UNDEF; in main() 149 shdr->sh_addr = 0x1a0; in main() 189 shdr = elf32_getshdr (scn); in main() 190 if (shdr == NULL) in main() [all …]
|
D | emptyfile.c | 162 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in check_elf() local 163 if (shdr == NULL) in check_elf() 169 shdr->sh_type = SHT_STRTAB; in check_elf() 170 shdr->sh_flags = 0; in check_elf() 171 shdr->sh_addr = 0; in check_elf() 172 shdr->sh_link = SHN_UNDEF; in check_elf() 173 shdr->sh_info = SHN_UNDEF; in check_elf() 174 shdr->sh_addralign = 1; in check_elf() 175 shdr->sh_entsize = 0; in check_elf() 176 shdr->sh_name = add_string (scn, ".strtab"); in check_elf() [all …]
|
/third_party/elfutils/libelf/ |
D | elf32_getshdr.c | 56 result = scn->shdr.ELFW(e,LIBELFBITS); in ElfW2() 68 ElfW2(LIBELFBITS,Shdr) *shdr = elf->state.ELFW(elf,LIBELFBITS).shdr = in ElfW2() 70 if (elf->state.ELFW(elf,LIBELFBITS).shdr == NULL) in ElfW2() 111 memcpy (shdr, file_shdr, size); in ElfW2() 138 CONVERT_TO (shdr[cnt].sh_name, notcvt[cnt].sh_name); in ElfW2() 139 CONVERT_TO (shdr[cnt].sh_type, notcvt[cnt].sh_type); in ElfW2() 140 CONVERT_TO (shdr[cnt].sh_flags, notcvt[cnt].sh_flags); in ElfW2() 141 CONVERT_TO (shdr[cnt].sh_addr, notcvt[cnt].sh_addr); in ElfW2() 142 CONVERT_TO (shdr[cnt].sh_offset, notcvt[cnt].sh_offset); in ElfW2() 143 CONVERT_TO (shdr[cnt].sh_size, notcvt[cnt].sh_size); in ElfW2() [all …]
|
D | elf_compress_gnu.c | 64 Elf32_Shdr *shdr = elf32_getshdr (scn); in elf_compress_gnu() local 65 if (shdr == NULL) in elf_compress_gnu() 68 sh_flags = shdr->sh_flags; in elf_compress_gnu() 69 sh_type = shdr->sh_type; in elf_compress_gnu() 70 sh_addralign = shdr->sh_addralign; in elf_compress_gnu() 74 Elf64_Shdr *shdr = elf64_getshdr (scn); in elf_compress_gnu() local 75 if (shdr == NULL) in elf_compress_gnu() 78 sh_flags = shdr->sh_flags; in elf_compress_gnu() 79 sh_type = shdr->sh_type; in elf_compress_gnu() 80 sh_addralign = shdr->sh_addralign; in elf_compress_gnu() [all …]
|
D | elf32_updatenull.c | 186 update_if_changed (scn0->shdr.ELFW(e,LIBELFBITS)->sh_size, in __elfw2() 201 if (scn1 != NULL && scn1->shdr.ELFW(e,LIBELFBITS) == NULL) in __elfw2() 209 ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); in __elfw2() 212 assert (shdr != NULL); in __elfw2() 213 ElfW2(LIBELFBITS,SizeWord) sh_entsize = shdr->sh_entsize; in __elfw2() 214 ElfW2(LIBELFBITS,SizeWord) sh_align = shdr->sh_addralign ?: 1; in __elfw2() 222 switch (shdr->sh_type) in __elfw2() 265 update_if_changed (shdr->sh_entsize, sh_entsize, in __elfw2() 272 if ((shdr->sh_flags & SHF_COMPRESSED) != 0) in __elfw2() 276 update_if_changed (shdr->sh_addralign, sh_align, in __elfw2() [all …]
|
D | elf_compress.c | 365 Elf32_Shdr *shdr = elf32_getshdr (scn); in elf_compress() local 366 if (shdr == NULL) in elf_compress() 369 sh_flags = shdr->sh_flags; in elf_compress() 370 sh_type = shdr->sh_type; in elf_compress() 371 sh_addralign = shdr->sh_addralign; in elf_compress() 375 Elf64_Shdr *shdr = elf64_getshdr (scn); in elf_compress() local 376 if (shdr == NULL) in elf_compress() 379 sh_flags = shdr->sh_flags; in elf_compress() 380 sh_type = shdr->sh_type; in elf_compress() 381 sh_addralign = shdr->sh_addralign; in elf_compress() [all …]
|
/third_party/elfutils/src/ |
D | unstrip.c | 364 section_can_shrink (const GElf_Shdr *shdr) in section_can_shrink() argument 366 switch (shdr->sh_type) in section_can_shrink() 395 GElf_Shdr *shdr = gelf_getshdr (elf_getscn (elf, i), &shdr_mem); in symtab_count_leading_section_symbols() local 396 ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); in symtab_count_leading_section_symbols() 404 sym->st_value = shdr->sh_addr; in symtab_count_leading_section_symbols() 449 adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr, in adjust_relocs() argument 454 switch (shdr->sh_type) in adjust_relocs() 457 if (shdr->sh_entsize == 0) in adjust_relocs() 460 for (size_t i = 0; i < shdr->sh_size / shdr->sh_entsize; ++i) in adjust_relocs() 472 if (shdr->sh_entsize == 0) in adjust_relocs() [all …]
|
D | strip.c | 376 GElf_Shdr *shdr = gelf_getshdr (sec, &mem); in secndx_name() local 377 if (shdr == NULL || elf_getshdrstrndx (elf, &shstrndx) < 0) in secndx_name() 379 return elf_strptr (elf, shstrndx, shdr->sh_name) ?: "???"; in secndx_name() 388 GElf_Shdr *shdr = gelf_getshdr (symscn, &shdr_mem); in get_xndxdata() local 389 if (shdr != NULL && shdr->sh_type == SHT_SYMTAB) in get_xndxdata() 577 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in remove_debug_relocations() local 578 if (shdr != NULL in remove_debug_relocations() 579 && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA)) in remove_debug_relocations() 584 Elf_Scn *tscn = elf_getscn (elf, shdr->sh_info); in remove_debug_relocations() 632 Elf64_Word symt = shdr->sh_link; in remove_debug_relocations() [all …]
|
D | elfcompress.c | 231 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in compress_section() local 232 if (shdr == NULL) in compress_section() 237 float new = shdr->sh_size; in compress_section() 240 orig_size, shdr->sh_size, (new / orig) * 100); in compress_section() 433 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in process_file() local 434 if (shdr == NULL) in process_file() 440 const char *sname = elf_strptr (elf, shdrstrndx, shdr->sh_name); in process_file() 450 && (shdr->sh_flags & SHF_COMPRESSED) == 0 in process_file() 457 && (shdr->sh_flags & SHF_COMPRESSED) != 0) in process_file() 468 else if (shdr->sh_type != SHT_NOBITS in process_file() [all …]
|
D | elflint.c | 95 GElf_Shdr *shdr, int idx); 302 GElf_Shdr *shdr; in section_name() local 308 shdr = gelf_getshdr (elf_getscn (ebl->elf, idx), &shdr_mem); in section_name() 309 if (shdr == NULL) in section_name() 312 ret = elf_strptr (ebl->elf, shstrndx, shdr->sh_name); in section_name() 432 GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); in check_elf_header() local 433 if (shdr != NULL) in check_elf_header() 436 if (shdr->sh_size == 0) in check_elf_header() 440 shnum = shdr->sh_size; in check_elf_header() 449 GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); in check_elf_header() local [all …]
|
D | findtextrel.c | 249 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in process_file() local 251 if (shdr == NULL) in process_file() 259 switch (shdr->sh_type) in process_file() 267 size_t entries = (shdr->sh_entsize == 0 in process_file() 268 ? 0 : shdr->sh_size / shdr->sh_entsize); in process_file() 379 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in process_file() local 381 if (shdr == NULL) in process_file() 390 if ((shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) in process_file() 393 symscn = elf_getscn (elf, shdr->sh_link); in process_file() 398 (size_t) shdr->sh_link, fname, elf_errmsg (-1)); in process_file() [all …]
|
D | objdump.c | 344 show_relocs_x (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *symdata, in show_relocs_x() argument 375 if (shdr == NULL || destshdr == NULL) in show_relocs_x() 400 show_relocs_rel (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, in show_relocs_rel() argument 405 int nentries = shdr->sh_size / sh_entsize; in show_relocs_rel() 414 show_relocs_x (ebl, shdr, symdata, xndxdata, symstrndx, shstrndx, in show_relocs_rel() 421 show_relocs_rela (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, in show_relocs_rela() argument 426 int nentries = shdr->sh_size / sh_entsize; in show_relocs_rela() 435 show_relocs_x (ebl, shdr, symdata, xndxdata, symstrndx, shstrndx, in show_relocs_rela() 442 section_match (Elf *elf, uint32_t scnndx, GElf_Shdr *shdr, size_t shstrndx) in section_match() argument 448 const char *name = elf_strptr (elf, shstrndx, shdr->sh_name); in section_match() [all …]
|
/third_party/elfutils/libasm/ |
D | asm_end.c | 75 GElf_Shdr *shdr; in binary_end() local 141 shdr = gelf_getshdr (strscn, &shdr_mem); in binary_end() 142 if (strtabdata == NULL || shdr == NULL) in binary_end() 151 shdr->sh_type = SHT_STRTAB; in binary_end() 152 assert (shdr->sh_entsize == 0); in binary_end() 154 (void) gelf_update_shdr (strscn, shdr); in binary_end() 159 shdr = gelf_getshdr (symscn, &shdr_mem); in binary_end() 160 if (data == NULL || shdr == NULL) in binary_end() 224 shdr = gelf_getshdr (xndxscn, &shdr_mem); in binary_end() 225 if (xndxdata == NULL || shdr == NULL) in binary_end() [all …]
|
/third_party/libunwind/src/ |
D | elfxx.c | 96 Elf_W (Shdr) *shdr; in elf_w() 104 shdr = elf_w (section_table) (ei); in elf_w() 105 if (!shdr) in elf_w() 110 switch (shdr->sh_type) in elf_w() 114 symtab = (Elf_W (Sym) *) ((char *) ei->image + shdr->sh_offset); in elf_w() 115 symtab_end = (Elf_W (Sym) *) ((char *) symtab + shdr->sh_size); in elf_w() 116 syment_size = shdr->sh_entsize; in elf_w() 118 strtab = elf_w (string_table) (ei, shdr->sh_link); in elf_w() 123 (long) shdr->sh_offset, shdr->sh_type); in elf_w() 155 shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize); in elf_w() [all …]
|
/third_party/libbpf/src/ |
D | linker.c | 42 Elf64_Shdr *shdr; member 111 Elf64_Shdr *shdr; member 286 symtab->shdr->sh_size += sizeof(*sym); in add_new_sym() 351 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf() 352 if (!sec->shdr) in init_output_elf() 369 sec->shdr->sh_name = str_off; in init_output_elf() 370 sec->shdr->sh_type = SHT_STRTAB; in init_output_elf() 371 sec->shdr->sh_flags = SHF_STRINGS; in init_output_elf() 372 sec->shdr->sh_offset = 0; in init_output_elf() 373 sec->shdr->sh_link = 0; in init_output_elf() [all …]
|
/third_party/elfutils/libdwfl/ |
D | derelocate.c | 102 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in cache_sections() local 103 if (shdr == NULL) in cache_sections() 106 if ((shdr->sh_flags & SHF_ALLOC) && shdr->sh_addr == 0 in cache_sections() 112 &shdr->sh_addr) != DWFL_E_NOERROR) in cache_sections() 114 shdr = gelf_getshdr (scn, &shdr_mem); in cache_sections() 115 if (unlikely (shdr == NULL)) in cache_sections() 119 if (shdr->sh_flags & SHF_ALLOC) in cache_sections() 122 shdr->sh_name); in cache_sections() 138 newref->start = dwfl_adjusted_address (mod, shdr->sh_addr); in cache_sections() 139 newref->end = newref->start + shdr->sh_size; in cache_sections() [all …]
|
D | relocate.c | 131 GElf_Shdr shdr_mem, *shdr = gelf_getshdr (scn, &shdr_mem); in relocate_getsym() local 132 if (shdr != NULL) in relocate_getsym() 135 if ((shdr->sh_type == SHT_SYMTAB in relocate_getsym() 136 || shdr->sh_type == SHT_SYMTAB_SHNDX) in relocate_getsym() 137 && (shdr->sh_flags & SHF_COMPRESSED) != 0) in relocate_getsym() 141 switch (shdr->sh_type) in relocate_getsym() 148 cache->strtabndx = shdr->sh_link; in relocate_getsym() 228 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in resolve_symbol() local 229 if (shdr == NULL) in resolve_symbol() 237 shdr->sh_name); in resolve_symbol() [all …]
|
D | dwfl_report_elf.c | 76 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); in __libdwfl_elf_address_range() local 77 if (unlikely (shdr == NULL)) in __libdwfl_elf_address_range() 80 if (shdr->sh_flags & SHF_ALLOC) in __libdwfl_elf_address_range() 82 const GElf_Xword align = shdr->sh_addralign ?: 1; in __libdwfl_elf_address_range() 84 if (shdr->sh_addr == 0 in __libdwfl_elf_address_range() 90 shdr->sh_addr = next; in __libdwfl_elf_address_range() 94 start = base = shdr->sh_addr; in __libdwfl_elf_address_range() 131 end = shdr->sh_addr + shdr->sh_size; in __libdwfl_elf_address_range() 132 if (likely (shdr->sh_addr != 0) in __libdwfl_elf_address_range() 133 && unlikely (! gelf_update_shdr (scn, shdr))) in __libdwfl_elf_address_range() [all …]
|