loader: initialize all memory in the ObjectFile objects.

Some bare metal build flows seem to build binaries that we aren't necessarily
expecting. Initialize everything to 0, so we don't make any assumptions about
what is or isn't in the binary.
This commit is contained in:
Ali Saidi 2012-09-07 14:20:52 -05:00
parent 8fc0cef611
commit 3742b19b36
2 changed files with 2 additions and 1 deletions

View file

@ -248,6 +248,7 @@ ElfObject::ElfObject(const string &_filename, int _fd,
// initialize segment sizes to 0 in case they're not present
text.size = data.size = bss.size = 0;
text.baseAddr = data.baseAddr = bss.baseAddr = 0;
int secIdx = 1;
Elf_Scn *section;

View file

@ -53,7 +53,7 @@ ObjectFile::ObjectFile(const string &_filename, int _fd,
size_t _len, uint8_t *_data,
Arch _arch, OpSys _opSys)
: filename(_filename), descriptor(_fd), fileData(_data), len(_len),
arch(_arch), opSys(_opSys)
arch(_arch), opSys(_opSys), globalPtr(0)
{
}