Home | History | Annotate | Download | only in bfd

Lines Matching refs:hdr

325   Elf_Internal_Shdr *hdr;
333 hdr = elf_elfsections (abfd)[shindex];
335 if (hdr->contents == NULL
339 if (strindex >= hdr->sh_size)
344 abfd, strindex, (unsigned long) hdr->sh_size,
345 (shindex == shstrndx && strindex == hdr->sh_name
347 : bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name)));
351 return ((char *) hdr->contents) + strindex;
516 Elf_Internal_Shdr *hdr;
525 hdr = elf_elfsections (abfd) [ghdr->sh_link];
526 if (hdr->sh_type != SHT_SYMTAB
531 hdr = &elf_tdata (abfd)->symtab_hdr;
532 if (bfd_elf_get_elf_syms (abfd, hdr, 1, ghdr->sh_info,
536 return bfd_elf_sym_name (abfd, hdr, &isym, NULL);
542 setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
695 if ((++idx)->shdr == hdr)
851 Elf_Internal_Shdr *hdr,
859 if (hdr->bfd_section != NULL)
866 hdr->bfd_section = newsect;
867 elf_section_data (newsect)->this_hdr = *hdr;
871 elf_section_type (newsect) = hdr->sh_type;
872 elf_section_flags (newsect) = hdr->sh_flags;
874 newsect->filepos = hdr->sh_offset;
876 if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr)
877 || ! bfd_set_section_size (abfd, newsect, hdr->sh_size)
879 bfd_log2 (hdr->sh_addralign)))
883 if (hdr->sh_type != SHT_NOBITS)
885 if (hdr->sh_type == SHT_GROUP)
887 if ((hdr->sh_flags & SHF_ALLOC) != 0)
890 if (hdr->sh_type != SHT_NOBITS)
893 if ((hdr->sh_flags & SHF_WRITE) == 0)
895 if ((hdr->sh_flags & SHF_EXECINSTR) != 0)
899 if ((hdr->sh_flags & SHF_MERGE) != 0)
902 newsect->entsize = hdr->sh_entsize;
903 if ((hdr->sh_flags & SHF_STRINGS) != 0)
906 if (hdr->sh_flags & SHF_GROUP)
907 if (!setup_group (abfd, hdr, newsect))
909 if ((hdr->sh_flags & SHF_TLS) != 0)
911 if ((hdr->sh_flags & SHF_EXCLUDE) != 0)
953 if (! bed->elf_backend_section_flags (&flags, hdr))
962 if (hdr->sh_type == SHT_NOTE)
969 elf_parse_notes (abfd, (char *) contents, hdr->sh_size, -1);
995 && (hdr->sh_flags & SHF_TLS) == 0)
997 && ELF_SECTION_IN_SEGMENT (hdr, phdr))
1001 + hdr->sh_addr - phdr->p_vaddr);
1011 + hdr->sh_offset - phdr->p_offset);
1017 if (hdr->sh_addr >= phdr->p_vaddr
1018 && (hdr->sh_addr + hdr->sh_size
1579 Elf_Internal_Shdr *hdr;
1621 hdr = elf_elfsections (abfd)[shindex];
1624 hdr->sh_name);
1629 switch (hdr->sh_type)
1644 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
1648 if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
1651 if (hdr->sh_link > elf_numsections (abfd))
1659 if (hdr->sh_link == (SHN_LORESERVE & 0xffff) /* SHN_BEFORE */
1660 || hdr->sh_link == ((SHN_LORESERVE + 1) & 0xffff) /* SHN_AFTER */)
1667 else if (elf_elfsections (abfd)[hdr->sh_link] == NULL)
1669 else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
1679 hdr->sh_link = dynsymhdr->sh_link;
1691 hdr->sh_link = dynsymhdr->sh_link;
1703 if (hdr->sh_entsize != bed->s->sizeof_sym)
1706 if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
1708 if (hdr->sh_size != 0)
1713 hdr->sh_info = 0;
1719 elf_tdata (abfd)->symtab_hdr = *hdr;
1720 elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr;
1729 if ((hdr->sh_flags & SHF_ALLOC) != 0
1731 && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name,
1767 if (hdr->sh_entsize != bed->s->sizeof_sym)
1770 if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
1772 if (hdr->sh_size != 0)
1778 hdr->sh_info = 0;
1784 elf_tdata (abfd)->dynsymtab_hdr = *hdr;
1785 elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->dynsymtab_hdr;
1790 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
1799 elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
1804 if (hdr->bfd_section != NULL)
1809 elf_tdata (abfd)->shstrtab_hdr = *hdr;
1817 elf_tdata (abfd)->strtab_hdr = *hdr;
1825 elf_tdata (abfd)->dynstrtab_hdr = *hdr;
1826 hdr = &elf_tdata (abfd)->dynstrtab_hdr;
1827 elf_elfsections (abfd)[shindex] = hdr;
1830 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
1860 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
1873 if (hdr->sh_entsize
1874 != (bfd_size_type) (hdr->sh_type == SHT_REL
1879 if (hdr->sh_link >= num_sec)
1883 abfd, hdr->sh_link, name, shindex));
1884 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
1899 && elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB
1900 && elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_DYNSYM)
1920 hdr->sh_link = found;
1924 if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
1925 || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM)
1926 && ! bfd_section_from_shdr (abfd, hdr->sh_link))
1936 if (hdr->sh_link != elf_onesymtab (abfd)
1937 || hdr->sh_link == SHN_UNDEF
1938 || hdr->sh_info == SHN_UNDEF
1939 || hdr->sh_info >= num_sec
1940 || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
1941 || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
1943 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
1948 if (! bfd_section_from_shdr (abfd, hdr->sh_info))
1951 target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
1956 if (hdr->sh_type == SHT_RELA)
1957 p_hdr = &esdt->rela.hdr;
1959 p_hdr = &esdt->rel.hdr;
1966 *hdr2 = *hdr;
1969 target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
1972 target_sect->rel_filepos = hdr->sh_offset;
1975 if (hdr->sh_size != 0)
1977 if (hdr->sh_type == SHT_RELA)
1986 elf_tdata (abfd)->dynverdef_hdr = *hdr;
1987 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
1991 if (hdr->sh_entsize != sizeof (Elf_External_Versym))
1995 elf_tdata (abfd)->dynversym_hdr = *hdr;
1996 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
2001 elf_tdata (abfd)->dynverref_hdr = *hdr;
2002 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
2009 if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE))
2012 if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
2015 if (hdr->contents != NULL)
2017 Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
2018 unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE;
2022 hdr->bfd_section->flags
2035 elf_next_in_group (hdr->bfd_section) = s;
2044 if (hdr->sh_type == SHT_GNU_ATTRIBUTES
2045 || hdr->sh_type == bed->obj_attrs_section_type)
2047 if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
2049 _bfd_elf_parse_attributes (abfd, hdr);
2054 if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
2057 if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
2059 if ((hdr->sh_flags & SHF_ALLOC) != 0)
2065 abfd, name, hdr->sh_type);
2069 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
2074 else if (hdr->sh_type >= SHT_LOPROC
2075 && hdr->sh_type <= SHT_HIPROC)
2080 abfd, name, hdr->sh_type);
2081 else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS)
2084 if ((hdr->sh_flags & SHF_OS_NONCONFORMING) != 0)
2091 abfd, name, hdr->sh_type);
2095 ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
2103 abfd, name, hdr->sh_type);
2471 Elf_Internal_Phdr *hdr,
2481 split = ((hdr->p_memsz > 0)
2482 && (hdr->p_filesz > 0)
2483 && (hdr->p_memsz > hdr->p_filesz));
2485 if (hdr->p_filesz > 0)
2496 newsect->vma = hdr->p_vaddr;
2497 newsect->lma = hdr->p_paddr;
2498 newsect->size = hdr->p_filesz;
2499 newsect->filepos = hdr->p_offset;
2501 newsect->alignment_power = bfd_log2 (hdr->p_align);
2502 if (hdr->p_type == PT_LOAD)
2506 if (hdr->p_flags & PF_X)
2513 if (!(hdr->p_flags & PF_W))
2519 if (hdr->p_memsz > hdr->p_filesz)
2532 newsect->vma = hdr->p_vaddr + hdr->p_filesz;
2533 newsect->lma = hdr->p_paddr + hdr->p_filesz;
2534 newsect->size = hdr->p_memsz - hdr->p_filesz;
2535 newsect->filepos = hdr->p_offset + hdr->p_filesz;
2537 if (align == 0 || align > hdr->p_align)
2538 align = hdr->p_align;
2540 if (hdr->p_type == PT_LOAD)
2551 if (hdr->p_flags & PF_X)
2554 if (!(hdr->p_flags & PF_W))
2562 bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index)
2566 switch (hdr->p_type)
2569 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "null");
2572 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "load");
2575 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "dynamic");
2578 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "interp");
2581 if (! _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "note"))
2583 if (! elf_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
2588 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "shlib");
2591 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "phdr");
2594 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index,
2598 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "stack");
2601 return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro");
2606 return bed->elf_backend_section_from_phdr (abfd, hdr, hdr_index, "proc");
2616 if (elf_section_data (sec)->rel.hdr)
2618 BFD_ASSERT (elf_section_data (sec)->rela.hdr == NULL);
2619 return elf_section_data (sec)->rel.hdr;
2622 return elf_section_data (sec)->rela.hdr;
2642 BFD_ASSERT (reldata->hdr == NULL);
2644 reldata->hdr = rel_hdr;
2875 if (esd->rel.count && esd->rel.hdr == NULL
2881 if (esd->rela.count && esd->rela.hdr == NULL
3073 if (d->rel.hdr)
3076 _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel.hdr->sh_name);
3081 if (d->rela.hdr)
3084 _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rela.hdr->sh_name);
3167 i_shdrp[d->rel.idx] = d->rel.hdr;
3169 i_shdrp[d->rela.idx] = d->rela.hdr;
3178 d->rel.hdr->sh_link = elf_onesymtab (abfd);
3179 d->rel.hdr->sh_info = d->this_idx;
3180 d->rel.hdr->sh_flags |= SHF_INFO_LINK;
3184 d->rela.hdr->sh_link = elf_onesymtab (abfd);
3185 d->rela.hdr->sh_info = d->this_idx;
3186 d->rela.hdr->sh_flags |= SHF_INFO_LINK;
3618 Elf_Internal_Shdr *hdr;
3622 hdr = &elf_tdata (abfd)->symtab_hdr;
3623 off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3625 hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
3626 if (hdr->sh_size != 0)
3627 off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3629 hdr = &elf_tdata (abfd)->strtab_hdr;
3630 off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3636 if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
4005 asection *hdr;
4008 hdr = *hdrpp;
4019 else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma)
4026 else if (hdr->lma < last_hdr->lma + last_size
4041 <= hdr->lma))
4048 && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
4063 && (hdr->flags & SEC_READONLY) == 0
4065 != (hdr->lma & -maxpagesize)))
4087 = info->callbacks->override_segment_assignment (info, abfd, hdr,
4093 if ((hdr->flags & SEC_READONLY) == 0)
4095 last_hdr = hdr;
4097 if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD))
4099 last_size = hdr->size;
4106 header holding all the sections from phdr_index until hdr. */
4115 if ((hdr->flags & SEC_READONLY) == 0)
4120 last_hdr = hdr;
4122 if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
4123 last_size = hdr->size;
4982 Elf_Internal_Shdr *hdr;
4984 hdr = *hdrpp;
4985 if (hdr->bfd_section != NULL
4986 && (hdr->bfd_section->filepos != 0
4987 || (hdr->sh_type == SHT_NOBITS
4988 && hdr->contents == NULL)))
4989 BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
4990 else if ((hdr->sh_flags & SHF_ALLOC) != 0)
4992 if (hdr->sh_size != 0)
4996 (hdr->bfd_section == NULL
4998 : hdr->bfd_section->name));
5000 if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0)
5001 off += vma_page_aligned_bias (hdr->sh_addr, off,
5004 off += vma_page_aligned_bias (hdr->sh_addr, off,
5005 hdr->sh_addralign);
5006 off = _bfd_elf_assign_file_position_for_section (hdr, off,
5009 else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5010 && hdr->bfd_section == NULL)
5011 || hdr == i_shdrpp[elf_onesymtab (abfd)]
5012 || hdr == i_shdrpp[elf_symtab_shndx (abfd)]
5013 || hdr == i_shdrpp[elf_strtab_sec (abfd)])
5014 hdr->sh_offset = -1;
5016 off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
5180 Elf_Internal_Shdr *hdr = &elf_section_data (sect)->this_hdr;
5181 if (hdr->sh_type != SHT_NOBITS)
5184 + hdr->sh_size);
5248 Elf_Internal_Shdr *hdr;
5250 hdr = *hdrpp;
5251 if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5252 && hdr->bfd_section == NULL)
5257 hdr->sh_offset = -1;
5260 off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
7094 Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
7096 symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
7109 Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->dynsymtab_hdr;
7117 symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
7267 Elf_Internal_Shdr *hdr;
7273 hdr = &elf_tdata (abfd)->dynverref_hdr;
7275 if (hdr->sh_info)
7277 bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed));
7284 elf_tdata (abfd)->cverrefs = hdr->sh_info;
7286 contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
7294 if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
7295 || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
7298 if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verneed))
7303 contents_end = contents + hdr->sh_size - sizeof (Elf_External_Verneed);
7306 for (i = 0; i < hdr->sh_info; i++, iverneed++)
7317 bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
7345 bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
7366 if (i + 1 < hdr->sh_info)
7385 Elf_Internal_Shdr *hdr;
7394 hdr = &elf_tdata (abfd)->dynverdef_hdr;
7396 contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
7399 if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
7400 || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
7403 if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verdef))
7408 contents_end_def = contents + hdr->sh_size
7410 contents_end_aux = contents + hdr->sh_size
7418 for (i = 0; i < hdr->sh_info; ++i)
7453 for (i = 0; i < hdr->sh_info; i++)
7497 bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
7884 Elf_Internal_Shdr *hdr;
7891 hdr = &elf_section_data (section)->this_hdr;
7892 pos = hdr->sh_offset + offset;
10021 Elf_Internal_Shdr *hdr;
10043 hdr = &elf_section_data (relplt)->this_hdr;
10044 if (hdr->sh_link != elf_dynsymtab (abfd)
10045 || (hdr->sh_type != SHT_REL && hdr->sh_type != SHT_RELA))
10056 count = relplt->size / hdr->sh_entsize;