Lines Matching refs:ofl
78 ld_open_outfile(Ofl_desc * ofl) in ld_open_outfile() argument
87 mode = (ofl->ofl_flags & (FLG_OF_EXEC | FLG_OF_SHAROBJ)) in ld_open_outfile()
91 if (stat(ofl->ofl_name, &status) == 0) { in ld_open_outfile()
99 ofl->ofl_flags1 |= FLG_OF1_NONREG; in ld_open_outfile()
126 if ((ofl->ofl_fd = open(ofl->ofl_name, O_RDWR, in ld_open_outfile()
131 ld_eprintf(ofl, ERR_FATAL, in ld_open_outfile()
133 ofl->ofl_name, strerror(err)); in ld_open_outfile()
137 (void) close(ofl->ofl_fd); in ld_open_outfile()
140 if ((unlink(ofl->ofl_name) == -1) && in ld_open_outfile()
144 ld_eprintf(ofl, ERR_FATAL, in ld_open_outfile()
146 ofl->ofl_name, strerror(err)); in ld_open_outfile()
157 if ((ofl->ofl_fd = open(ofl->ofl_name, O_RDWR | O_CREAT | O_TRUNC, in ld_open_outfile()
161 ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), in ld_open_outfile()
162 ofl->ofl_name, strerror(err)); in ld_open_outfile()
185 pad_outfile(Ofl_desc *ofl) in pad_outfile() argument
197 if (elf_update(ofl->ofl_welf, ELF_C_NULL) == -1) { in pad_outfile()
198 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), in pad_outfile()
199 ofl->ofl_name); in pad_outfile()
202 if ((ehdr = elf_getehdr(ofl->ofl_welf)) == NULL) { in pad_outfile()
203 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), in pad_outfile()
204 ofl->ofl_name); in pad_outfile()
217 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in pad_outfile()
237 ld_eprintf(ofl, ERR_ELF, in pad_outfile()
238 MSG_INTL(MSG_ELF_NEWDATA), ofl->ofl_name); in pad_outfile()
247 data->d_version = ofl->ofl_dehdr->e_version; in pad_outfile()
287 create_outsec(Ofl_desc *ofl, Sg_desc *sgp, Os_desc *osp, Word ptype, int shidx, in create_outsec() argument
296 if ((scn = elf_newscn(ofl->ofl_welf)) == NULL) { in create_outsec()
297 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_NEWSCN), in create_outsec()
298 ofl->ofl_name); in create_outsec()
308 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), in create_outsec()
309 ofl->ofl_name); in create_outsec()
331 if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) in create_outsec()
340 if ((ofl->ofl_flags & FLG_OF_TLSPHDR) && in create_outsec()
342 (aplist_append(&ofl->ofl_ostlsseg, osp, in create_outsec()
368 ld_create_outfile(Ofl_desc *ofl) in ld_create_outfile() argument
375 ofl_flag_t flags = ofl->ofl_flags; in ld_create_outfile()
376 ofl_flag_t flags1 = ofl->ofl_flags1; in ld_create_outfile()
382 DBG_CALL(Dbg_basic_create(ofl->ofl_lml)); in ld_create_outfile()
389 (ofl->ofl_dtflags_1 & DF_1_NOHDR)) { in ld_create_outfile()
397 fd = ofl->ofl_fd; in ld_create_outfile()
404 if ((ofl->ofl_ordered != NULL) && in ld_create_outfile()
405 (ld_sort_ordered(ofl) == S_ERROR)) in ld_create_outfile()
411 if ((ofl->ofl_welf = elf_begin(fd, cmd, 0)) == NULL) { in ld_create_outfile()
412 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), in ld_create_outfile()
413 ofl->ofl_name); in ld_create_outfile()
420 if ((ofl->ofl_nehdr = elf_newehdr(ofl->ofl_welf)) == NULL) { in ld_create_outfile()
421 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_NEWEHDR), in ld_create_outfile()
422 ofl->ofl_name); in ld_create_outfile()
425 ofl->ofl_nehdr->e_machine = ofl->ofl_dehdr->e_machine; in ld_create_outfile()
427 DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); in ld_create_outfile()
428 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in ld_create_outfile()
445 ofl->ofl_flags |= FLG_OF_OSABI; in ld_create_outfile()
461 if (ofl->ofl_osinterp) in ld_create_outfile()
464 if (ofl->ofl_osinterp) in ld_create_outfile()
473 if (ofl->ofl_unwindhdr) in ld_create_outfile()
476 if (ofl->ofl_dtracesym) in ld_create_outfile()
479 if (ofl->ofl_oscap) in ld_create_outfile()
512 if (ofl->ofl_dtflags_1 & DF_1_NOHDR) in ld_create_outfile()
548 Lm_list *lml = ofl->ofl_lml; in ld_create_outfile()
588 if (create_outsec(ofl, sgp, osp, ptype, in ld_create_outfile()
603 ld_eprintf(ofl, ERR_ELF, in ld_create_outfile()
605 ofl->ofl_name); in ld_create_outfile()
727 if (ofl->ofl_flags & FLG_OF_OSABI) { in ld_create_outfile()
728 ofl->ofl_nehdr->e_ident[EI_OSABI] = ELFOSABI_SOLARIS; in ld_create_outfile()
729 ofl->ofl_nehdr->e_ident[EI_ABIVERSION] = EAV_SUNW_CURRENT; in ld_create_outfile()
736 if ((ofl->ofl_phdr = elf_newphdr(ofl->ofl_welf, in ld_create_outfile()
738 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_NEWPHDR), in ld_create_outfile()
739 ofl->ofl_name); in ld_create_outfile()
748 if (pad_outfile(ofl) == S_ERROR) in ld_create_outfile()
772 if ((ofl->ofl_size = (size_t)elf_update(ofl->ofl_welf, in ld_create_outfile()
774 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), in ld_create_outfile()
775 ofl->ofl_name); in ld_create_outfile()
786 if ((ofl->ofl_elf = elf_begin(0, ELF_C_IMAGE, in ld_create_outfile()
787 ofl->ofl_welf)) == NULL) { in ld_create_outfile()
788 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), in ld_create_outfile()
789 ofl->ofl_name); in ld_create_outfile()
792 if ((ofl->ofl_nehdr = elf_getehdr(ofl->ofl_elf)) == NULL) { in ld_create_outfile()
793 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), in ld_create_outfile()
794 ofl->ofl_name); in ld_create_outfile()
798 if ((ofl->ofl_phdr = elf_getphdr(ofl->ofl_elf)) == NULL) { in ld_create_outfile()
799 ld_eprintf(ofl, ERR_ELF, MSG_INTL(MSG_ELF_GETPHDR), in ld_create_outfile()
800 ofl->ofl_name); in ld_create_outfile()
810 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in ld_create_outfile()
830 elf_getscn(ofl->ofl_elf, ++ndx)) == NULL) { in ld_create_outfile()
831 ld_eprintf(ofl, ERR_ELF, in ld_create_outfile()
832 MSG_INTL(MSG_ELF_GETSCN), ofl->ofl_name, in ld_create_outfile()
838 ld_eprintf(ofl, ERR_ELF, in ld_create_outfile()
839 MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name); in ld_create_outfile()
849 ld_eprintf(ofl, ERR_ELF, in ld_create_outfile()
851 ofl->ofl_name); in ld_create_outfile()
862 ld_eprintf(ofl, ERR_ELF, in ld_create_outfile()
863 MSG_INTL(MSG_ELF_GETDATA), ofl->ofl_name); in ld_create_outfile()