mirror of
https://github.com/QuasarApp/LIEF.git
synced 2025-05-08 01:39:33 +00:00
Include static symbols in exported/imported
This commit is contained in:
parent
cda91aec7a
commit
30f34a6952
@ -524,6 +524,7 @@ class LIEF_API Binary : public LIEF::Binary {
|
|||||||
|
|
||||||
template<bool LOADED>
|
template<bool LOADED>
|
||||||
Section& add_section(const Section& section);
|
Section& add_section(const Section& section);
|
||||||
|
symbols_t static_dyn_symbols(void) const;
|
||||||
|
|
||||||
//! The binary type
|
//! The binary type
|
||||||
//! (i.e. `ELF32` or `ELF64`)
|
//! (i.e. `ELF32` or `ELF64`)
|
||||||
|
@ -355,33 +355,11 @@ it_const_symbols Binary::dynamic_symbols(void) const {
|
|||||||
|
|
||||||
|
|
||||||
it_symbols Binary::symbols(void) {
|
it_symbols Binary::symbols(void) {
|
||||||
symbols_t symbols;
|
return this->static_dyn_symbols();
|
||||||
symbols.reserve(this->dynamic_symbols().size() + this->static_symbols().size());
|
|
||||||
for (Symbol& s : this->dynamic_symbols()) {
|
|
||||||
symbols.push_back(&s);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Symbol& s : this->static_symbols()) {
|
|
||||||
symbols.push_back(&s);
|
|
||||||
}
|
|
||||||
|
|
||||||
return it_symbols{symbols};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it_const_symbols Binary::symbols(void) const {
|
it_const_symbols Binary::symbols(void) const {
|
||||||
symbols_t symbols;
|
return this->static_dyn_symbols();
|
||||||
|
|
||||||
symbols.reserve(this->dynamic_symbols().size() + this->static_symbols().size());
|
|
||||||
|
|
||||||
for (const Symbol& s : this->dynamic_symbols()) {
|
|
||||||
symbols.push_back(const_cast<Symbol*>(&s));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const Symbol& s : this->static_symbols()) {
|
|
||||||
symbols.push_back(const_cast<Symbol*>(&s));
|
|
||||||
}
|
|
||||||
|
|
||||||
return it_const_symbols{symbols};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -553,17 +531,31 @@ Symbol& Binary::get_static_symbol(const std::string& name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
symbols_t Binary::static_dyn_symbols(void) const {
|
||||||
|
symbols_t symbols;
|
||||||
|
symbols.reserve(this->dynamic_symbols().size() + this->static_symbols().size());
|
||||||
|
for (Symbol& s : this->dynamic_symbols()) {
|
||||||
|
symbols.push_back(&s);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Symbol& s : this->static_symbols()) {
|
||||||
|
symbols.push_back(&s);
|
||||||
|
}
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
|
||||||
// Exported
|
// Exported
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
it_exported_symbols Binary::exported_symbols(void) {
|
it_exported_symbols Binary::exported_symbols(void) {
|
||||||
return {this->dynamic_symbols_,
|
|
||||||
|
return {this->static_dyn_symbols(),
|
||||||
[] (const Symbol* symbol) { return symbol->is_exported(); }
|
[] (const Symbol* symbol) { return symbol->is_exported(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
it_const_exported_symbols Binary::exported_symbols(void) const {
|
it_const_exported_symbols Binary::exported_symbols(void) const {
|
||||||
return {this->dynamic_symbols_,
|
return {this->static_dyn_symbols(),
|
||||||
[] (const Symbol* symbol) { return symbol->is_exported(); }
|
[] (const Symbol* symbol) { return symbol->is_exported(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -574,13 +566,13 @@ it_const_exported_symbols Binary::exported_symbols(void) const {
|
|||||||
// --------
|
// --------
|
||||||
|
|
||||||
it_imported_symbols Binary::imported_symbols(void) {
|
it_imported_symbols Binary::imported_symbols(void) {
|
||||||
return filter_iterator<symbols_t>{std::ref(this->dynamic_symbols_),
|
return {this->static_dyn_symbols(),
|
||||||
[] (const Symbol* symbol) { return symbol->is_imported(); }
|
[] (const Symbol* symbol) { return symbol->is_imported(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
it_const_imported_symbols Binary::imported_symbols(void) const {
|
it_const_imported_symbols Binary::imported_symbols(void) const {
|
||||||
return const_filter_iterator<symbols_t>{std::cref(this->dynamic_symbols_),
|
return {this->static_dyn_symbols(),
|
||||||
[] (const Symbol* symbol) { return symbol->is_imported(); }
|
[] (const Symbol* symbol) { return symbol->is_imported(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user