Lines Matching refs:shdr
42 Elf64_Shdr *shdr;
111 Elf64_Shdr *shdr;
286 symtab->shdr->sh_size += sizeof(*sym);
351 sec->shdr = elf64_getshdr(sec->scn);
352 if (!sec->shdr)
369 sec->shdr->sh_name = str_off;
370 sec->shdr->sh_type = SHT_STRTAB;
371 sec->shdr->sh_flags = SHF_STRINGS;
372 sec->shdr->sh_offset = 0;
373 sec->shdr->sh_link = 0;
374 sec->shdr->sh_info = 0;
375 sec->shdr->sh_addralign = 1;
376 sec->shdr->sh_size = sec->sec_sz = 0;
377 sec->shdr->sh_entsize = 0;
390 sec->shdr = elf64_getshdr(sec->scn);
391 if (!sec->shdr)
407 sec->shdr->sh_name = str_off;
408 sec->shdr->sh_type = SHT_SYMTAB;
409 sec->shdr->sh_flags = 0;
410 sec->shdr->sh_offset = 0;
411 sec->shdr->sh_link = linker->strtab_sec_idx;
415 sec->shdr->sh_info = 0;
416 sec->shdr->sh_addralign = 8;
417 sec->shdr->sh_entsize = sizeof(Elf64_Sym);
481 Elf64_Shdr *shdr = sec->shdr;
485 if (shdr->sh_type == SHT_STRTAB)
489 if (shdr->sh_type == SHT_LLVM_ADDRSIG)
493 if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size == 0 &&
553 Elf64_Shdr *shdr;
604 shdr = elf64_getshdr(scn);
605 if (!shdr) {
612 sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name);
633 sec->shdr = shdr;
642 switch (shdr->sh_type) {
656 obj->btf = btf__new(data->d_buf, shdr->sh_size);
666 obj->btf_ext = btf_ext__new(data->d_buf, shdr->sh_size);
722 if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign))
724 if (sec->shdr->sh_addralign != sec->data->d_align)
727 if (sec->shdr->sh_size != sec->data->d_size)
730 switch (sec->shdr->sh_type) {
739 if (sec->shdr->sh_flags & SHF_EXECINSTR) {
740 if (sec->shdr->sh_size % sizeof(struct bpf_insn) != 0)
755 sec->sec_idx, sec->sec_name, (size_t)sec->shdr->sh_type, obj->filename);
769 if (sec->shdr->sh_entsize != sizeof(Elf64_Sym))
771 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0)
774 if (!sec->shdr->sh_link || sec->shdr->sh_link >= obj->sec_cnt) {
776 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename);
779 link_sec = &obj->secs[sec->shdr->sh_link];
780 if (link_sec->shdr->sh_type != SHT_STRTAB) {
782 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename);
786 n = sec->shdr->sh_size / sec->shdr->sh_entsize;
843 if (sec->shdr->sh_entsize != sizeof(Elf64_Rel))
845 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0)
849 if (sec->shdr->sh_link != obj->symtab_sec_idx) {
851 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename);
856 if (!sec->shdr->sh_info || sec->shdr->sh_info >= obj->sec_cnt) {
858 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename);
861 link_sec = &obj->secs[sec->shdr->sh_info];
876 if (link_sec->shdr->sh_type != SHT_PROGBITS && link_sec->shdr->sh_type != SHT_NOBITS) {
878 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename);
883 n = sec->shdr->sh_size / sec->shdr->sh_entsize;
897 if (!sym_idx || sym_idx * sizeof(Elf64_Sym) >= sym_sec->shdr->sh_size) {
903 if (link_sec->shdr->sh_flags & SHF_EXECINSTR) {
982 Elf64_Shdr *shdr;
999 shdr = elf64_getshdr(scn);
1000 if (!shdr)
1004 dst_sec->shdr = shdr;
1012 shdr->sh_name = name_off;
1013 shdr->sh_type = src_sec->shdr->sh_type;
1014 shdr->sh_flags = src_sec->shdr->sh_flags;
1015 shdr->sh_size = 0;
1020 shdr->sh_link = 0;
1021 shdr->sh_info = 0;
1022 shdr->sh_addralign = src_sec->shdr->sh_addralign;
1023 shdr->sh_entsize = src_sec->shdr->sh_entsize;
1054 if (dst->shdr->sh_type != src->shdr->sh_type) {
1058 if (dst->shdr->sh_flags != src->shdr->sh_flags) {
1062 if (dst->shdr->sh_entsize != src->shdr->sh_entsize) {
1072 if (dst_sec->sec_sz != src_sec->shdr->sh_size)
1104 dst_align = dst->shdr->sh_addralign;
1105 src_align = src->shdr->sh_addralign;
1114 dst_final_sz = dst_align_sz + src->shdr->sh_size;
1116 if (src->shdr->sh_type != SHT_NOBITS) {
1137 memcpy(dst->raw_data + dst_align_sz, src->data->d_buf, src->shdr->sh_size);
1141 dst->shdr->sh_size = dst_final_sz;
1144 dst->shdr->sh_addralign = dst_align;
1159 return sec->shdr->sh_type == SHT_PROGBITS || sec->shdr->sh_type == SHT_NOBITS;
1166 return sec->shdr->sh_type == SHT_REL;
1225 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize, err;
1226 int str_sec_idx = symtab->shdr->sh_link;
2024 /* shdr->sh_info points to relocatable section */
2025 src_linked_sec = &obj->secs[src_sec->shdr->sh_info];
2044 /* shdr->sh_link points to SYMTAB */
2045 dst_sec->shdr->sh_link = linker->symtab_sec_idx;
2047 /* shdr->sh_info points to relocated section */
2049 dst_sec->shdr->sh_info = dst_linked_sec->sec_idx;
2058 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize;
2075 if (src_linked_sec->shdr->sh_flags & SHF_EXECINSTR) {
2107 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize;
2108 int str_sec_idx = symtab->shdr->sh_link;
2152 if (sec->shdr)
2153 t->size = sec->shdr->sh_size;
2578 sec->shdr->sh_size = strs_sz;
2622 Elf64_Shdr *shdr;
2635 shdr = elf64_getshdr(scn);
2636 if (!shdr)
2639 shdr->sh_name = name_off;
2640 shdr->sh_type = SHT_PROGBITS;
2641 shdr->sh_flags = 0;
2642 shdr->sh_size = raw_sz;
2643 shdr->sh_link = 0;
2644 shdr->sh_info = 0;
2645 shdr->sh_addralign = align;
2646 shdr->sh_entsize = 0;