Lines Matching refs:main

103 	 data) now differs between the main and debug files.  The
124 address when there is a separate debug file and a prelinked main
148 the main ELF file. (It might be changed for the kernel, because
150 the main ELF file, because both find_dw and find_symtab call
151 __libdwfl_getelf first to open the main file. So don't let debug
153 below could otherwise trigger for non-kernel/non-main files, since
155 if (file == &mod->main)
164 assert (mod->main.elf != NULL);
177 mod->main.elf), 2))
197 elf_end (mod->main.elf);
198 mod->main.elf = NULL;
199 if (mod->main.fd >= 0)
201 close (mod->main.fd);
202 mod->main.fd = -1;
206 /* Find the main ELF file for this module and open libelf on it.
207 When we return success, MOD->main.elf and MOD->main.bias are set up. */
212 if (mod->main.elf != NULL /* Already done. */
216 mod->main.fd = (*mod->dwfl->callbacks->find_elf) (MODCB_ARGS (mod),
217 &mod->main.name,
218 &mod->main.elf);
219 const bool fallback = mod->main.elf == NULL && mod->main.fd < 0;
220 mod->elferr = open_elf (mod, &mod->main);
224 if (!mod->main.valid)
235 mod->main_bias = mod->e_type == ET_REL ? 0 : mod->low_addr - mod->main.vaddr;
256 /* If the main file might have been prelinked, then we need to
257 discover the correct synchronization address between the main and
264 We can do that in the main file, but in the debug file all the
269 section in the prelinked main file. This shows what the sections
277 if (elf_getshdrstrndx (mod->main.elf, &shstrndx) < 0)
281 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL)
291 const char *secname = elf_strptr (mod->main.elf, shstrndx,
324 src.d_size = gelf_fsize (mod->main.elf, ELF_T_EHDR, 1, EV_CURRENT);
326 if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
327 elf_getident (mod->main.elf, NULL)[EI_DATA])
331 size_t shentsize = gelf_fsize (mod->main.elf, ELF_T_SHDR, 1, EV_CURRENT);
332 size_t phentsize = gelf_fsize (mod->main.elf, ELF_T_PHDR, 1, EV_CURRENT);
374 if (unlikely (elf_getphdrnum (mod->main.elf, &main_phnum)))
379 if (unlikely (gelf_getphdr (mod->main.elf, i, &phdr) == NULL))
405 if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
439 src.d_size = gelf_fsize (mod->main.elf, ELF_T_SHDR, shnum, EV_CURRENT);
450 if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
457 /* Now we can look at the original section headers of the main file
458 before it was prelinked. First we'll apply our method to the main
460 synchronization address of the main file. Then we'll apply that
477 while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL)
489 if (highest > mod->main.vaddr)
491 mod->main.address_sync = highest;
535 debuglink_file = INTUSE(dwelf_elf_gnu_debuglink) (mod->main.elf,
539 mod->main.name,
552 the main or debug name from which the Dwarf was created. */
708 find_offsets (mod->main.elf, adjust, phnum, i_max, addrs, offs);
716 Elf_Data *data = elf_getdata_rawchunk (mod->main.elf,
737 Elf_Data *data = elf_getdata_rawchunk (mod->main.elf, offs[i_gnu_hash],
745 + (gelf_getclass (mod->main.elf)
756 data = elf_getdata_rawchunk (mod->main.elf, buckets_at,
772 data = elf_getdata_rawchunk (mod->main.elf,
791 / gelf_fsize (mod->main.elf,
796 mod->symdata = elf_getdata_rawchunk (mod->main.elf,
798 gelf_fsize (mod->main.elf,
805 mod->symstrdata = elf_getdata_rawchunk (mod->main.elf,
816 mod->symfile = &mod->main;
827 GElf_Ehdr *ehdr = gelf_getehdr (mod->main.elf, &ehdr_mem);
830 if (unlikely (elf_getphdrnum (mod->main.elf, &phnum) != 0))
836 GElf_Phdr *phdr = gelf_getphdr (mod->main.elf, i, &phdr_mem);
844 Elf_Data *data = elf_getdata_rawchunk (mod->main.elf,
852 size_t n = data->d_size / gelf_fsize (mod->main.elf,
904 /* Try to find the offset between the main file and .gnu_debugdata. */
909 The address_sync is equal to the main file it is embedded in at first. */
910 mod->aux_sym.address_sync = mod->main.address_sync;
915 if (unlikely (gelf_getehdr (mod->main.elf, &ehdr_main) == NULL)
929 /* Try to find the auxiliary symbol table embedded in the main elf file
931 from the main file dynsym. No harm done if not found. */
941 Elf *elf = mod->main.elf;
1050 /* Try to find a symbol table in either MOD->main.elf or MOD->debug.elf. */
1063 /* First see if the main ELF file has the debugging information. */
1067 mod->symerr = load_symtab (&mod->main, &mod->symfile, &symscn,
1310 mod->ebl = ebl_openbackend (mod->main.elf);
1352 if (mod->main.fd != -1 && elf_cntl (mod->main.elf, ELF_C_FDREAD) == 0)
1354 close (mod->main.fd);
1355 mod->main.fd = -1;
1368 && debugfile == &mod->main)
1377 /* Try to start up libdw on either the main file or the debuginfo file. */
1390 /* First see if the main ELF file has the debugging information. */
1391 mod->dwerr = load_dw (mod, &mod->main);
1395 mod->debug.elf = mod->main.elf;
1396 mod->debug.address_sync = mod->main.address_sync;
1401 find_debug_altlink (mod, mod->main.name);
1452 && mod->main.relocated && ! mod->debug.relocated)
1455 if (mod->debug.elf != mod->main.elf)
1495 we have an auxiliary table make sure all the main locals come
1496 first, then all aux locals, then all main globals and finally all