Lines Matching defs:symstate

145  * note: The symstate array in ARGSTATE is defined as having one
177 int numsymstate; /* # of items in symstate[] */
178 SYMSTATE symstate[1]; /* Symbol tables to process */
194 * symstate - State block for current symbol table.
204 symstate_add_str(ARGSTATE *argstate, SYMSTATE *symstate)
206 if (symstate->str.sec != NULL)
209 symstate->str.sec = elfedit_sec_getstr(argstate->obj_state,
210 symstate->sym.sec->sec_shdr->sh_link, 0);
213 symstate_add_versym(ARGSTATE *argstate, SYMSTATE *symstate)
215 if (symstate->versym.sec != NULL)
218 symstate->versym.sec = elfedit_sec_getversym(argstate->obj_state,
219 symstate->sym.sec, &symstate->versym.data, &symstate->versym.n);
222 symstate_add_xshndx(ARGSTATE *argstate, SYMSTATE *symstate)
224 if (symstate->xshndx.sec != NULL)
227 symstate->xshndx.sec = elfedit_sec_getxshndx(argstate->obj_state,
228 symstate->sym.sec, &symstate->xshndx.data, &symstate->xshndx.n);
238 * symstate - State block for current symbol table.
243 dump_symtab(ARGSTATE *argstate, SYMSTATE *symstate, Word ndx, Word cnt)
257 symsec = symstate->sym.sec;
258 sym = symstate->sym.data + ndx;
260 symstate_add_str(argstate, symstate);
261 strsec = symstate->str.sec;
264 if (symstate->versym.shndx != SHN_UNDEF)
265 symstate_add_versym(argstate, symstate);
268 if (symstate->xshndx.shndx != SHN_UNDEF)
269 symstate_add_xshndx(argstate, symstate);
276 versym = (symstate->versym.sec == NULL) ? 0 :
277 symstate->versym.data[ndx];
281 if ((shndx == SHN_XINDEX) && (symstate->xshndx.sec != NULL))
282 shndx = symstate->xshndx.data[ndx];
307 symstate1 = argstate->symstate;
419 * symstate - State block for current symbol table.
424 print_symstate(SYM_CMD_T cmd, ARGSTATE *argstate, SYMSTATE *symstate,
436 dump_symtab(argstate, symstate, ndx, cnt);
440 sym = symstate->sym.data;
474 symstate_add_str(argstate, symstate);
477 elfedit_offset_to_str(symstate->str.sec,
495 if (symstate->xshndx.shndx != SHN_UNDEF)
496 symstate_add_xshndx(argstate, symstate);
501 (symstate->xshndx.sec != NULL))
502 value = symstate->xshndx.data[ndx];
587 * symstate - State block for current symbol table.
597 SYMSTATE *symstate;
615 symstate = argstate->symstate;
616 for (tblndx = 0; tblndx < argstate->numsymstate; tblndx++, symstate++) {
618 symstate_add_str(argstate, symstate);
619 if (symstate->versym.shndx != SHN_UNDEF)
620 symstate_add_versym(argstate, symstate);
621 if (symstate->xshndx.shndx != SHN_UNDEF)
622 symstate_add_xshndx(argstate, symstate);
629 symstate_add_str(argstate, symstate);
633 if (symstate->xshndx.shndx != SHN_UNDEF)
634 symstate_add_xshndx(argstate, symstate);
651 symstate = argstate->symstate;
652 for (tblndx = 0; tblndx < argstate->numsymstate; tblndx++, symstate++) {
655 cnt = symstate->sym.n;
657 ndx = symstate->ndx;
665 print_symstate(cmd, argstate, symstate, outstyle, ndx, cnt);
679 * symstate - State block for current symbol table.
682 cmd_body_set_st_bind(ARGSTATE *argstate, SYMSTATE *symstate)
685 Sym *sym = &symstate->sym.data[symstate->ndx];
703 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
704 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_BIND),
713 gbl_ndx = symstate->sym.sec->sec_shdr->sh_info;
714 symndx = symstate->sym.sec->sec_shndx;
715 if ((bind == STB_LOCAL) && (symstate->ndx >= gbl_ndx))
718 EC_WORD(symndx), symstate->sym.sec->sec_name,
719 symstate->ndx, EC_WORD(symndx), gbl_ndx);
720 if ((bind != STB_LOCAL) && (symstate->ndx < gbl_ndx))
723 EC_WORD(symndx), symstate->sym.sec->sec_name,
724 symstate->ndx, EC_WORD(symndx), gbl_ndx);
727 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
728 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_BIND),
740 cmd_body_set_st_name(ARGSTATE *argstate, SYMSTATE *symstate)
743 Sym *sym = &symstate->sym.data[symstate->ndx];
751 symstate_add_str(argstate, symstate);
755 (void) elfedit_offset_to_str(symstate->str.sec,
759 symstate->str.sec, NULL, argstate->argv[1]);
764 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
765 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_NAME),
772 if (symstate->sym.sec->sec_shdr->sh_type == SHT_DYNSYM)
775 EC_WORD(symstate->sym.sec->sec_shndx),
776 symstate->sym.sec->sec_name,
777 EC_WORD(symstate->ndx));
780 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
781 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_NAME),
792 cmd_body_set_st_shndx(ARGSTATE *argstate, SYMSTATE *symstate)
795 Sym *sym = &symstate->sym.data[symstate->ndx];
841 symstate_add_xshndx(argstate, symstate);
849 if (symstate->xshndx.shndx != SHN_UNDEF)
853 symstate_add_xshndx(argstate, symstate);
856 (symstate->xshndx.data[symstate->ndx] != xshndx);
865 if ((symstate->ndx == 0) && (shndx != SHN_UNDEF))
889 EC_WORD(symstate->sym.sec->sec_shndx),
890 symstate->sym.sec->sec_name, EC_WORD(symstate->ndx),
896 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
897 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_SHNDX),
905 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
906 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_SHNDX),
914 symstate->xshndx.sec->sec_shndx,
915 symstate->xshndx.sec->sec_name,
916 EC_WORD(symstate->ndx),
918 symstate->xshndx.data[symstate->ndx]),
921 symstate->xshndx.data[symstate->ndx] = xshndx;
922 elfedit_modified_data(symstate->xshndx.sec);
926 symstate->xshndx.sec->sec_shndx,
927 symstate->xshndx.sec->sec_name,
928 EC_WORD(symstate->ndx),
937 cmd_body_set_st_type(ARGSTATE *argstate, SYMSTATE *symstate)
942 Sym *sym = &symstate->sym.data[symstate->ndx];
957 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
958 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_TYPE),
963 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
964 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_TYPE),
977 cmd_body_set_st_visibility(ARGSTATE *argstate, SYMSTATE *symstate)
981 Sym *sym = &symstate->sym.data[symstate->ndx];
996 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
997 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_VISIBILITY),
1002 symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
1003 EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_VISIBILITY),
1023 * symstate - State block for current symbol table.
1054 SYMSTATE *symstate;
1128 * Decide which symbol table(s) to use. Set up the symstate
1140 symstate = argstate->symstate;
1159 symstate->sym.sec = elfedit_sec_getsymtab(obj_state, 1,
1160 symtab->symt_shndx, NULL, &symstate->sym.data,
1161 &symstate->sym.n, &symtab);
1162 symstate->versym.shndx = symtab->symt_versym;
1163 symstate->xshndx.shndx = symtab->symt_xshndx;
1166 symstate->ndx = elfedit_atoui_range(
1168 symstate->sym.n - 1, NULL);
1187 symstate_add_str(argstate, symstate);
1193 if (elfedit_name_to_symndx(symstate->sym.sec,
1194 symstate->str.sec, argstate->argv[0],
1195 err_type, &symstate->ndx) == 0) {
1196 bzero(symstate, sizeof (*symstate));
1202 symstate++;
1225 * symstate - State block for current symbol table.
1228 symstate_cmd_body(SYM_CMD_T cmd, ARGSTATE *argstate, SYMSTATE *symstate)
1231 Sym *sym = &symstate->sym.data[symstate->ndx];
1234 if (symstate->ndx == 0)
1236 EC_WORD(symstate->sym.sec->sec_shndx),
1237 symstate->sym.sec->sec_name, EC_WORD(symstate->ndx));
1247 ret = cmd_body_set_st_bind(argstate, symstate);
1259 symstate->sym.sec->sec_shndx,
1260 symstate->sym.sec->sec_name,
1261 EC_WORD(symstate->ndx),
1267 symstate->sym.sec->sec_shndx,
1268 symstate->sym.sec->sec_name,
1269 EC_WORD(symstate->ndx),
1279 ret = cmd_body_set_st_name(argstate, symstate);
1291 symstate->sym.sec->sec_shndx,
1292 symstate->sym.sec->sec_name,
1293 EC_WORD(symstate->ndx),
1299 symstate->sym.sec->sec_shndx,
1300 symstate->sym.sec->sec_name,
1301 EC_WORD(symstate->ndx),
1311 ret = cmd_body_set_st_shndx(argstate, symstate);
1321 symstate->sym.sec->sec_shndx,
1322 symstate->sym.sec->sec_name,
1323 EC_WORD(symstate->ndx),
1329 symstate->sym.sec->sec_shndx,
1330 symstate->sym.sec->sec_name,
1331 EC_WORD(symstate->ndx),
1341 ret = cmd_body_set_st_type(argstate, symstate);
1351 symstate->sym.sec->sec_shndx,
1352 symstate->sym.sec->sec_name,
1353 EC_WORD(symstate->ndx),
1359 symstate->sym.sec->sec_shndx,
1360 symstate->sym.sec->sec_name,
1361 EC_WORD(symstate->ndx),
1373 ret = cmd_body_set_st_visibility(argstate, symstate);
1384 elfedit_modified_data(symstate->sym.sec);
1409 SYMSTATE *symstate;
1436 symstate = argstate->symstate;
1438 tblndx++, symstate++)
1439 elfedit_strtab_insert_test(obj_state, symstate->str.sec,
1445 symstate = argstate->symstate;
1446 for (tblndx = 0; tblndx < argstate->numsymstate; tblndx++, symstate++)
1447 if (symstate_cmd_body(cmd, argstate, symstate) ==