Lines Matching refs:sec
1099 const struct section *sec = §ions[i];
1100 if (sec->shdr.sh_type == SHT_PROGBITS
1101 && !(sec->shdr.sh_flags & SHF_ALLOC)
1102 && !strcmp (sec->name, ".gnu.prelink_undo"))
1104 undo = sec->scn;
1182 struct section *sec = &undo_sections[undo_nalloc];
1187 #define COPY(field) sec->shdr.field = (*s32)[i].field
1201 sec->shdr = (*s64)[i];
1202 if (sec->shdr.sh_flags & SHF_ALLOC)
1204 sec->shdr.sh_addr += bias;
1205 sec->name = get_section_name (i + 1, &sec->shdr, main_shstrtab);
1206 sec->scn = elf_getscn (main, i + 1); /* Really just for ndx. */
1207 sec->outscn = NULL;
1208 sec->strent = NULL;
1209 sec->sig = get_group_sig (main, &sec->shdr);
1234 struct section *sec = find_alloc_section (shdr, 0, name,
1237 if (sec != NULL)
1239 sec->outscn = scn;
1268 struct section *sec = §ions[j];
1270 (2 * sec->shdr.field == 3 * undo_sec->shdr.field)
1271 if (sec->outscn == NULL
1272 && sec->shdr.sh_name == undo_sec->shdr.sh_name
1273 && sec->shdr.sh_flags == undo_sec->shdr.sh_flags
1274 && sec->shdr.sh_addralign == undo_sec->shdr.sh_addralign
1275 && (((sec->shdr.sh_type == undo_sec->shdr.sh_type
1276 && sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize
1277 && (sec->shdr.sh_size == undo_sec->shdr.sh_size
1278 || (sec->shdr.sh_size > undo_sec->shdr.sh_size
1280 && !strcmp (sec->name, ".dynstr"))))
1281 || (sec->shdr.sh_size == undo_sec->shdr.sh_size
1282 && ((sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize
1285 && !strcmp (sec->name, ".plt")))
1286 || (sec->shdr.sh_type == SHT_RELA
1289 || (sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize
1290 && (sec->shdr.sh_type == undo_sec->shdr.sh_type
1291 || (sec->shdr.sh_type == SHT_PROGBITS
1293 && sec->shdr.sh_size <= undo_sec->shdr.sh_size
1294 && (!strcmp (sec->name, ".bss")
1295 || !strcmp (sec->name, ".sbss"))
1296 && (sec->shdr.sh_size == undo_sec->shdr.sh_size
1297 || (split_bss = sec) > sections))))
1299 sec->outscn = undo_sec->outscn;
1330 for (struct section *sec = sections;
1331 sec < §ions[stripped_shnum - 1];
1332 ++sec)
1333 if (sec->outscn != NULL)
1335 if (sec->strent == NULL)
1337 sec->strent = dwelf_strtab_add (strtab, sec->name);
1338 ELF_CHECK (sec->strent != NULL,
1341 unstripped_strent[elf_ndxscn (sec->outscn) - 1] = sec->strent;
1487 struct section *sec = NULL;
1493 sec = find_alloc_section (shdr, bias, name, sections, nalloc);
1494 if (sec == NULL)
1506 sec = §ions[alloc_avail++];
1511 sec = §ions[i];
1534 sec = section;
1539 if (sec == NULL)
1554 if (sec == NULL)
1558 sec->outscn = scn;
1583 for (struct section *sec = sections;
1584 sec < §ions[ndx_sec_num];
1585 ++sec)
1587 size_t secndx = elf_ndxscn (sec->scn);
1589 if (sec->outscn == NULL)
1600 if (unstripped_symtab != NULL && sec == stripped_symtab)
1616 if (!(sec->shdr.sh_flags & SHF_ALLOC)
1617 && !strcmp (sec->name, ".gnu_debuglink"))
1625 sec->outscn = elf_newscn (unstripped);
1626 Elf_Data *newdata = elf_newdata (sec->outscn);
1627 ELF_CHECK (newdata != NULL && gelf_update_shdr (sec->outscn,
1628 &sec->shdr),
1633 sec->strent = dwelf_strtab_add (strtab, sec->name);
1634 ELF_CHECK (sec->strent != NULL,
1639 ndx_section[secndx - 1] = elf_ndxscn (sec->outscn);
1657 for (const struct section *sec = sections;
1658 sec < §ions[stripped_shnum - 1];
1659 ++sec)
1660 if (sec->outscn != NULL)
1663 GElf_Shdr *shdr = gelf_getshdr (sec->outscn, &shdr_mem);
1674 shdr_mem.sh_addr = sec->shdr.sh_addr;
1676 shdr_mem.sh_type = sec->shdr.sh_type;
1677 shdr_mem.sh_size = sec->shdr.sh_size;
1678 shdr_mem.sh_info = sec->shdr.sh_info;
1679 shdr_mem.sh_link = sec->shdr.sh_link;
1683 if ((sec->shdr.sh_type == SHT_REL || sec->shdr.sh_type == SHT_RELA)
1684 && sec->shdr.sh_flags != shdr_mem.sh_flags
1685 && (sec->shdr.sh_flags & SHF_INFO_LINK) != 0)
1688 if (sec->shdr.sh_link != SHN_UNDEF)
1690 if (sec->shdr.sh_link > ndx_sec_num)
1693 elf_ndxscn (sec->scn), sec->shdr.sh_link);
1694 shdr_mem.sh_link = ndx_section[sec->shdr.sh_link - 1];
1696 if (SH_INFO_LINK_P (&sec->shdr) && sec->shdr.sh_info != 0)
1698 if (sec->shdr.sh_info > ndx_sec_num)
1701 elf_ndxscn (sec->scn), sec->shdr.sh_info);
1702 shdr_mem.sh_info = ndx_section[sec->shdr.sh_info - 1];
1706 shdr_mem.sh_name = dwelf_strent_off (sec->strent);
1708 Elf_Data *indata = elf_getdata (sec->scn, NULL);
1710 Elf_Data *outdata = elf_getdata (sec->outscn, NULL);
1718 if (max_off > 0 && sec->shdr.sh_offset > (Elf64_Off) max_off)
1721 elf_ndxscn (sec->scn), sec->shdr.sh_offset);
1723 shdr_mem.sh_offset = sec->shdr.sh_offset;
1724 placed[elf_ndxscn (sec->outscn) - 1] = true;
1733 update_shdr (sec->outscn, &shdr_mem);
1777 stripped_symtab = sec;
1779 stripped_dynsym = sec;
1920 Elf_Scn *sec = elf_getscn (unstripped, i + 1);
1922 GElf_Shdr *hdr = gelf_getshdr (sec, &mem);
1947 Elf_Scn *sec = elf_getscn (unstripped, i + 1);
1949 GElf_Shdr *hdr = gelf_getshdr (sec, &mem);
1951 update_shdr (sec, hdr);
2001 for (const struct section *sec = sections;
2002 sec < §ions[stripped_shnum - 1];
2003 ++sec)
2004 if (sec->outscn != NULL && sec->shdr.sh_link == old_sh_link)
2005 adjust_relocs (sec->outscn, sec->scn, &sec->shdr,