示例#1
0
/* load_needed -- load files containing needed modules */
static void load_needed() {
     FILE *fp;
     int i;
     char *name;

     for (i = 0; i < nmodules; i++) {
	  if (!module[i].m_needed) continue;

	  name = module[i].m_file;
	  err_file = name;
	  fp = fopen(name, "r");
	  if (fp == NULL) {
	       perror(name);
	       exit(2);
	  }

	  while (fgets(line, MAXLINE, fp) != NULL) {
	       nwords = split_line(line, words);
	       if (nwords == 0) continue;
	       put_inst(words[0], &words[1], nwords-1);
	  }

	  fclose(fp);
     }
}
示例#2
0
static void add_label(Seq_T stream, int location_to_patch, int label_value)
{
	Um_instruction inst = get_inst(stream, location_to_patch);
	unsigned k = Bitpack_getu(inst, 25, 0);
	inst = Bitpack_newu(inst, 25, 0, label_value + k);
	put_inst(stream, location_to_patch, inst);
}