Lines Matching refs:shdr
376 GElf_Shdr *shdr = gelf_getshdr (sec, &mem);
377 if (shdr == NULL || elf_getshdrstrndx (elf, &shstrndx) < 0)
379 return elf_strptr (elf, shstrndx, shdr->sh_name) ?: "???";
388 GElf_Shdr *shdr = gelf_getshdr (symscn, &shdr_mem);
389 if (shdr != NULL && shdr->sh_type == SHT_SYMTAB)
577 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
578 if (shdr != NULL
579 && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA))
584 Elf_Scn *tscn = elf_getscn (elf, shdr->sh_info);
632 Elf64_Word symt = shdr->sh_link;
640 if (shdr->sh_entsize == 0)
643 size_t nrels = shdr->sh_size / shdr->sh_entsize;
645 const bool is_rela = (shdr->sh_type == SHT_RELA);
725 shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize;
726 if (gelf_update_shdr (scn, shdr) == 0)
860 GElf_Shdr shdr;
861 if (gelf_getshdr (scn, &shdr) == NULL)
863 error (0, 0, "couldn't get shdr: %s", elf_errmsg (-1));
875 if (gelf_update_shdr (new_scn, &shdr) == 0)
877 error (0, 0, "couldn't update shdr: %s", elf_errmsg (-1));
896 if ((shdr.sh_flags & SHF_ALLOC) != 0)
898 GElf_Off filesz = (shdr.sh_type != SHT_NOBITS
899 ? shdr.sh_size : 0);
900 if (lastoffset < shdr.sh_offset + filesz)
901 lastoffset = shdr.sh_offset + filesz;
922 GElf_Shdr shdr;
923 if (gelf_getshdr (scn, &shdr) == NULL)
925 error (0, 0, "couldn't get shdr: %s", elf_errmsg (-1));
930 if ((shdr.sh_flags & SHF_ALLOC) == 0)
932 shdr.sh_offset = ((lastoffset + shdr.sh_addralign - 1)
933 & ~((GElf_Off) (shdr.sh_addralign - 1)));
934 if (gelf_update_shdr (scn, &shdr) == 0)
936 error (0, 0, "couldn't update shdr: %s", elf_errmsg (-1));
940 GElf_Off filesz = (shdr.sh_type != SHT_NOBITS
941 ? shdr.sh_size : 0);
942 lastoffset = shdr.sh_offset + filesz;
943 *last_offset = shdr.sh_offset;
962 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
963 shdr->sh_size = newdata->d_size;
964 if (gelf_update_shdr (scn, shdr) == 0)
998 GElf_Shdr shdr;
1003 Elf32_Word old_sh_link; /* Original value of shdr.sh_link. */
1228 if (gelf_getshdr (scn, &shdr_info[cnt].shdr) == NULL)
1233 if ((shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
1244 shdr_info[cnt].shdr.sh_name);
1255 if ((shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) != 0)
1277 /* Remember the shdr.sh_link value. */
1278 shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link;
1289 || (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
1290 shdr_info[cnt].shdr.sh_offset = 0;
1294 if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX))
1296 elf_assert (shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0);
1297 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt;
1299 else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP))
1328 else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym))
1330 elf_assert (shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0);
1331 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt;
1336 if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0)
1370 if (remove_shdrs ? !(shdr_info[cnt].shdr.sh_flags & SHF_ALLOC)
1371 : (ebl_section_strip_p (ebl, &shdr_info[cnt].shdr,
1428 if (shdr_info[cnt].shdr.sh_type == SHT_REL
1429 || shdr_info[cnt].shdr.sh_type == SHT_RELA)
1431 if (shdr_info[cnt].shdr.sh_info >= shnum)
1433 else if (shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
1439 if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
1466 && (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM
1467 || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB))
1484 elf_assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB);
1533 &shdr_info[scnidx].shdr,
1539 shdr_info[cnt].shdr.sh_link,
1560 if (shdr_info[shdr_info[cnt].shdr.sh_link].idx == 0)
1562 shdr_info[shdr_info[cnt].shdr.sh_link].idx = 1;
1563 changes |= shdr_info[cnt].shdr.sh_link < cnt;
1567 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
1569 if (shdr_info[cnt].shdr.sh_info >= shnum)
1571 else if ( shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
1573 shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
1574 changes |= shdr_info[cnt].shdr.sh_info < cnt;
1592 size_t shdr_indices[2] = { shdr_info[cnt].shdr.sh_link, 0 };
1595 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
1597 shdr_indices[1] = shdr_info[cnt].shdr.sh_info;
1637 && shdr_info[cnt].shdr.sh_type != SHT_NOTE
1638 && shdr_info[cnt].shdr.sh_type != SHT_GROUP
1642 GElf_Shdr debugshdr = shdr_info[cnt].shdr;
1669 || shdr_info[cnt].shdr.sh_type == SHT_GROUP)
1773 shdr_info[cnt].shdr.sh_type = SHT_PROGBITS;
1774 shdr_info[cnt].shdr.sh_flags = 0;
1775 shdr_info[cnt].shdr.sh_addr = 0;
1776 shdr_info[cnt].shdr.sh_link = SHN_UNDEF;
1777 shdr_info[cnt].shdr.sh_info = SHN_UNDEF;
1778 shdr_info[cnt].shdr.sh_entsize = 0;
1779 shdr_info[cnt].shdr.sh_addralign = 4;
1783 shdr_info[cnt].shdr.sh_offset = 0;
1809 shdr_info[cnt].shdr.sh_size = shdr_info[cnt].data->d_size
1835 shdr_info[cnt].shdr.sh_type = SHT_STRTAB;
1836 shdr_info[cnt].shdr.sh_flags = 0;
1837 shdr_info[cnt].shdr.sh_addr = 0;
1838 shdr_info[cnt].shdr.sh_link = SHN_UNDEF;
1839 shdr_info[cnt].shdr.sh_info = SHN_UNDEF;
1840 shdr_info[cnt].shdr.sh_entsize = 0;
1844 shdr_info[cnt].shdr.sh_offset = 0;
1845 shdr_info[cnt].shdr.sh_addralign = 1;
1873 shdr_info[cnt].shdr.sh_size = shstrtab_data->d_size;
1886 shdr_info[cnt].shdr.sh_name = dwelf_strent_off (shdr_info[cnt].se);
1892 size_t sh_link = shdr_info[cnt].shdr.sh_link;
1893 if (shdr_info[cnt].shdr.sh_link != 0)
1894 shdr_info[cnt].shdr.sh_link =
1895 shdr_info[shdr_info[cnt].shdr.sh_link].idx;
1897 if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
1915 if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
1916 shdr_info[cnt].shdr.sh_info =
1917 shdr_info[shdr_info[cnt].shdr.sh_info].idx;
1939 shdr_info[cnt].shdr.sh_size = shdr_info[cnt].data->d_size;
1943 if (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM
1944 || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB)
1953 elf_assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX);
1967 elf_assert (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM);
2019 shdr_info[cnt].shdr.sh_info = destidx - 1;
2068 shdr_info[cnt].shdr.sh_info = destidx - 1;
2071 else if ((shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) != 0
2073 && shdr_info[sidx].shdr.sh_type != SHT_GROUP)
2098 || ((shdr_info[sidx].shdr.sh_type
2100 && (shdr_info[sidx].shdr.sh_info
2111 shdr_info[cnt].shdr.sh_size = newdata->d_size
2128 || (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) != 0)
2130 if (shdr_info[cnt].shdr.sh_offset == 0)
2131 shdr_info[cnt].shdr.sh_offset
2132 = ((lastoffset + shdr_info[cnt].shdr.sh_addralign - 1)
2133 & ~((GElf_Off) (shdr_info[cnt].shdr.sh_addralign - 1)));
2136 if (unlikely (gelf_update_shdr (scn, &shdr_info[cnt].shdr) == 0))
2141 GElf_Off filesz = (shdr_info[cnt].shdr.sh_type != SHT_NOBITS
2142 ? shdr_info[cnt].shdr.sh_size : 0);
2143 if (lastoffset < shdr_info[cnt].shdr.sh_offset + filesz)
2144 lastoffset = shdr_info[cnt].shdr.sh_offset + filesz;
2156 if ((shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
2158 if (shdr_info[cnt].shdr.sh_offset == 0)
2159 shdr_info[cnt].shdr.sh_offset
2160 = ((lastoffset + shdr_info[cnt].shdr.sh_addralign - 1)
2161 & ~((GElf_Off) (shdr_info[cnt].shdr.sh_addralign - 1)));
2164 if (unlikely (gelf_update_shdr (scn, &shdr_info[cnt].shdr) == 0))
2169 GElf_Off filesz = (shdr_info[cnt].shdr.sh_type != SHT_NOBITS
2170 ? shdr_info[cnt].shdr.sh_size : 0);
2171 if (lastoffset < shdr_info[cnt].shdr.sh_offset + filesz)
2172 lastoffset = shdr_info[cnt].shdr.sh_offset + filesz;
2202 switch (info->shdr.sh_type)
2211 && info->shdr.sh_entsize != 0);
2212 size_t nrels = (info->shdr.sh_size / info->shdr.sh_entsize);
2217 if (info->shdr.sh_type == SHT_REL)
2275 if (info->shdr.sh_entsize == sizeof (Elf32_Word))
2308 for (size_t inner = shdr_info[symtabidx].shdr.sh_info;
2336 elf_assert (info->shdr.sh_entsize == sizeof (Elf64_Xword));
2369 for (size_t inner = shdr_info[symtabidx].shdr.sh_info;
2441 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
2442 elf_assert (shdr != NULL);
2447 elf_assert (shdr->sh_info < symn);
2448 shdr->sh_info = newsymidx[shdr->sh_info];
2450 (void) gelf_update_shdr (scn, shdr);
2518 lastsec_offset = shdr_info[shdridx].shdr.sh_offset;
2519 lastsec_size = shdr_info[shdridx].shdr.sh_size;