Improved handling of the stack idenfitication at end of memory that works better for mspgcc 4.7.x

This commit is contained in:
Adam Dunkels 2013-08-29 20:16:40 +02:00 committed by Niclas Finne
parent d59a319f17
commit b5985a4f47
1 changed files with 7 additions and 5 deletions

View File

@ -374,6 +374,7 @@ public class ELF {
public MapTable getMap() {
MapTable map = new MapTable();
int sAddrHighest = -1;
boolean foundEnd = false;
ELFSection name = sections[symTable.link];
int len = symTable.size;
@ -418,13 +419,14 @@ public class ELF {
if (sAddr > 0 && sAddr < 0x100000) {
String symbolName = sn;
if (sAddr < 0x5c00 && sAddr > sAddrHighest) {
if (sAddr < 0x5c00 && sAddr > sAddrHighest && !sn.equals("__stack")) {
sAddrHighest = sAddr;
}
// if (bind == ELFSection.SYMBIND_LOCAL) {
// symbolName += " (" + currentFile + ')';
// }
if ("_end".equals(symbolName)) {
foundEnd = true;
map.setHeapStart(sAddr);
} else if ("__stack".equals(symbolName)){
map.setStackStart(sAddr);
@ -455,10 +457,10 @@ public class ELF {
addr += symTable.getEntrySize();
}
if (map.getHeapStart() <= 0 && sAddrHighest > 0) {
System.err.printf("Warning: Unable to parse _end symbol. I'm guessing that heap starts at 0x%05x\n", sAddrHighest);
map.setHeapStart(sAddrHighest);
}
if (!foundEnd && sAddrHighest > 0) {
System.out.printf("Warning: Unable to parse _end symbol. I'm guessing that heap starts at 0x%05x\n", sAddrHighest);
map.setHeapStart(sAddrHighest);
}
return map;
}