Lines Matching refs:shdr
417 GElf_Shdr shdr;
422 Elf32_Word old_sh_link; /* Original value of shdr.sh_link. */
601 if (gelf_getshdr (scn, &shdr_info[cnt].shdr) == NULL)
606 shdr_info[cnt].shdr.sh_name);
616 /* Remember the shdr.sh_link value. */
617 shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link;
623 || (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
624 shdr_info[cnt].shdr.sh_offset = 0;
628 if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX))
630 assert (shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0);
631 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt;
633 else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP))
656 else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym))
658 assert (shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0);
659 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt;
664 if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0)
672 shdr_info[cnt].shdr.sh_flags &= ~SHF_GROUP;
692 if (remove_shdrs ? !(shdr_info[cnt].shdr.sh_flags & SHF_ALLOC)
693 : ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr,
742 if ((shdr_info[cnt].shdr.sh_type == SHT_REL
743 || shdr_info[cnt].shdr.sh_type == SHT_RELA)
744 && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
749 if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
771 && (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM
772 || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB))
789 assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB);
852 if (shdr_info[shdr_info[cnt].shdr.sh_link].idx == 0)
854 shdr_info[shdr_info[cnt].shdr.sh_link].idx = 1;
855 changes |= shdr_info[cnt].shdr.sh_link < cnt;
859 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr)
860 && shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
862 shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
863 changes |= shdr_info[cnt].shdr.sh_info < cnt;
896 check_preserved (shdr_info[cnt].shdr.sh_link);
897 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
898 check_preserved (shdr_info[cnt].shdr.sh_info);
918 && shdr_info[cnt].shdr.sh_type != SHT_NOTE
919 && shdr_info[cnt].shdr.sh_type != SHT_GROUP
923 GElf_Shdr debugshdr = shdr_info[cnt].shdr;
950 || shdr_info[cnt].shdr.sh_type == SHT_GROUP)
1024 shdr_info[cnt].shdr.sh_type = SHT_PROGBITS;
1025 shdr_info[cnt].shdr.sh_flags = 0;
1026 shdr_info[cnt].shdr.sh_addr = 0;
1027 shdr_info[cnt].shdr.sh_link = SHN_UNDEF;
1028 shdr_info[cnt].shdr.sh_info = SHN_UNDEF;
1029 shdr_info[cnt].shdr.sh_entsize = 0;
1030 shdr_info[cnt].shdr.sh_addralign = 4;
1034 shdr_info[cnt].shdr.sh_offset = 0;
1055 shdr_info[cnt].shdr.sh_size = shdr_info[cnt].data->d_size
1080 shdr_info[cnt].shdr.sh_type = SHT_STRTAB;
1081 shdr_info[cnt].shdr.sh_flags = 0;
1082 shdr_info[cnt].shdr.sh_addr = 0;
1083 shdr_info[cnt].shdr.sh_link = SHN_UNDEF;
1084 shdr_info[cnt].shdr.sh_info = SHN_UNDEF;
1085 shdr_info[cnt].shdr.sh_entsize = 0;
1089 shdr_info[cnt].shdr.sh_offset = 0;
1090 shdr_info[cnt].shdr.sh_addralign = 1;
1110 shdr_info[cnt].shdr.sh_size = shstrtab_data->d_size;
1123 shdr_info[cnt].shdr.sh_name = ebl_strtaboffset (shdr_info[cnt].se);
1127 if (shdr_info[cnt].shdr.sh_link != 0)
1128 shdr_info[cnt].shdr.sh_link =
1129 shdr_info[shdr_info[cnt].shdr.sh_link].idx;
1131 if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
1143 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
1144 shdr_info[cnt].shdr.sh_info =
1145 shdr_info[shdr_info[cnt].shdr.sh_info].idx;
1167 shdr_info[cnt].shdr.sh_size = shdr_info[cnt].data->d_size;
1171 if (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM
1172 || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB)
1182 assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX);
1194 assert (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM);
1244 shdr_info[cnt].shdr.sh_info = destidx - 1;
1294 shdr_info[cnt].shdr.sh_info = destidx - 1;
1305 || (shdr_info[sidx].shdr.sh_type == SHT_GROUP
1306 && shdr_info[sidx].shdr.sh_info == inner));
1313 shdr_info[cnt].shdr.sh_size = newdata->d_size
1327 if (shdr_info[cnt].shdr.sh_offset == 0)
1328 shdr_info[cnt].shdr.sh_offset
1329 = ((lastoffset + shdr_info[cnt].shdr.sh_addralign - 1)
1330 & ~((GElf_Off) (shdr_info[cnt].shdr.sh_addralign - 1)));
1333 if (unlikely (gelf_update_shdr (scn, &shdr_info[cnt].shdr) == 0))
1338 GElf_Off filesz = (shdr_info[cnt].shdr.sh_type != SHT_NOBITS
1339 ? shdr_info[cnt].shdr.sh_size : 0);
1340 if (lastoffset < shdr_info[cnt].shdr.sh_offset + filesz)
1341 lastoffset = shdr_info[cnt].shdr.sh_offset + filesz;
1355 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
1356 shdr->sh_size = newdata->d_size;
1357 (void) gelf_update_shdr (scn, shdr);
1375 switch (shdr_info[cnt].shdr.sh_type)
1401 size_t nrels = (shdr_info[cnt].shdr.sh_size
1402 / shdr_info[cnt].shdr.sh_entsize);
1404 if (shdr_info[cnt].shdr.sh_type == SHT_REL)
1463 if (shdr_info[cnt].shdr.sh_entsize == sizeof (Elf32_Word))
1489 for (size_t inner = shdr_info[symtabidx].shdr.sh_info;
1517 assert (shdr_info[cnt].shdr.sh_entsize
1543 for (size_t inner = shdr_info[symtabidx].shdr.sh_info;
1619 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
1620 assert (shdr != NULL);
1622 shdr->sh_info = newsymidx[shdr->sh_info];
1624 (void) gelf_update_shdr (scn, shdr);
1643 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
1644 if (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA)
1649 Elf_Scn *tscn = elf_getscn (debugelf, shdr->sh_info);
1675 Elf64_Word symt = shdr->sh_link;
1804 size_t nrels = shdr->sh_size / shdr->sh_entsize;
1806 if (shdr->sh_type == SHT_REL)
1836 shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize;
1837 gelf_update_shdr (scn, shdr);
1913 newehdr->e_shoff = ((shdr_info[shdridx].shdr.sh_offset
1914 + shdr_info[shdridx].shdr.sh_size + offsize - 1)
1926 if (gelf_getshdr (shdr_info[0].scn, &shdr_info[0].shdr) == NULL)
1929 shdr_info[0].shdr.sh_link = idx;
1930 (void) gelf_update_shdr (shdr_info[0].scn, &shdr_info[0].shdr);
1982 || ftruncate64 (fd, shdr_info[shdridx].shdr.sh_offset) < 0)
2002 || ftruncate64 (fd, shdr_info[shdridx].shdr.sh_offset) < 0)