17 using namespace object;
29 if (
auto *M = dyn_cast<MachOObjectFile>(&O))
30 return M->getSectionID(Sec);
35 if (
auto *M = dyn_cast<MachOObjectFile>(&O))
36 return M->getSymbolSectionID(Sym);
40 std::vector<std::pair<SymbolRef, uint64_t>>
42 std::vector<std::pair<SymbolRef, uint64_t>>
Ret;
44 if (
const auto *
E = dyn_cast<ELFObjectFileBase>(&O)) {
45 auto Syms =
E->symbols();
46 if (Syms.begin() == Syms.end())
47 Syms =
E->getDynamicSymbolIterators();
49 Ret.push_back({Sym, Sym.getSize()});
55 std::vector<SymEntry> Addresses;
64 uint64_t
Address = Sec.getAddress();
65 uint64_t Size = Sec.getSize();
72 for (
unsigned I = 0,
N = Addresses.size() - 1;
I <
N; ++
I) {
73 auto &
P = Addresses[
I];
78 unsigned NextI =
I + 1;
79 while (NextI < N && Addresses[NextI].
Address ==
P.Address)
82 uint64_t Size = Addresses[NextI].Address -
P.Address;
91 Ret[
P.Number] = {*
P.I,
P.Address};
This class is the base class for all object file types.
int compareAddress(const SymEntry *A, const SymEntry *B)
static unsigned getSymbolSectionID(const ObjectFile &O, SymbolRef Sym)
virtual basic_symbol_iterator symbol_begin() const =0
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
virtual basic_symbol_iterator symbol_end() const =0
section_iterator_range sections() const
static unsigned getSectionID(const ObjectFile &O, SectionRef Sec)
std::vector< std::pair< SymbolRef, uint64_t > > computeSymbolSizes(const ObjectFile &O)
This is a value type class that represents a single symbol in the list of symbols in the object file...
LLVM Value Representation.
uint64_t getValue() const
Return the value of the symbol depending on the object this can be an offset or a virtual address...
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
This is a value type class that represents a single section in the list of sections in the object fil...