summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorDeyuan Guo ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) <guodeyuan@tsinghua.org.cn>2013-04-17 16:07:19 -0500
committerDeyuan Guo ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) <guodeyuan@tsinghua.org.cn>2013-04-17 16:07:19 -0500
commitb54e11862878cf88a427fa225407d1128abd21f2 (patch)
tree66f09330565822fd9123de93feebd3718a7fbd69 /src/base
parent3ff091bdf401113057c26cf1087cf0e872154265 (diff)
downloadgem5-b54e11862878cf88a427fa225407d1128abd21f2.tar.xz
base: load weak symbols from object file
Without loading weak symbols into gem5, some function names and the given PC cannot correspond correctly, because the binding attributes of unction names in an ELF file are not only STB_GLOBAL or STB_LOCAL, but also STB_WEAK. This patch adds a function for loading weak symbols. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/loader/elf_object.cc6
-rw-r--r--src/base/loader/elf_object.hh2
-rw-r--r--src/base/loader/object_file.hh3
3 files changed, 11 insertions, 0 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index f6a18db8a..b6253adbe 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -415,6 +415,12 @@ ElfObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask)
}
bool
+ElfObject::loadWeakSymbols(SymbolTable *symtab, Addr addrMask)
+{
+ return loadSomeSymbols(symtab, STB_WEAK, addrMask);
+}
+
+bool
ElfObject::loadSections(PortProxy& memProxy, Addr addrMask)
{
if (!ObjectFile::loadSections(memProxy, addrMask))
diff --git a/src/base/loader/elf_object.hh b/src/base/loader/elf_object.hh
index 350a80db1..d3d3e5197 100644
--- a/src/base/loader/elf_object.hh
+++ b/src/base/loader/elf_object.hh
@@ -71,6 +71,8 @@ class ElfObject : public ObjectFile
std::numeric_limits<Addr>::max());
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr addrMask =
std::numeric_limits<Addr>::max());
+ virtual bool loadWeakSymbols(SymbolTable *symtab, Addr addrMask =
+ std::numeric_limits<Addr>::max());
virtual bool isDynamic() { return sectionExists(".interp"); }
virtual bool hasTLS() { return sectionExists(".tbss"); }
diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh
index 4a789d321..bdc9a31a1 100644
--- a/src/base/loader/object_file.hh
+++ b/src/base/loader/object_file.hh
@@ -89,6 +89,9 @@ class ObjectFile
std::numeric_limits<Addr>::max()) = 0;
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr addrMask =
std::numeric_limits<Addr>::max()) = 0;
+ virtual bool loadWeakSymbols(SymbolTable *symtab, Addr addrMask =
+ std::numeric_limits<Addr>::max())
+ { return false; }
virtual bool isDynamic() { return false; }
virtual bool hasTLS() { return false; }