996
997 sdp = sav->sav_sdp;
998
999 /*
1000 * Ignore any symbols that have been marked as invalid during
1001 * input processing. Providing these aren't used for
1002 * relocation, they will be dropped from the output image.
1003 */
1004 if (sdp->sd_flags & FLG_SY_INVALID) {
1005 DBG_CALL(Dbg_syms_old(ofl, sdp));
1006 DBG_CALL(Dbg_syms_ignore(ofl, sdp));
1007 continue;
1008 }
1009
1010 /*
1011 * Only needed symbols are copied to the output symbol table.
1012 */
1013 if (sdp->sd_ref == REF_DYN_SEEN)
1014 continue;
1015
1016 if (SYM_IS_HIDDEN(sdp) && (flags & FLG_OF_PROCRED))
1017 local = 1;
1018 else
1019 local = 0;
1020
1021 if (local || (ofl->ofl_hashbkts == 0)) {
1022 sorted_syms[scndx++].sl_sdp = sdp;
1023 } else {
1024 sorted_syms[ssndx].sl_hval = sdp->sd_aux->sa_hash %
1025 ofl->ofl_hashbkts;
1026 sorted_syms[ssndx].sl_sdp = sdp;
1027 ssndx++;
1028 }
1029
1030 /*
1031 * Note - expand the COMMON symbols here because an address
1032 * must be assigned to them in the same order that space was
1033 * calculated in sym_validate(). If this ordering isn't
1034 * followed differing alignment requirements can throw us all
1035 * out of whack.
1036 *
1207 gottable->gt_sym = sdp;
1208 gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx;
1209 gottable->gt_gndx.gn_addend = gnp->gn_addend;
1210 gottable++;
1211 }
1212
1213 if (sdp->sd_aux && sdp->sd_aux->sa_PLTGOTndx) {
1214 gottable->gt_sym = sdp;
1215 gottable->gt_gndx.gn_gotndx =
1216 sdp->sd_aux->sa_PLTGOTndx;
1217 gottable++;
1218 }
1219 }
1220
1221 /*
1222 * If this symbol has been marked as being reduced to local
1223 * scope then it will have to be placed in the scoped portion
1224 * of the .symtab. Retain the appropriate index for use in
1225 * version symbol indexing and relocation.
1226 */
1227 if (SYM_IS_HIDDEN(sdp) && (flags & FLG_OF_PROCRED)) {
1228 local = 1;
1229 if (!(sdp->sd_flags & FLG_SY_ELIM) && !dynsym)
1230 sdp->sd_symndx = scopesym_ndx;
1231 else
1232 sdp->sd_symndx = 0;
1233
1234 if (sdp->sd_flags & FLG_SY_ELIM) {
1235 enter_in_symtab = 0;
1236 } else if (ldynsym && sdp->sd_sym->st_name &&
1237 ldynsym_symtype[
1238 ELF_ST_TYPE(sdp->sd_sym->st_info)]) {
1239 dynlocal = 1;
1240 }
1241 } else {
1242 sdp->sd_symndx = *symndx;
1243 }
1244
1245 /*
1246 * Copy basic symbol and string information.
1247 */
1872 * symbols will be represented in the output, return the weak symbol to
1873 * its correct type.
1874 */
1875 for (ALIST_TRAVERSE(weak, idx1, wkp)) {
1876 Sym_desc *sdp, *_sdp;
1877 Sym *sym, *_sym, *__sym;
1878 uchar_t bind;
1879
1880 sdp = wkp->wk_weak;
1881 _sdp = wkp->wk_alias;
1882 _sym = __sym = _sdp->sd_sym;
1883
1884 sdp->sd_flags |= FLG_SY_WEAKDEF;
1885
1886 /*
1887 * If the symbol definition has been scoped then assign it to
1888 * be local, otherwise if it's from a shared object then we need
1889 * to maintain the binding of the original reference.
1890 */
1891 if (SYM_IS_HIDDEN(sdp)) {
1892 if (flags & FLG_OF_PROCRED)
1893 bind = STB_LOCAL;
1894 else
1895 bind = STB_WEAK;
1896 } else if ((sdp->sd_ref == REF_DYN_NEED) &&
1897 (sdp->sd_flags & FLG_SY_GLOBREF))
1898 bind = STB_GLOBAL;
1899 else
1900 bind = STB_WEAK;
1901
1902 DBG_CALL(Dbg_syms_old(ofl, sdp));
1903 if ((sym = wkp->wk_symtab) != NULL) {
1904 sym->st_value = _sym->st_value;
1905 sym->st_size = _sym->st_size;
1906 sym->st_other = _sym->st_other;
1907 sym->st_shndx = _sym->st_shndx;
1908 sym->st_info = ELF_ST_INFO(bind,
1909 ELF_ST_TYPE(sym->st_info));
1910 __sym = sym;
1911 }
1912 if ((sym = wkp->wk_dynsym) != NULL) {
|
996
997 sdp = sav->sav_sdp;
998
999 /*
1000 * Ignore any symbols that have been marked as invalid during
1001 * input processing. Providing these aren't used for
1002 * relocation, they will be dropped from the output image.
1003 */
1004 if (sdp->sd_flags & FLG_SY_INVALID) {
1005 DBG_CALL(Dbg_syms_old(ofl, sdp));
1006 DBG_CALL(Dbg_syms_ignore(ofl, sdp));
1007 continue;
1008 }
1009
1010 /*
1011 * Only needed symbols are copied to the output symbol table.
1012 */
1013 if (sdp->sd_ref == REF_DYN_SEEN)
1014 continue;
1015
1016 if (ld_sym_reducable(ofl, sdp))
1017 local = 1;
1018 else
1019 local = 0;
1020
1021 if (local || (ofl->ofl_hashbkts == 0)) {
1022 sorted_syms[scndx++].sl_sdp = sdp;
1023 } else {
1024 sorted_syms[ssndx].sl_hval = sdp->sd_aux->sa_hash %
1025 ofl->ofl_hashbkts;
1026 sorted_syms[ssndx].sl_sdp = sdp;
1027 ssndx++;
1028 }
1029
1030 /*
1031 * Note - expand the COMMON symbols here because an address
1032 * must be assigned to them in the same order that space was
1033 * calculated in sym_validate(). If this ordering isn't
1034 * followed differing alignment requirements can throw us all
1035 * out of whack.
1036 *
1207 gottable->gt_sym = sdp;
1208 gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx;
1209 gottable->gt_gndx.gn_addend = gnp->gn_addend;
1210 gottable++;
1211 }
1212
1213 if (sdp->sd_aux && sdp->sd_aux->sa_PLTGOTndx) {
1214 gottable->gt_sym = sdp;
1215 gottable->gt_gndx.gn_gotndx =
1216 sdp->sd_aux->sa_PLTGOTndx;
1217 gottable++;
1218 }
1219 }
1220
1221 /*
1222 * If this symbol has been marked as being reduced to local
1223 * scope then it will have to be placed in the scoped portion
1224 * of the .symtab. Retain the appropriate index for use in
1225 * version symbol indexing and relocation.
1226 */
1227 if (ld_sym_reducable(ofl, sdp)) {
1228 local = 1;
1229 if (!(sdp->sd_flags & FLG_SY_ELIM) && !dynsym)
1230 sdp->sd_symndx = scopesym_ndx;
1231 else
1232 sdp->sd_symndx = 0;
1233
1234 if (sdp->sd_flags & FLG_SY_ELIM) {
1235 enter_in_symtab = 0;
1236 } else if (ldynsym && sdp->sd_sym->st_name &&
1237 ldynsym_symtype[
1238 ELF_ST_TYPE(sdp->sd_sym->st_info)]) {
1239 dynlocal = 1;
1240 }
1241 } else {
1242 sdp->sd_symndx = *symndx;
1243 }
1244
1245 /*
1246 * Copy basic symbol and string information.
1247 */
1872 * symbols will be represented in the output, return the weak symbol to
1873 * its correct type.
1874 */
1875 for (ALIST_TRAVERSE(weak, idx1, wkp)) {
1876 Sym_desc *sdp, *_sdp;
1877 Sym *sym, *_sym, *__sym;
1878 uchar_t bind;
1879
1880 sdp = wkp->wk_weak;
1881 _sdp = wkp->wk_alias;
1882 _sym = __sym = _sdp->sd_sym;
1883
1884 sdp->sd_flags |= FLG_SY_WEAKDEF;
1885
1886 /*
1887 * If the symbol definition has been scoped then assign it to
1888 * be local, otherwise if it's from a shared object then we need
1889 * to maintain the binding of the original reference.
1890 */
1891 if (SYM_IS_HIDDEN(sdp)) {
1892 if (ld_sym_reducable(ofl, sdp))
1893 bind = STB_LOCAL;
1894 else
1895 bind = STB_WEAK;
1896 } else if ((sdp->sd_ref == REF_DYN_NEED) &&
1897 (sdp->sd_flags & FLG_SY_GLOBREF))
1898 bind = STB_GLOBAL;
1899 else
1900 bind = STB_WEAK;
1901
1902 DBG_CALL(Dbg_syms_old(ofl, sdp));
1903 if ((sym = wkp->wk_symtab) != NULL) {
1904 sym->st_value = _sym->st_value;
1905 sym->st_size = _sym->st_size;
1906 sym->st_other = _sym->st_other;
1907 sym->st_shndx = _sym->st_shndx;
1908 sym->st_info = ELF_ST_INFO(bind,
1909 ELF_ST_TYPE(sym->st_info));
1910 __sym = sym;
1911 }
1912 if ((sym = wkp->wk_dynsym) != NULL) {
|