util/crossgcc: Add buildgcc -G and --skip-gdb options
[coreboot.git] / util / cbfstool / cbfs-mkstage.c
index 6e8daef508729c950dca28c50d99c04e7606072b..2f81da07d5e8137a0bacc65a44f95296ba29d420 100644 (file)
@@ -126,6 +126,11 @@ int parse_elf_to_stage(unsigned char *input, unsigned char **output,
                data_start = *location;
        }
 
+       if (data_end <= data_start) {
+               fprintf(stderr, "E: data ends before it starts. Make sure the ELF file is correct and resides in ROM space.\n");
+               exit(1);
+       }
+
        /* allocate an intermediate buffer for the data */
        buffer = calloc(data_end - data_start, 1);