Home
last modified time | relevance | path

Searched refs:shdr (Results 1 – 25 of 48) sorted by relevance

12

/freebsd/stand/common/
H A Dload_elf_obj.c227 Elf_Shdr *shdr, *cshdr, *lshdr; in __elfN() local
238 shdr = alloc_pread(VECTX_HANDLE(ef), (off_t)hdr->e_shoff, shdrbytes); in __elfN()
239 if (shdr == NULL) { in __elfN()
244 ef->e_shdr = shdr; in __elfN()
252 shdr[i].sh_addr = 0; in __elfN()
254 if (shdr[i].sh_size == 0) in __elfN()
256 switch (shdr[i].sh_type) { in __elfN()
264 if ((shdr[i].sh_flags & SHF_ALLOC) == 0) in __elfN()
266 lastaddr = roundup(lastaddr, shdr[i].sh_addralign); in __elfN()
267 shdr[i].sh_addr = (Elf_Addr)lastaddr; in __elfN()
[all …]
H A Dload_elf.c179 static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) in elf_section_header_convert() argument
193 CONVERT_SWITCH(ehdr, shdr, SECTION_HEADER_FIELDS); in elf_section_header_convert()
212 static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) in elf_section_header_convert() argument
535 Elf_Shdr *shdr; local
555 shdr = NULL;
709 shdr = alloc_pread(VECTX_HANDLE(ef), ehdr->e_shoff, chunk);
710 if (shdr == NULL) {
717 elf_section_header_convert(ehdr, &shdr[i]);
719 file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr);
726 chunk = shdr[ehdr->e_shstrndx].sh_size;
[all …]
/freebsd/cddl/contrib/opensolaris/tools/ctf/cvt/
H A Doutput.c340 GElf_Shdr shdr; in sort_iidescs() local
354 gelf_getshdr(scn, &shdr); in sort_iidescs()
355 nent = shdr.sh_size / shdr.sh_entsize; in sort_iidescs()
357 scn = elf_getscn(elf, shdr.sh_link); in sort_iidescs()
461 GElf_Shdr shdr; in write_file() local
540 gelf_getshdr(sscn, &shdr); in write_file()
557 pad = new_offset % shdr.sh_addralign; in write_file()
560 new_offset += shdr.sh_addralign - pad; in write_file()
561 shdr.sh_offset = new_offset; in write_file()
564 shdr.sh_link = secxlate[shdr.sh_link]; in write_file()
[all …]
H A Dutil.c69 GElf_Shdr shdr; in findelfsecidx() local
77 if (gelf_getshdr(scn, &shdr) == NULL) { in findelfsecidx()
84 (size_t)shdr.sh_name)) == NULL) { in findelfsecidx()
/freebsd/sys/kern/
H A Dlink_elf_obj.c347 Elf_Shdr *shdr; in link_elf_link_preload() local
366 shdr = (Elf_Shdr *)preload_search_info(modptr, MODINFO_METADATA | in link_elf_link_preload()
371 shdr == NULL) in link_elf_link_preload()
393 ef->e_shdr = shdr; in link_elf_link_preload()
399 switch (shdr[i].sh_type) { in link_elf_link_preload()
408 if (shdr[i].sh_addr == 0) in link_elf_link_preload()
414 symstrindex = shdr[i].sh_link; in link_elf_link_preload()
421 if (shdr[shdr[i].sh_info].sh_addr == 0) in link_elf_link_preload()
426 if (shdr[shdr[i].sh_info].sh_addr == 0) in link_elf_link_preload()
436 shdr[symstrindex].sh_type != SHT_STRTAB || shstrindex == 0 || in link_elf_link_preload()
[all …]
H A Dkern_ctf.c48 Elf_Shdr *shdr = NULL; in link_elf_ctf_get() local
133 shdr = malloc(nbytes, M_LINKER, M_WAITOK); in link_elf_ctf_get()
136 if ((error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)shdr, nbytes, in link_elf_ctf_get()
146 if (hdr->e_shstrndx == 0 || shdr[hdr->e_shstrndx].sh_type != SHT_STRTAB) { in link_elf_ctf_get()
151 shdr[hdr->e_shstrndx].sh_type); in link_elf_ctf_get()
158 shstrtab = malloc(shdr[hdr->e_shstrndx].sh_size, M_LINKER, M_WAITOK); in link_elf_ctf_get()
162 shdr[hdr->e_shstrndx].sh_size, shdr[hdr->e_shstrndx].sh_offset, in link_elf_ctf_get()
168 if (strcmp(".SUNW_ctf", shstrtab + shdr[i].sh_name) == 0) in link_elf_ctf_get()
183 shdr[i].sh_offset, UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, in link_elf_ctf_get()
223 raw = malloc(shdr[i].sh_size, M_LINKER, M_WAITOK); in link_elf_ctf_get()
[all …]
H A Dlink_elf.c838 link_elf_locate_exidx(linker_file_t lf, Elf_Shdr *shdr, int nhdr) in link_elf_locate_exidx() argument
843 if (shdr[i].sh_type == SHT_ARM_EXIDX) { in link_elf_locate_exidx()
844 lf->exidx_addr = shdr[i].sh_addr + lf->address; in link_elf_locate_exidx()
845 lf->exidx_size = shdr[i].sh_size; in link_elf_locate_exidx()
861 Elf_Shdr *shdr; in link_elf_locate_exidx_preload() local
867 shdr = (Elf_Shdr *)modinfo; in link_elf_locate_exidx_preload()
869 link_elf_locate_exidx(lf, shdr, nhdr); in link_elf_locate_exidx_preload()
990 Elf_Shdr *shdr; in link_elf_load_file() local
998 shdr = NULL; in link_elf_load_file()
1261 shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); in link_elf_load_file()
[all …]
/freebsd/lib/libc/gen/
H A Dnlist.c133 Elf_Shdr *shdr = NULL; in __elf_fdnlist() local
159 shdr = (Elf_Shdr *)base; in __elf_fdnlist()
168 if (shdr[i].sh_type == SHT_SYMTAB) { in __elf_fdnlist()
169 symoff = shdr[i].sh_offset; in __elf_fdnlist()
170 symsize = shdr[i].sh_size; in __elf_fdnlist()
171 symstroff = shdr[shdr[i].sh_link].sh_offset; in __elf_fdnlist()
172 symstrsize = shdr[shdr[i].sh_link].sh_size; in __elf_fdnlist()
238 elf_sym_to_nlist(p, s, shdr, in __elf_fdnlist()
250 if (shdr != NULL) in __elf_fdnlist()
251 munmap(shdr, shdr_size); in __elf_fdnlist()
[all …]
/freebsd/usr.sbin/crunch/crunchide/
H A Dexec_elf32.c91 Elf_Shdr *shdr; member
306 layoutp[shnum].shdr = &shdrshdr; in ELFNAMEEND()
315 xewtoh(layoutp[m].shdr->sh_offset)) in ELFNAMEEND()
326 layoutp[r].shdr = &shdrp[i]; in ELFNAMEEND()
349 if (layoutp[i].shdr == &shdrshdr) { in ELFNAMEEND()
354 if (layoutp[i].shdr == shstrtabshdr) { in ELFNAMEEND()
360 if (layoutp[i].shdr == strtabshdr) in ELFNAMEEND()
362 if (layoutp[i].shdr == symtabshdr || i >= strtabidx) { in ELFNAMEEND()
363 off = xewtoh(layoutp[i].shdr->sh_offset); in ELFNAMEEND()
364 if ((size = xewtoh(layoutp[i].shdr->sh_size)) == 0) in ELFNAMEEND()
[all …]
/freebsd/lib/libkldelf/
H A Delf.c313 GElf_Shdr *shdr; in elf_read_shdrs() local
321 shdr = calloc(nshdr, sizeof(*shdr)); in elf_read_shdrs()
322 if (shdr == NULL) in elf_read_shdrs()
331 if (gelf_getshdr(scn, &shdr[i]) == NULL) { in elf_read_shdrs()
338 *shdrp = shdr; in elf_read_shdrs()
341 free(shdr); in elf_read_shdrs()
349 GElf_Shdr shdr; in elf_read_dynamic() local
358 if (gelf_getshdr(scn, &shdr) == NULL) in elf_read_dynamic()
364 ndyn = elf_object_count(efile, ELF_T_DYN, shdr.sh_size); in elf_read_dynamic()
385 GElf_Shdr shdr; in elf_read_symbols() local
[all …]
H A Def_obj.c273 GElf_Shdr *shdr; in ef_obj_open() local
296 error = elf_read_shdrs(efile, &nshdr, &shdr); in ef_obj_open()
298 shdr = NULL; in ef_obj_open()
307 switch (shdr[i].sh_type) { in ef_obj_open()
315 symstrindex = shdr[i].sh_link; in ef_obj_open()
337 shdr[symstrindex].sh_type != SHT_STRTAB) { in ef_obj_open()
363 if (elf_read_string_table(efile, &shdr[symstrindex], &ef->ddbstrcnt, in ef_obj_open()
371 shdr[hdr->e_shstrndx].sh_type == SHT_STRTAB) { in ef_obj_open()
372 if (elf_read_string_table(efile, &shdr[hdr->e_shstrndx], in ef_obj_open()
388 switch (shdr[i].sh_type) { in ef_obj_open()
[all …]
H A Def.c227 GElf_Shdr *shdr; in ef_parse_dynamic() local
246 error = elf_read_shdrs(ef->ef_efile, &nshdr, &shdr); in ef_parse_dynamic()
254 if (shdr[i].sh_type == SHT_DYNAMIC) { in ef_parse_dynamic()
261 if (shdr[i].sh_offset != phdyn->p_offset || in ef_parse_dynamic()
264 shdr[i].sh_size > phdyn->p_filesz : in ef_parse_dynamic()
265 shdr[i].sh_size != phdyn->p_filesz)) { in ef_parse_dynamic()
374 switch (shdr[i].sh_type) { in ef_parse_dynamic()
376 if (shdr[i].sh_offset != hash_off) { in ef_parse_dynamic()
386 if (shdr[i].sh_size < sizeof(*ef->ef_hashtab) * 2) { in ef_parse_dynamic()
392 shdr[i].sh_offset, shdr[i].sh_size, in ef_parse_dynamic()
[all …]
/freebsd/contrib/elftoolchain/size/
H A Dsize.c618 GElf_Shdr shdr; in handle_elf() local
655 if (gelf_getshdr(scn, &shdr) != NULL) in handle_elf()
656 berkeley_calc(&shdr); in handle_elf()
662 if (gelf_getshdr(scn, &shdr) != NULL) in handle_elf()
663 sysv_calc(elf, &elfhdr, &shdr); in handle_elf()
705 sysv_calc(Elf *elf, GElf_Ehdr *elfhdr, GElf_Shdr *shdr) in sysv_calc() argument
710 (size_t) shdr->sh_name); in sysv_calc()
711 if ((shdr->sh_type == SHT_SYMTAB || in sysv_calc()
712 shdr->sh_type == SHT_STRTAB || shdr->sh_type == SHT_RELA || in sysv_calc()
713 shdr->sh_type == SHT_REL) && shdr->sh_addr == 0) in sysv_calc()
[all …]
/freebsd/sys/compat/linux/
H A Dlinux_vdso.c104 const Elf_Shdr *shdr; in __elfN() local
120 shdr = (const Elf_Shdr *)(base + ehdr->e_shoff); in __elfN()
124 if (shdr[i].sh_size == 0) in __elfN()
126 if (shdr[i].sh_type == SHT_DYNSYM) { in __elfN()
127 dsym = (Elf_Sym *)(base + shdr[i].sh_offset); in __elfN()
128 strtab = base + shdr[shdr[i].sh_link].sh_offset; in __elfN()
129 symcnt = shdr[i].sh_size / sizeof(*dsym); in __elfN()
/freebsd/contrib/elftoolchain/libelf/
H A Dlibelf_checksum.c53 GElf_Shdr shdr; in _libelf_checksum() local
81 if (gelf_getshdr(scn, &shdr) == NULL) in _libelf_checksum()
83 if ((shdr.sh_flags & SHF_ALLOC) == 0 || in _libelf_checksum()
84 shdr.sh_type == SHT_DYNAMIC || in _libelf_checksum()
85 shdr.sh_type == SHT_DYNSYM) in _libelf_checksum()
H A Delf_strptr.c45 GElf_Shdr shdr; in elf_strptr() local
54 gelf_getshdr(s, &shdr) == NULL) in elf_strptr()
57 if (shdr.sh_type != SHT_STRTAB || in elf_strptr()
58 offset >= shdr.sh_size) { in elf_strptr()
/freebsd/sys/x86/xen/
H A Dpv.c220 Elf_Shdr *shdr; in xen_pvh_parse_symtab() local
232 shdr = (Elf_Shdr *)((uint8_t *)ehdr + ehdr->e_shoff); in xen_pvh_parse_symtab()
235 if (shdr[i].sh_type != SHT_SYMTAB) in xen_pvh_parse_symtab()
237 if (shdr[i].sh_offset == 0) in xen_pvh_parse_symtab()
239 ksymtab = (uintptr_t)((uint8_t *)ehdr + shdr[i].sh_offset); in xen_pvh_parse_symtab()
240 ksymtab_size = shdr[i].sh_size; in xen_pvh_parse_symtab()
241 j = shdr[i].sh_link; in xen_pvh_parse_symtab()
242 if (shdr[j].sh_offset == 0) in xen_pvh_parse_symtab()
244 kstrtab = (uintptr_t)((uint8_t *)ehdr + shdr[j].sh_offset); in xen_pvh_parse_symtab()
/freebsd/contrib/libexecinfo/
H A Dsymtab.c117 GElf_Shdr shdr; in symtab_create() local
122 gelf_getshdr(scn, &shdr); in symtab_create()
123 if(shdr.sh_type != SHT_SYMTAB) in symtab_create()
127 ns = shdr.sh_size / shdr.sh_entsize; in symtab_create()
141 elf_strptr(elf, shdr.sh_link, sym.st_name), in symtab_create()
157 elf_strptr(elf, shdr.sh_link, sym.st_name)); in symtab_create()
/freebsd/sys/powerpc/powerpc/
H A Dmachdep.c532 Elf_Shdr *shdr; in load_external_symtab() local
587 shdr = (Elf_Shdr *)(kernelimg + ehdr->e_shoff); in load_external_symtab()
596 if (shdr[i].sh_type == SHT_SYMTAB) { in load_external_symtab()
598 shdr[i].sh_offset); in load_external_symtab()
600 (kernelimg_final + shdr[i].sh_offset); in load_external_symtab()
601 ksym_sz = (vm_offset_t)(shdr[i].sh_size); in load_external_symtab()
603 shdr[shdr[i].sh_link].sh_offset); in load_external_symtab()
606 shdr[shdr[i].sh_link].sh_offset); in load_external_symtab()
609 (shdr[shdr[i].sh_link].sh_size); in load_external_symtab()
/freebsd/cddl/contrib/opensolaris/cmd/lockstat/
H A Dsym.c197 GElf_Shdr shdr; in symtab_init() local
198 (void) gelf_getshdr(scn, &shdr); in symtab_init()
199 if (shdr.sh_type == SHT_SYMTAB) { in symtab_init()
201 nsyms = shdr.sh_size / shdr.sh_entsize; in symtab_init()
202 strindex = shdr.sh_link; in symtab_init()
/freebsd/contrib/elftoolchain/strings/
H A Dstrings.c265 GElf_Shdr shdr; in handle_elf() local
298 if (gelf_getshdr(scn, &shdr) == NULL) in handle_elf()
300 if (shdr.sh_type != SHT_NOBITS && in handle_elf()
301 (shdr.sh_flags & SHF_ALLOC) != 0) { in handle_elf()
302 rc = find_strings(name, pfile, shdr.sh_offset, in handle_elf()
303 shdr.sh_size); in handle_elf()
/freebsd/lib/libproc/
H A Dproc_sym.c158 GElf_Shdr shdr; in load_symtab() local
168 (void)gelf_getshdr(scn, &shdr); in load_symtab()
169 if (shdr.sh_type == sh_type) in load_symtab()
175 nsyms = shdr.sh_size / shdr.sh_entsize; in load_symtab()
188 symtab->stridx = shdr.sh_link; in load_symtab()
239 GElf_Shdr shdr; in open_object() local
272 if (gelf_getshdr(scn, &shdr) != &shdr) { in open_object()
277 if (shdr.sh_type != SHT_PROGBITS) in open_object()
284 if ((scnname = elf_strptr(e, ndx, shdr.sh_name)) == NULL) in open_object()
/freebsd/contrib/elftoolchain/elfcopy/
H A Darchive.c250 GElf_Shdr shdr; in extract_arsym() local
269 if (gelf_getshdr(scn, &shdr) != &shdr) { in extract_arsym()
273 if ((name = elf_strptr(ecp->eout, shstrndx, shdr.sh_name)) == in extract_arsym()
293 if (gelf_getshdr(scn, &shdr) != &shdr) { in extract_arsym()
297 if (shdr.sh_type != SHT_SYMTAB) in extract_arsym()
302 while (n < shdr.sh_size && in extract_arsym()
304 len = data->d_size / shdr.sh_entsize; in extract_arsym()
/freebsd/sys/dev/ipw/
H A Dif_ipw.c489 struct ipw_soft_hdr *shdr; in ipw_dma_alloc() local
618 shdr = &sc->shdr_list[i]; in ipw_dma_alloc()
619 error = bus_dmamap_create(sc->hdr_dmat, 0, &shdr->map); in ipw_dma_alloc()
625 SLIST_INSERT_HEAD(&sc->free_shdr, shdr, next); in ipw_dma_alloc()
1302 struct ipw_soft_hdr *shdr; in ipw_release_sbd() local
1313 shdr = sbd->priv; in ipw_release_sbd()
1314 bus_dmamap_sync(sc->hdr_dmat, shdr->map, BUS_DMASYNC_POSTWRITE); in ipw_release_sbd()
1315 bus_dmamap_unload(sc->hdr_dmat, shdr->map); in ipw_release_sbd()
1316 SLIST_INSERT_HEAD(&sc->free_shdr, shdr, next); in ipw_release_sbd()
1550 struct ipw_soft_hdr *shdr; in ipw_tx_start() local
[all …]
/freebsd/contrib/elftoolchain/ar/
H A Dwrite.c816 GElf_Shdr shdr; in create_symtab_entry() local
836 if (gelf_getshdr(scn, &shdr) != &shdr) { in create_symtab_entry()
841 if ((name = elf_strptr(e, shstrndx, shdr.sh_name)) == NULL) { in create_symtab_entry()
862 if (gelf_getshdr(scn, &shdr) != &shdr) { in create_symtab_entry()
867 if (shdr.sh_type != SHT_SYMTAB) in create_symtab_entry()
872 while (n < shdr.sh_size && in create_symtab_entry()
874 len = data->d_size / shdr.sh_entsize; in create_symtab_entry()

12