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