18using namespace object;
22 if (
A->SectionID !=
B->SectionID)
23 return A->SectionID <
B->SectionID ? -1 : 1;
24 if (
A->Address !=
B->Address)
25 return A->Address <
B->Address ? -1 : 1;
30 if (
auto *M = dyn_cast<MachOObjectFile>(&O))
31 return M->getSectionID(Sec);
32 if (isa<WasmObjectFile>(&O))
34 if (isa<XCOFFObjectFile>(&O))
36 return cast<COFFObjectFile>(O).getSectionID(Sec);
40 if (
auto *M = dyn_cast<MachOObjectFile>(&O))
41 return M->getSymbolSectionID(
Sym);
42 if (
const auto *M = dyn_cast<WasmObjectFile>(&O))
43 return M->getSymbolSectionId(
Sym);
44 if (
const auto *M = dyn_cast<XCOFFObjectFile>(&O))
45 return M->getSymbolSectionID(
Sym);
46 return cast<COFFObjectFile>(O).getSymbolSectionID(
Sym);
49std::vector<std::pair<SymbolRef, uint64_t>>
51 std::vector<std::pair<SymbolRef, uint64_t>> Ret;
53 if (
const auto *E = dyn_cast<ELFObjectFileBase>(&O)) {
54 auto Syms = E->symbols();
56 Syms = E->getDynamicSymbolIterators();
58 Ret.push_back({
Sym,
Sym.getSize()});
62 if (
const auto *E = dyn_cast<XCOFFObjectFile>(&O)) {
64 Ret.push_back({
Sym,
Sym.getSize()});
68 if (
const auto *E = dyn_cast<WasmObjectFile>(&O)) {
70 Ret.push_back({
Sym, E->getSymbolSize(
Sym)});
77 std::vector<SymEntry> Addresses;
95 if (Addresses.empty())
104 for (
unsigned I = 0, NextI = 0,
N = Addresses.size() - 1;
I <
N; ++
I) {
105 auto &
P = Addresses[
I];
106 if (
P.I == O.symbol_end())
112 while (NextI <
N && Addresses[NextI].Address ==
P.Address)
123 if (
P.I == O.symbol_end())
125 Ret[
P.Number] = {*
P.I,
P.Address};
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static unsigned getSymbolSectionID(const ObjectFile &O, SymbolRef Sym)
static unsigned getSectionID(const ObjectFile &O, SectionRef Sec)
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
This class is the base class for all object file types.
This is a value type class that represents a single section in the list of sections in the object fil...
uint64_t getIndex() const
This is a value type class that represents a single symbol in the list of symbols in the object file.
int compareAddress(const SymEntry *A, const SymEntry *B)
std::vector< std::pair< SymbolRef, uint64_t > > computeSymbolSizes(const ObjectFile &O)
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.