Skip to content

Commit

Permalink
Merge pull request #55 from willsowerbutts/binman
Browse files Browse the repository at this point in the history
binman: tidy up, fail when _DISCARD grows to overlap _COMMONMEM
  • Loading branch information
EtchedPixels committed Jan 5, 2015
2 parents 2bfe626 + 1acc765 commit c6ee3c9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Kernel/tools/binman.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@ static unsigned int s__CODE, s__CODE2, s__INITIALIZER, s__DATA,
static void ProcessMap(FILE * fp)
{
char buf[512];
int addr = 0;
int naddr;
char name[100];
char nname[100];
int hogs = 0;

while (fgets(buf, 511, fp)) {
char *p1 = strtok(buf, " \t\n");
char *p2 = NULL;
int match = 0;

match = memcmp(buf, " 000", 8);

if (p1)
p2 = strtok(NULL, " \t\n");
Expand Down Expand Up @@ -123,6 +115,14 @@ int main(int argc, char *argv[])
exit(1);
}

/* linker will allow us to overlap _DISCARD (which may grow)
with _COMMONMEM. */
if(s__DISCARD && s__DISCARD+l__DISCARD > s__COMMONMEM){
fprintf(stderr, "Move _DISCARD down by at least %d bytes\n",
s__DISCARD + l__DISCARD - s__COMMONMEM);
exit(1);
}

printf("Scanning data from 0x%x to 0x%x\n",
s__DATA, s__DATA + l__DATA);
base = s__DATA;
Expand Down

0 comments on commit c6ee3c9

Please sign in to comment.