Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binman: tidy up, fail when _DISCARD grows to overlap _COMMONMEM #55

Merged
merged 3 commits into from
Jan 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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