summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/sbtools/elftosb.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/utils/sbtools/elftosb.c b/utils/sbtools/elftosb.c
index 38ac0ae32a..7a0c67e53b 100644
--- a/utils/sbtools/elftosb.c
+++ b/utils/sbtools/elftosb.c
@@ -184,8 +184,7 @@ struct cmd_source_t
184 struct cmd_source_t *next; 184 struct cmd_source_t *next;
185 /* for later use */ 185 /* for later use */
186 enum cmd_source_type_t type; 186 enum cmd_source_type_t type;
187 bool bin_loaded; 187 bool loaded;
188 bool elf_loaded;
189 struct elf_params_t elf; 188 struct elf_params_t elf;
190 struct bin_param_t bin; 189 struct bin_param_t bin;
191}; 190};
@@ -683,7 +682,7 @@ static void load_elf_by_id(struct cmd_file_t *cmd_file, const char *id)
683 if(src == NULL) 682 if(src == NULL)
684 bug("undefined reference to source '%s'\n", id); 683 bug("undefined reference to source '%s'\n", id);
685 /* avoid reloading */ 684 /* avoid reloading */
686 if(src->type == CMD_SRC_ELF && src->elf_loaded) 685 if(src->type == CMD_SRC_ELF && src->loaded)
687 return; 686 return;
688 if(src->type != CMD_SRC_UNK) 687 if(src->type != CMD_SRC_UNK)
689 bug("source '%s' seen both as elf and binary file", id); 688 bug("source '%s' seen both as elf and binary file", id);
@@ -694,9 +693,9 @@ static void load_elf_by_id(struct cmd_file_t *cmd_file, const char *id)
694 if(g_debug) 693 if(g_debug)
695 printf("Loading ELF file '%s'...\n", src->filename); 694 printf("Loading ELF file '%s'...\n", src->filename);
696 elf_init(&src->elf); 695 elf_init(&src->elf);
697 src->elf_loaded = elf_read_file(&src->elf, elf_read, elf_printf, &fd); 696 src->loaded = elf_read_file(&src->elf, elf_read, elf_printf, &fd);
698 close(fd); 697 close(fd);
699 if(!src->elf_loaded) 698 if(!src->loaded)
700 bug("error loading elf file '%s' (id '%s')\n", src->filename, id); 699 bug("error loading elf file '%s' (id '%s')\n", src->filename, id);
701} 700}
702 701
@@ -705,10 +704,8 @@ static void load_bin_by_id(struct cmd_file_t *cmd_file, const char *id)
705 struct cmd_source_t *src = find_source_by_id(cmd_file, id); 704 struct cmd_source_t *src = find_source_by_id(cmd_file, id);
706 if(src == NULL) 705 if(src == NULL)
707 bug("undefined reference to source '%s'\n", id); 706 bug("undefined reference to source '%s'\n", id);
708 if(src == NULL)
709 bug("undefined reference to source '%s'\n", id);
710 /* avoid reloading */ 707 /* avoid reloading */
711 if(src->type == CMD_SRC_BIN && src->bin_loaded) 708 if(src->type == CMD_SRC_BIN && src->loaded)
712 return; 709 return;
713 if(src->type != CMD_SRC_UNK) 710 if(src->type != CMD_SRC_UNK)
714 bug("source '%s' seen both as elf and binary file", id); 711 bug("source '%s' seen both as elf and binary file", id);
@@ -723,7 +720,7 @@ static void load_bin_by_id(struct cmd_file_t *cmd_file, const char *id)
723 src->bin.data = xmalloc(src->bin.size); 720 src->bin.data = xmalloc(src->bin.size);
724 read(fd, src->bin.data, src->bin.size); 721 read(fd, src->bin.data, src->bin.size);
725 close(fd); 722 close(fd);
726 src->bin_loaded = true; 723 src->loaded = true;
727} 724}
728 725
729static struct sb_file_t *apply_cmd_file(struct cmd_file_t *cmd_file) 726static struct sb_file_t *apply_cmd_file(struct cmd_file_t *cmd_file)