summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-09-07 14:20:52 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2012-09-07 14:20:52 -0500
commit3742b19b368eb371e2fd8fefc388a8ca65a3113d (patch)
treeadf9020114623845ae6e88d37be156205175628f /src
parent8fc0cef6111bdcad5964f7213a66fbf232f2baf0 (diff)
downloadgem5-3742b19b368eb371e2fd8fefc388a8ca65a3113d.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/base/loader/elf_object.cc1
-rw-r--r--src/base/loader/object_file.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index e48678bbb..f6a18db8a 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -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;
diff --git a/src/base/loader/object_file.cc b/src/base/loader/object_file.cc
index 420611d83..80fc9c2f9 100644
--- a/src/base/loader/object_file.cc
+++ b/src/base/loader/object_file.cc
@@ -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)
{
}