Lines Matching refs:ofl
44 remove_local(Ofl_desc *ofl, Sym_desc *sdp, int allow_ldynsym) in remove_local() argument
51 if ((ofl->ofl_flags & FLG_OF_REDLSYM) == 0) { in remove_local()
52 ofl->ofl_locscnt--; in remove_local()
54 err = st_delstring(ofl->ofl_strtab, sdp->sd_name); in remove_local()
58 ofl->ofl_dynlocscnt--; in remove_local()
60 err = st_delstring(ofl->ofl_dynstrtab, sdp->sd_name); in remove_local()
70 remove_scoped(Ofl_desc *ofl, Sym_desc *sdp, int allow_ldynsym) in remove_scoped() argument
77 ofl->ofl_scopecnt--; in remove_scoped()
78 ofl->ofl_elimcnt++; in remove_scoped()
80 err = st_delstring(ofl->ofl_strtab, sdp->sd_name); in remove_scoped()
84 ofl->ofl_dynscopecnt--; in remove_scoped()
86 err = st_delstring(ofl->ofl_dynstrtab, sdp->sd_name); in remove_scoped()
95 ignore_sym(Ofl_desc *ofl, Ifl_desc *ifl, Sym_desc *sdp, int allow_ldynsym) in ignore_sym() argument
120 DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, sdp)); in ignore_sym()
122 remove_local(ofl, sdp, allow_ldynsym); in ignore_sym()
139 DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, sdp)); in ignore_sym()
141 remove_scoped(ofl, sdp, allow_ldynsym); in ignore_sym()
153 DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, sdp)); in ignore_sym()
156 remove_local(ofl, sdp, allow_ldynsym); in ignore_sym()
158 remove_scoped(ofl, sdp, allow_ldynsym); in ignore_sym()
204 adjust_os_count(Ofl_desc *ofl) in adjust_os_count() argument
211 if ((ofl->ofl_flags & FLG_OF_ADJOSCNT) == 0) in adjust_os_count()
219 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in adjust_os_count()
244 ofl->ofl_shdrcnt--; in adjust_os_count()
245 err = st_delstring(ofl->ofl_shdrsttab, in adjust_os_count()
271 ignore_section_processing(Ofl_desc *ofl) in ignore_section_processing() argument
279 int allow_ldynsym = OFL_ALLOW_LDYNSYM(ofl); in ignore_section_processing()
282 for (APLIST_TRAVERSE(ofl->ofl_objs, idx1, ifl)) { in ignore_section_processing()
289 DBG_CALL(Dbg_unused_file(ofl->ofl_lml, in ignore_section_processing()
291 if (((ofl->ofl_flags1 & FLG_OF1_IGNPRC) == 0) || in ignore_section_processing()
342 ignore_sym(ofl, ifl, sdp, allow_ldynsym); in ignore_section_processing()
349 if ((ofl->ofl_flags1 & FLG_OF1_IGNPRC) == 0) in ignore_section_processing()
356 REL_CACHE_TRAVERSE(&ofl->ofl_outrels, idx1, rcbp, rsp) { in ignore_section_processing()
385 ofl->ofl_reloccntsub++; in ignore_section_processing()
388 ofl->ofl_relocrelcnt--; in ignore_section_processing()
395 ofl->ofl_flags |= FLG_OF_ADJOSCNT; in ignore_section_processing()
426 new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt, in new_section() argument
489 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
527 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
569 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
574 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
580 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
591 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
597 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
609 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
619 ofl->ofl_flags |= FLG_OF_OSABI; in new_section()
642 data->d_version = ofl->ofl_dehdr->e_version; in new_section()
691 new_section_from_template(Ofl_desc *ofl, Is_desc *tmpl_isp, size_t size, in new_section_from_template() argument
706 data->d_version = ofl->ofl_dehdr->e_version; in new_section_from_template()
743 ld_make_bss(Ofl_desc *ofl, Xword size, Xword align, uint_t ident) in ld_make_bss() argument
749 Xword rsize = (Xword)ofl->ofl_relocbsssz; in ld_make_bss()
756 if (new_section(ofl, SHT_NOBITS, NULL, 0, in ld_make_bss()
768 ofl->ofl_istlsbss = isec; in ld_make_bss()
773 ofl->ofl_isbss = isec; in ld_make_bss()
779 ofl->ofl_islbss = isec; in ld_make_bss()
788 if ((osp = ld_place_section(ofl, isec, NULL, ident, NULL)) == in ld_make_bss()
804 if (ofl->ofl_flags1 & flagtotest) { in ld_make_bss()
805 ofl->ofl_dynshdrcnt++; in ld_make_bss()
819 make_array(Ofl_desc *ofl, Word shtype, const char *sectname, APlist *alp) in make_array() argument
839 if (new_section(ofl, shtype, sectname, entcount, &isec, &shdr, &data) == in make_array()
846 if (ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_array, NULL) == in make_array()
852 if ((ofl->ofl_osinitarray == NULL) && (shtype == SHT_INIT_ARRAY)) in make_array()
853 ofl->ofl_osinitarray = osp; in make_array()
854 if ((ofl->ofl_ospreinitarray == NULL) && (shtype == SHT_PREINIT_ARRAY)) in make_array()
855 ofl->ofl_ospreinitarray = osp; in make_array()
856 else if ((ofl->ofl_osfiniarray == NULL) && (shtype == SHT_FINI_ARRAY)) in make_array()
857 ofl->ofl_osfiniarray = osp; in make_array()
883 DBG_CALL(Dbg_reloc_generate(ofl->ofl_lml, osp, in make_array()
888 if (ld_process_sym_reloc(ofl, &reld, (Rel *)&reloc, isec, in make_array()
905 make_comment(Ofl_desc *ofl) in make_comment() argument
911 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_COMMENT), 0, in make_comment()
915 data->d_buf = (void *)ofl->ofl_sgsid; in make_comment()
916 data->d_size = strlen(ofl->ofl_sgsid) + 1; in make_comment()
923 return ((uintptr_t)ld_place_section(ofl, isec, NULL, in make_comment()
936 make_dynamic(Ofl_desc *ofl) in make_dynamic() argument
948 ofl_flag_t flags = ofl->ofl_flags; in make_dynamic()
955 if (OFL_IS_STATIC_OBJ(ofl)) in make_dynamic()
956 strtbl = ofl->ofl_strtab; in make_dynamic()
958 strtbl = ofl->ofl_dynstrtab; in make_dynamic()
965 if (new_section(ofl, SHT_DYNAMIC, MSG_ORIG(MSG_SCN_DYNAMIC), 0, in make_dynamic()
982 if (ofl->ofl_osinterp) in make_dynamic()
985 osp = ofl->ofl_osdynamic = in make_dynamic()
986 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_dynamic, NULL); in make_dynamic()
991 for (APLIST_TRAVERSE(ofl->ofl_sos, idx, ifl)) { in make_dynamic()
1007 DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); in make_dynamic()
1008 DBG_CALL(Dbg_unused_file(ofl->ofl_lml, ifl->ifl_soname, in make_dynamic()
1018 if (OFL_GUIDANCE(ofl, FLG_OFG_NO_UNUSED) && in make_dynamic()
1020 ld_eprintf(ofl, ERR_GUIDANCE, in make_dynamic()
1045 ofl->ofl_dtflags_1 |= DF_1_ORIGIN; in make_dynamic()
1046 ofl->ofl_dtflags |= DF_ORIGIN; in make_dynamic()
1051 DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); in make_dynamic()
1057 cnt += alist_nitems(ofl->ofl_dtsfltrs); in make_dynamic()
1063 SYM_NOHASH, NULL, ofl)) != NULL) && in make_dynamic()
1070 SYM_NOHASH, NULL, ofl)) != NULL) && in make_dynamic()
1081 if (ofl->ofl_soname) { in make_dynamic()
1083 if (st_insert(strtbl, ofl->ofl_soname) == -1) in make_dynamic()
1086 if (ofl->ofl_filtees) { in make_dynamic()
1088 if (st_insert(strtbl, ofl->ofl_filtees) == -1) in make_dynamic()
1095 if (strstr(ofl->ofl_filtees, in make_dynamic()
1097 ofl->ofl_dtflags_1 |= DF_1_ORIGIN; in make_dynamic()
1098 ofl->ofl_dtflags |= DF_ORIGIN; in make_dynamic()
1103 if (ofl->ofl_rpath) { in make_dynamic()
1105 if (st_insert(strtbl, ofl->ofl_rpath) == -1) in make_dynamic()
1112 if (strstr(ofl->ofl_rpath, MSG_ORIG(MSG_STR_ORIGIN))) { in make_dynamic()
1113 ofl->ofl_dtflags_1 |= DF_1_ORIGIN; in make_dynamic()
1114 ofl->ofl_dtflags |= DF_ORIGIN; in make_dynamic()
1122 if (ofl->ofl_config) { in make_dynamic()
1124 if (st_insert(strtbl, ofl->ofl_config) == -1) in make_dynamic()
1131 if (strstr(ofl->ofl_config, MSG_ORIG(MSG_STR_ORIGIN))) { in make_dynamic()
1132 ofl->ofl_dtflags_1 |= DF_1_ORIGIN; in make_dynamic()
1133 ofl->ofl_dtflags |= DF_ORIGIN; in make_dynamic()
1136 if (ofl->ofl_depaudit) { in make_dynamic()
1138 if (st_insert(strtbl, ofl->ofl_depaudit) == -1) in make_dynamic()
1141 if (ofl->ofl_audit) { in make_dynamic()
1143 if (st_insert(strtbl, ofl->ofl_audit) == -1) in make_dynamic()
1158 if (OFL_ALLOW_LDYNSYM(ofl)) in make_dynamic()
1161 if ((ofl->ofl_dynsymsortcnt > 0) || in make_dynamic()
1162 (ofl->ofl_dyntlssortcnt > 0)) in make_dynamic()
1165 if (ofl->ofl_dynsymsortcnt > 0) in make_dynamic()
1168 if (ofl->ofl_dyntlssortcnt > 0) in make_dynamic()
1179 if ((flags & FLG_OF_COMREL) && ofl->ofl_relocrelcnt) in make_dynamic()
1185 if (ofl->ofl_osfiniarray) /* DT_FINI_ARRAY */ in make_dynamic()
1188 if (ofl->ofl_osinitarray) /* DT_INIT_ARRAY */ in make_dynamic()
1191 if (ofl->ofl_ospreinitarray) /* DT_PREINIT_ARRAY & */ in make_dynamic()
1198 if (ofl->ofl_pltcnt) in make_dynamic()
1204 if (ofl->ofl_pltpad) in make_dynamic()
1211 if (ofl->ofl_relocsz) in make_dynamic()
1225 if (ofl->ofl_osmove) in make_dynamic()
1231 cnt += ofl->ofl_regsymcnt; in make_dynamic()
1237 for (APLIST_TRAVERSE(ofl->ofl_rtldinfo, idx, sdp)) in make_dynamic()
1245 (sgp->sg_phdr.p_flags & PF_W) && ofl->ofl_osinterp) in make_dynamic()
1252 if (ofl->ofl_oscap) in make_dynamic()
1259 if (ofl->ofl_oscapinfo) in make_dynamic()
1267 if (ofl->ofl_oscapchain) in make_dynamic()
1277 (*ld_targ.t_mr.mr_mach_make_dynamic)(ofl, &cnt); in make_dynamic()
1311 ofl->ofl_flags |= FLG_OF_OSABI; in make_dynamic()
1313 return ((uintptr_t)ofl->ofl_osdynamic); in make_dynamic()
1320 ld_make_got(Ofl_desc *ofl) in ld_make_got() argument
1325 size_t size = (size_t)ofl->ofl_gotcnt * ld_targ.t_m.m_got_entsize; in ld_make_got()
1326 size_t rsize = (size_t)ofl->ofl_relocgotsz; in ld_make_got()
1328 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_GOT), 0, in ld_make_got()
1338 ofl->ofl_osgot = ld_place_section(ofl, isec, NULL, in ld_make_got()
1340 if (ofl->ofl_osgot == (Os_desc *)S_ERROR) in ld_make_got()
1343 ofl->ofl_osgot->os_szoutrels = (Xword)rsize; in ld_make_got()
1352 make_interp(Ofl_desc *ofl) in make_interp() argument
1357 const char *iname = ofl->ofl_interp; in make_interp()
1363 if (ofl->ofl_flags1 & FLG_OF1_NOINTRP) in make_interp()
1374 if (((ofl->ofl_flags & (FLG_OF_DYNAMIC | FLG_OF_EXEC | in make_interp()
1383 iname = ofl->ofl_interp = ld_targ.t_m.m_def_interp; in make_interp()
1387 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_INTERP), 0, in make_interp()
1395 ofl->ofl_osinterp = in make_interp()
1396 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_interp, NULL); in make_interp()
1397 return ((uintptr_t)ofl->ofl_osinterp); in make_interp()
1407 make_sym_sec(Ofl_desc *ofl, const char *sectname, Word stype, int ident) in make_sym_sec() argument
1417 if (new_section(ofl, stype, sectname, 0, &isec, &shdr, &data) == in make_sym_sec()
1421 return (ld_place_section(ofl, isec, NULL, ident, NULL)); in make_sym_sec()
1594 make_cap(Ofl_desc *ofl, Word shtype, const char *shname, int ident) in make_cap() argument
1603 Objcapset *ocapset = &ofl->ofl_ocapset; in make_cap()
1612 if (OFL_IS_STATIC_OBJ(ofl)) in make_cap()
1613 strtbl = ofl->ofl_strtab; in make_cap()
1615 strtbl = ofl->ofl_dynstrtab; in make_cap()
1622 if ((ofl->ofl_flags & FLG_OF_OTOSCAP) && (ofl->ofl_capsymcnt == 0)) in make_cap()
1623 ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_CAP_NOSYMSFOUND)); in make_cap()
1630 if ((ofl->ofl_flags & FLG_OF_OTOSCAP) && ofl->ofl_capsymcnt && in make_cap()
1631 (ofl->ofl_capfamilies == NULL)) { in make_cap()
1632 ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_CAP_NOSYMSFOUND)); in make_cap()
1633 ld_cap_move_symtoobj(ofl); in make_cap()
1634 ofl->ofl_capsymcnt = 0; in make_cap()
1635 ofl->ofl_capgroups = NULL; in make_cap()
1636 ofl->ofl_flags &= ~FLG_OF_OTOSCAP; in make_cap()
1642 capstr_value(ofl->ofl_lml, CA_SUNW_PLAT, &ocapset->oc_plat, &title); in make_cap()
1643 capstr_value(ofl->ofl_lml, CA_SUNW_MACH, &ocapset->oc_mach, &title); in make_cap()
1644 capmask_value(ofl->ofl_lml, CA_SUNW_HW_2, &ocapset->oc_hw_2, &title); in make_cap()
1645 capmask_value(ofl->ofl_lml, CA_SUNW_HW_1, &ocapset->oc_hw_1, &title); in make_cap()
1646 capmask_value(ofl->ofl_lml, CA_SUNW_SF_1, &ocapset->oc_sf_1, &title); in make_cap()
1680 if (ofl->ofl_capsymcnt) { in make_cap()
1687 size += ofl->ofl_capsymcnt; in make_cap()
1693 if (new_section(ofl, shtype, shname, size, &isec, in make_cap()
1708 ofl->ofl_flags |= FLG_OF_CAPSTRS; in make_cap()
1715 ofl->ofl_flags |= (FLG_OF_PTCAP | FLG_OF_CAPSTRS); in make_cap()
1730 ofl->ofl_flags |= (FLG_OF_PTCAP | FLG_OF_CAPSTRS); in make_cap()
1745 ofl->ofl_flags |= FLG_OF_PTCAP; in make_cap()
1749 ofl->ofl_flags |= FLG_OF_PTCAP; in make_cap()
1753 ofl->ofl_flags |= FLG_OF_PTCAP; in make_cap()
1761 if (ofl->ofl_capgroups) { in make_cap()
1764 for (APLIST_TRAVERSE(ofl->ofl_capgroups, idx1, cgp)) { in make_cap()
1772 ofl->ofl_flags |= FLG_OF_CAPSTRS; in make_cap()
1787 ofl->ofl_flags |= FLG_OF_CAPSTRS; in make_cap()
1806 ofl->ofl_flags |= FLG_OF_CAPSTRS; in make_cap()
1843 if (((ofl->ofl_flags & FLG_OF_PTCAP) == 0) || in make_cap()
1852 ld_eprintf(ofl, ERR_WARNING, in make_cap()
1864 if (ofl->ofl_flags & FLG_OF_CAPSTRS) in make_cap()
1870 if ((ofl->ofl_oscap = ld_place_section(ofl, isec, in make_cap()
1879 if (ofl->ofl_capfamilies) { in make_cap()
1880 if ((ofl->ofl_oscapinfo = make_sym_sec(ofl, in make_cap()
1889 if (ofl->ofl_capchaincnt && in make_cap()
1890 ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0)) { in make_cap()
1891 if (new_section(ofl, SHT_SUNW_capchain, in make_cap()
1893 ofl->ofl_capchaincnt, &isec, &shdr, in make_cap()
1897 ofl->ofl_oscapchain = ld_place_section(ofl, isec, in make_cap()
1899 if (ofl->ofl_oscapchain == (Os_desc *)S_ERROR) in make_cap()
1912 make_plt(Ofl_desc *ofl) in make_plt() argument
1918 (((size_t)ofl->ofl_pltcnt + (size_t)ofl->ofl_pltpad) * in make_plt()
1920 size_t rsize = (size_t)ofl->ofl_relocpltsz; in make_plt()
1928 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_PLT), 0, in make_plt()
1940 ofl->ofl_osplt = ld_place_section(ofl, isec, NULL, in make_plt()
1942 if (ofl->ofl_osplt == (Os_desc *)S_ERROR) in make_plt()
1945 ofl->ofl_osplt->os_szoutrels = (Xword)rsize; in make_plt()
1956 make_hash(Ofl_desc *ofl) in make_hash() argument
1962 Word nsyms = ofl->ofl_globcnt; in make_hash()
1969 if (new_section(ofl, SHT_HASH, MSG_ORIG(MSG_SCN_HASH), 0, in make_hash()
1977 ofl->ofl_oshash = in make_hash()
1978 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_hash, NULL); in make_hash()
1979 if (ofl->ofl_oshash == (Os_desc *)S_ERROR) in make_hash()
1985 ofl->ofl_hashbkts = findprime(nsyms); in make_hash()
1995 cnt = 2 + ofl->ofl_hashbkts + DYNSYM_ALL_CNT(ofl); in make_hash()
2014 make_symtab(Ofl_desc *ofl) in make_symtab() argument
2027 if (new_section(ofl, SHT_SYMTAB, MSG_ORIG(MSG_SCN_SYMTAB), 0, in make_symtab()
2035 if ((ofl->ofl_ossymtab = ld_place_section(ofl, isec, NULL, in make_symtab()
2044 if ((ofl->ofl_shdrcnt + 1) >= SHN_LORESERVE) { in make_symtab()
2048 if (new_section(ofl, SHT_SYMTAB_SHNDX, in make_symtab()
2053 if ((ofl->ofl_ossymshndx = ld_place_section(ofl, xisec, NULL, in make_symtab()
2062 symcnt = (size_t)(1 + SYMTAB_ALL_CNT(ofl)); in make_symtab()
2095 make_dynsym(Ofl_desc *ofl) in make_dynsym() argument
2118 allow_ldynsym = OFL_ALLOW_LDYNSYM(ofl); in make_dynsym()
2124 if (allow_ldynsym && new_section(ofl, SHT_SUNW_LDYNSYM, in make_dynsym()
2128 if (new_section(ofl, SHT_DYNSYM, MSG_ORIG(MSG_SCN_DYNSYM), 0, in make_dynsym()
2137 ((ofl->ofl_osldynsym = ld_place_section(ofl, lisec, NULL, in make_dynsym()
2140 ofl->ofl_osdynsym = in make_dynsym()
2141 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_dynsym, NULL); in make_dynsym()
2142 if (ofl->ofl_osdynsym == (Os_desc *)S_ERROR) in make_dynsym()
2145 cnt = DYNSYM_ALL_CNT(ofl); in make_dynsym()
2161 cnt = 1 + ofl->ofl_dynlocscnt + ofl->ofl_dynscopecnt; in make_dynsym()
2177 make_dynsort(Ofl_desc *ofl) in make_dynsort() argument
2184 if (!OFL_ALLOW_LDYNSYM(ofl)) in make_dynsort()
2188 if (ofl->ofl_dynsymsortcnt > 0) { in make_dynsort()
2189 if (new_section(ofl, SHT_SUNW_symsort, in make_dynsort()
2190 MSG_ORIG(MSG_SCN_DYNSYMSORT), ofl->ofl_dynsymsortcnt, in make_dynsort()
2194 if ((ofl->ofl_osdynsymsort = ld_place_section(ofl, isec, NULL, in make_dynsort()
2200 if (ofl->ofl_dyntlssortcnt > 0) { in make_dynsort()
2201 if (new_section(ofl, SHT_SUNW_tlssort, in make_dynsort()
2203 ofl->ofl_dyntlssortcnt, &isec, &shdr, &data) == S_ERROR) in make_dynsort()
2206 if ((ofl->ofl_osdyntlssort = ld_place_section(ofl, isec, NULL, in make_dynsort()
2220 make_dyn_shndx(Ofl_desc *ofl, const char *shname, Os_desc *symtab, in make_dyn_shndx() argument
2231 if (new_section(ofl, SHT_SYMTAB_SHNDX, shname, in make_dyn_shndx()
2236 if ((*ret_os = ld_place_section(ofl, isec, NULL, in make_dyn_shndx()
2249 make_dynsym_shndx(Ofl_desc *ofl) in make_dynsym_shndx() argument
2255 if (OFL_ALLOW_LDYNSYM(ofl)) { in make_dynsym_shndx()
2256 if (make_dyn_shndx(ofl, MSG_ORIG(MSG_SCN_LDYNSYM_SHNDX), in make_dynsym_shndx()
2257 ofl->ofl_osldynsym, &ofl->ofl_osldynshndx) == S_ERROR) in make_dynsym_shndx()
2262 if (make_dyn_shndx(ofl, MSG_ORIG(MSG_SCN_DYNSYM_SHNDX), in make_dynsym_shndx()
2263 ofl->ofl_osdynsym, &ofl->ofl_osdynshndx) == S_ERROR) in make_dynsym_shndx()
2274 make_shstrtab(Ofl_desc *ofl) in make_shstrtab() argument
2281 if (new_section(ofl, SHT_STRTAB, MSG_ORIG(MSG_SCN_SHSTRTAB), in make_shstrtab()
2289 ofl->ofl_osshstrtab = in make_shstrtab()
2290 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_note, NULL); in make_shstrtab()
2291 if (ofl->ofl_osshstrtab == (Os_desc *)S_ERROR) in make_shstrtab()
2294 size = st_getstrtab_sz(ofl->ofl_shdrsttab); in make_shstrtab()
2307 make_strtab(Ofl_desc *ofl) in make_strtab() argument
2319 if (st_insert(ofl->ofl_strtab, ofl->ofl_name) == -1) in make_strtab()
2322 size = st_getstrtab_sz(ofl->ofl_strtab); in make_strtab()
2325 if (new_section(ofl, SHT_STRTAB, MSG_ORIG(MSG_SCN_STRTAB), in make_strtab()
2333 ofl->ofl_osstrtab = in make_strtab()
2334 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_strtab, NULL); in make_strtab()
2335 return ((uintptr_t)ofl->ofl_osstrtab); in make_strtab()
2342 make_dynstr(Ofl_desc *ofl) in make_dynstr() argument
2353 if (OFL_ALLOW_LDYNSYM(ofl)) { in make_dynstr()
2354 if (st_insert(ofl->ofl_dynstrtab, ofl->ofl_name) == -1) in make_dynstr()
2356 ofl->ofl_dynscopecnt++; in make_dynstr()
2363 if (ofl->ofl_regsyms) { in make_dynstr()
2366 for (ndx = 0; ndx < ofl->ofl_regsymsno; ndx++) { in make_dynstr()
2369 if ((sdp = ofl->ofl_regsyms[ndx]) == NULL) in make_dynstr()
2379 if (st_insert(ofl->ofl_dynstrtab, sdp->sd_name) == -1) in make_dynstr()
2387 if (ofl->ofl_dtsfltrs != NULL) { in make_dynstr()
2391 for (ALIST_TRAVERSE(ofl->ofl_dtsfltrs, idx, dftp)) in make_dynstr()
2392 if (st_insert(ofl->ofl_dynstrtab, dftp->dft_str) == -1) in make_dynstr()
2396 size = st_getstrtab_sz(ofl->ofl_dynstrtab); in make_dynstr()
2399 if (new_section(ofl, SHT_STRTAB, MSG_ORIG(MSG_SCN_DYNSTR), in make_dynstr()
2404 if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) in make_dynstr()
2412 ofl->ofl_osdynstr = in make_dynstr()
2413 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_dynstr, NULL); in make_dynstr()
2414 return ((uintptr_t)ofl->ofl_osdynstr); in make_dynstr()
2425 make_reloc(Ofl_desc *ofl, Os_desc *osp) in make_reloc() argument
2456 } else if (ofl->ofl_flags & FLG_OF_COMREL) { in make_reloc()
2457 size = (ofl->ofl_reloccnt - ofl->ofl_reloccntsub) * relsize; in make_reloc()
2461 size = ofl->ofl_relocrelsz; in make_reloc()
2471 ofl->ofl_relocsz += (Xword)size; in make_reloc()
2473 if (new_section(ofl, ld_targ.t_m.m_rel_sht_type, sectname, 0, &isec, in make_reloc()
2480 if (OFL_ALLOW_DYNSYM(ofl) && (sh_flags & SHF_ALLOC)) in make_reloc()
2491 rosp = ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_rel, NULL); in make_reloc()
2523 ofl->ofl_osrel = rosp; in make_reloc()
2529 if (ofl->ofl_osrelhead == (Os_desc *)0) in make_reloc()
2530 ofl->ofl_osrelhead = rosp; in make_reloc()
2539 make_verneed(Ofl_desc *ofl) in make_verneed() argument
2549 if (new_section(ofl, SHT_SUNW_verneed, MSG_ORIG(MSG_SCN_SUNWVERSION), in make_verneed()
2554 data->d_size = ofl->ofl_verneedsz; in make_verneed()
2555 shdr->sh_size = (Xword)ofl->ofl_verneedsz; in make_verneed()
2557 ofl->ofl_osverneed = in make_verneed()
2558 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_version, NULL); in make_verneed()
2559 return ((uintptr_t)ofl->ofl_osverneed); in make_verneed()
2569 make_verdef(Ofl_desc *ofl) in make_verdef() argument
2582 vdp = (Ver_desc *)ofl->ofl_verdesc->apl_data[0]; in make_verdef()
2584 if (OFL_IS_STATIC_OBJ(ofl)) in make_verdef()
2585 strtab = ofl->ofl_strtab; in make_verdef()
2587 strtab = ofl->ofl_dynstrtab; in make_verdef()
2596 if (new_section(ofl, SHT_SUNW_verdef, MSG_ORIG(MSG_SCN_SUNWVERSION), in make_verdef()
2601 data->d_size = ofl->ofl_verdefsz; in make_verdef()
2602 shdr->sh_size = (Xword)ofl->ofl_verdefsz; in make_verdef()
2604 ofl->ofl_osverdef = in make_verdef()
2605 ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_version, NULL); in make_verdef()
2606 return ((uintptr_t)ofl->ofl_osverdef); in make_verdef()
2613 ld_make_parexpn_data(Ofl_desc *ofl, size_t size, Xword align) in ld_make_parexpn_data() argument
2620 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_DATA), 0, in ld_make_parexpn_data()
2640 ofl->ofl_isparexpn = isec; in ld_make_parexpn_data()
2641 osp = ld_place_section(ofl, isec, NULL, ld_targ.t_id.id_data, NULL); in ld_make_parexpn_data()
2646 ofl->ofl_dynshdrcnt++; in ld_make_parexpn_data()
2656 ld_make_sunwmove(Ofl_desc *ofl, int mv_nums) in ld_make_sunwmove() argument
2666 if (new_section(ofl, SHT_SUNW_move, MSG_ORIG(MSG_SCN_SUNWMOVE), in ld_make_sunwmove()
2676 for (APLIST_TRAVERSE(ofl->ofl_parsyms, idx, sdp)) { in ld_make_sunwmove()
2687 if ((ofl->ofl_osmove = ld_place_section(ofl, isec, NULL, 0, NULL)) == in ld_make_sunwmove()
2700 strmerge_get_reloc_str(Ofl_desc *ofl, Rel_desc *rsp) in strmerge_get_reloc_str() argument
2728 if (ld_reloc_targval_get(ofl, rsp, addr, &str_off) == 0) in strmerge_get_reloc_str()
2762 strmerge_pass1(Ofl_desc *ofl, Os_desc *osp, Str_tbl *mstrtab, in strmerge_pass1() argument
2794 name = strmerge_get_reloc_str(ofl, rsp); in strmerge_pass1()
2834 ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp, in ld_make_strmerge() argument
2850 if ((ofl->ofl_flags1 & FLG_OF1_NCSTTAB) != 0) in ld_make_strmerge()
2924 if (strmerge_pass1(ofl, osp, mstrtab, rel_alpp, sym_alpp, in ld_make_strmerge()
2925 &ofl->ofl_actrels) == 0) in ld_make_strmerge()
2927 if (strmerge_pass1(ofl, osp, mstrtab, rel_alpp, sym_alpp, in ld_make_strmerge()
2928 &ofl->ofl_outrels) == 0) in ld_make_strmerge()
2938 if (new_section_from_template(ofl, isp, data_size, in ld_make_strmerge()
2953 if (ld_place_section(ofl, mstrsec, NULL, osp->os_identndx, NULL) == in ld_make_strmerge()
2969 name = strmerge_get_reloc_str(ofl, rsp); in ld_make_strmerge()
3074 DBG_CALL(Dbg_sec_discarded(ofl->ofl_lml, isp, mstrsec)); in ld_make_strmerge()
3078 DBG_CALL(Dbg_sec_genstr_compress(ofl->ofl_lml, osp->os_name, data_size, in ld_make_strmerge()
3115 ld_make_sections(Ofl_desc *ofl) in ld_make_sections() argument
3117 ofl_flag_t flags = ofl->ofl_flags; in ld_make_sections()
3124 if (make_comment(ofl) == S_ERROR) in ld_make_sections()
3127 if (make_interp(ofl) == S_ERROR) in ld_make_sections()
3133 if (make_cap(ofl, SHT_SUNW_cap, MSG_ORIG(MSG_SCN_SUNWCAP), in ld_make_sections()
3140 if (make_array(ofl, SHT_INIT_ARRAY, MSG_ORIG(MSG_SCN_INITARRAY), in ld_make_sections()
3141 ofl->ofl_initarray) == S_ERROR) in ld_make_sections()
3144 if (make_array(ofl, SHT_FINI_ARRAY, MSG_ORIG(MSG_SCN_FINIARRAY), in ld_make_sections()
3145 ofl->ofl_finiarray) == S_ERROR) in ld_make_sections()
3148 if (make_array(ofl, SHT_PREINIT_ARRAY, MSG_ORIG(MSG_SCN_PREINITARRAY), in ld_make_sections()
3149 ofl->ofl_preiarray) == S_ERROR) in ld_make_sections()
3158 if ((ofl->ofl_pltcnt) || (ofl->ofl_pltpad)) in ld_make_sections()
3159 if (make_plt(ofl) == S_ERROR) in ld_make_sections()
3167 if (DBG_ENABLED || (ofl->ofl_flags1 & FLG_OF1_IGNPRC)) { in ld_make_sections()
3168 if (ignore_section_processing(ofl) == S_ERROR) in ld_make_sections()
3177 if (ofl->ofl_flags & FLG_OF_ADJOSCNT) in ld_make_sections()
3178 adjust_os_count(ofl); in ld_make_sections()
3192 if ((ofl->ofl_flags1 & FLG_OF1_NCSTTAB) == 0) { in ld_make_sections()
3198 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in ld_make_sections()
3204 (ld_make_strmerge(ofl, osp, in ld_make_sections()
3224 (make_verneed(ofl) == S_ERROR)) in ld_make_sections()
3227 (make_verdef(ofl) == S_ERROR)) in ld_make_sections()
3230 ((ofl->ofl_osversym = make_sym_sec(ofl, in ld_make_sections()
3240 if ((ofl->ofl_ossyminfo = make_sym_sec(ofl, in ld_make_sections()
3251 if (ofl->ofl_reloccnt) { in ld_make_sections()
3252 if (make_reloc(ofl, NULL) == S_ERROR) in ld_make_sections()
3266 for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) { in ld_make_sections()
3272 (osp != ofl->ofl_osplt)) { in ld_make_sections()
3273 if (make_reloc(ofl, osp) == S_ERROR) in ld_make_sections()
3284 if (ofl->ofl_relocrelsz) { in ld_make_sections()
3285 if (make_reloc(ofl, NULL) == S_ERROR) in ld_make_sections()
3295 if (ofl->ofl_osplt && ofl->ofl_relocpltsz) { in ld_make_sections()
3296 if (make_reloc(ofl, ofl->ofl_osplt) == S_ERROR) in ld_make_sections()
3304 if (make_dynamic(ofl) == S_ERROR) in ld_make_sections()
3312 if (make_hash(ofl) == S_ERROR) in ld_make_sections()
3314 if (make_dynstr(ofl) == S_ERROR) in ld_make_sections()
3316 if (make_dynsym(ofl) == S_ERROR) in ld_make_sections()
3318 if (ld_unwind_make_hdr(ofl) == S_ERROR) in ld_make_sections()
3320 if (make_dynsort(ofl) == S_ERROR) in ld_make_sections()
3326 ((flags & FLG_OF_STATIC) && ofl->ofl_osversym)) { in ld_make_sections()
3331 if (ofl->ofl_osdynsym && in ld_make_sections()
3332 ((ofl->ofl_shdrcnt + 3) >= SHN_LORESERVE)) { in ld_make_sections()
3333 if (make_dynsym_shndx(ofl) == S_ERROR) in ld_make_sections()
3337 if (make_strtab(ofl) == S_ERROR) in ld_make_sections()
3339 if (make_symtab(ofl) == S_ERROR) in ld_make_sections()
3346 if (ofl->ofl_osdynsym && in ld_make_sections()
3347 ((ofl->ofl_shdrcnt + 1) >= SHN_LORESERVE)) { in ld_make_sections()
3348 if (make_dynsym_shndx(ofl) == S_ERROR) in ld_make_sections()
3353 if (make_shstrtab(ofl) == S_ERROR) in ld_make_sections()
3361 if (ofl->ofl_osversym || ofl->ofl_ossyminfo) { in ld_make_sections()
3366 if (OFL_IS_STATIC_OBJ(ofl)) in ld_make_sections()
3367 osp = ofl->ofl_ossymtab; in ld_make_sections()
3369 osp = ofl->ofl_osdynsym; in ld_make_sections()
3374 if (ofl->ofl_osversym) in ld_make_sections()
3375 update_data_size(ofl->ofl_osversym, cnt); in ld_make_sections()
3377 if (ofl->ofl_ossyminfo) in ld_make_sections()
3378 update_data_size(ofl->ofl_ossyminfo, cnt); in ld_make_sections()
3386 if (ofl->ofl_oscapinfo) { in ld_make_sections()
3395 if (OFL_IS_STATIC_OBJ(ofl)) in ld_make_sections()
3396 cnt = SYMTAB_ALL_CNT(ofl); in ld_make_sections()
3398 cnt = DYNSYM_ALL_CNT(ofl); in ld_make_sections()
3400 update_data_size(ofl->ofl_oscapinfo, cnt); in ld_make_sections()
3410 ld_make_data(Ofl_desc *ofl, size_t size) in ld_make_data() argument
3416 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_DATA), 0, in ld_make_data()
3424 if (aplist_append(&ofl->ofl_mapdata, isec, AL_CNT_OFL_MAPSECS) == NULL) in ld_make_data()
3435 ld_make_text(Ofl_desc *ofl, size_t size) in ld_make_text() argument
3448 if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_TEXT), 0, in ld_make_text()
3475 if (aplist_append(&ofl->ofl_maptext, isec, AL_CNT_OFL_MAPSECS) == NULL) in ld_make_text()
3482 ld_comdat_validate(Ofl_desc *ofl, Ifl_desc *ifl) in ld_comdat_validate() argument
3511 ((gr = ld_get_group(ofl, isp)) != NULL) && in ld_comdat_validate()
3521 ld_eprintf(ofl, ERR_FATAL, in ld_comdat_validate()