Loader: Use address mask provided to load*Symbols when loading the symbols from the symbol table.

This commit is contained in:
Ali Saidi
2010-08-23 11:18:39 -05:00
parent f2642e2055
commit 4ab68fc999
2 changed files with 5 additions and 5 deletions

View File

@@ -335,7 +335,7 @@ ElfObject::ElfObject(const string &_filename, int _fd,
bool
ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding, Addr mask)
{
Elf *elf;
int sec_idx = 1; // there is a 0 but it is nothing, go figure
@@ -375,7 +375,7 @@ ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
for (ii = 0; ii < count; ++ii) {
gelf_getsym(data, ii, &sym);
if (GELF_ST_BIND(sym.st_info) == binding) {
symtab->insert(sym.st_value,
symtab->insert(sym.st_value & mask,
elf_strptr(elf, shdr.sh_link, sym.st_name));
}
}
@@ -392,13 +392,13 @@ ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
bool
ElfObject::loadGlobalSymbols(SymbolTable *symtab, Addr addrMask)
{
return loadSomeSymbols(symtab, STB_GLOBAL);
return loadSomeSymbols(symtab, STB_GLOBAL, addrMask);
}
bool
ElfObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask)
{
return loadSomeSymbols(symtab, STB_LOCAL);
return loadSomeSymbols(symtab, STB_LOCAL, addrMask);
}
bool

View File

@@ -50,7 +50,7 @@ class ElfObject : public ObjectFile
std::set<std::string> sectionNames;
/// Helper functions for loadGlobalSymbols() and loadLocalSymbols().
bool loadSomeSymbols(SymbolTable *symtab, int binding);
bool loadSomeSymbols(SymbolTable *symtab, int binding, Addr mask);
ElfObject(const std::string &_filename, int _fd,
size_t _len, uint8_t *_data,