From: Alan Cox Date: Sun, 28 Jan 2018 15:20:47 +0000 (+0000) Subject: binman: spot discard/initializer overlap X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d7b7d559e889a8e8ec83602e48885edadfa6f1fe;p=FUZIX.git binman: spot discard/initializer overlap --- diff --git a/Kernel/tools/binman.c b/Kernel/tools/binman.c index 77c1e693..26962d2a 100644 --- a/Kernel/tools/binman.c +++ b/Kernel/tools/binman.c @@ -127,6 +127,15 @@ int main(int argc, char *argv[]) s__DISCARD + l__DISCARD - s__COMMONMEM); exit(1); } + /* If we have a discard area that overlaps the initializer block + then the compiler will have messed it up. Even though we then + copy the initializers into initialized we can only use the space + for bss */ + if (s__DISCARD && s__DISCARD + l__DISCARD >= s__INITIALIZER && + s__INITIALIZER + l__INITIALIZED >= s__DISCARD) { + fprintf(stderr, "Initializer will have overwritten DISCARD\n"); + exit(1); + } printf("Scanning data from 0x%x to 0x%x\n", s__DATA, s__DATA + l__DATA);