X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/b1f7435d66a93f03b77932b3a9ad8a83ce5e1ebc..7f09b9353af9897bf18933788d6a59c152c29edd:/src/ld/passes/dtrace_dof.cpp?ds=inline diff --git a/src/ld/passes/dtrace_dof.cpp b/src/ld/passes/dtrace_dof.cpp index 175629d..6f8a544 100644 --- a/src/ld/passes/dtrace_dof.cpp +++ b/src/ld/passes/dtrace_dof.cpp @@ -30,9 +30,11 @@ #include #include -#include +#include +#include #include "ld.hpp" +#include "MachOFileAbstraction.hpp" #include "dtrace_dof.h" // prototype for entry point in libdtrace.dylib @@ -103,20 +105,14 @@ Atom::Atom(File& f, const char* n, const uint8_t* content, uint64_t sz) -class CStringEquals -{ -public: - bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); } -}; - struct DTraceProbeInfo { DTraceProbeInfo(const ld::Atom* a, uint32_t o, const char* n) : atom(a), offset(o), probeName(n) {} const ld::Atom* atom; uint32_t offset; const char* probeName; }; -typedef __gnu_cxx::hash_map, __gnu_cxx::hash, CStringEquals> ProviderToProbes; -typedef __gnu_cxx::hash_set, CStringEquals> CStringSet; +typedef std::unordered_map, CStringHash, CStringEquals> ProviderToProbes; +typedef std::unordered_set CStringSet; @@ -127,6 +123,10 @@ void doPass(const Options& opts, ld::Internal& internal) // only make __dof section in final linked images if ( opts.outputKind() == Options::kObjectFile ) return; + + // skip making __dof section if command line option said not to + if ( ! opts.generateDtraceDOF() ) + return; // scan all atoms looking for dtrace probes std::vector probeSites; @@ -143,11 +143,13 @@ void doPass(const Options& opts, ld::Internal& internal) case ld::Fixup::kindStoreX86DtraceCallSiteNop: case ld::Fixup::kindStoreARMDtraceCallSiteNop: case ld::Fixup::kindStoreThumbDtraceCallSiteNop: + case ld::Fixup::kindStoreARM64DtraceCallSiteNop: probeSites.push_back(DTraceProbeInfo(atom, fit->offsetInAtom, fit->u.name)); break; case ld::Fixup::kindStoreX86DtraceIsEnableSiteClear: case ld::Fixup::kindStoreARMDtraceIsEnableSiteClear: case ld::Fixup::kindStoreThumbDtraceIsEnableSiteClear: + case ld::Fixup::kindStoreARM64DtraceIsEnableSiteClear: isEnabledSites.push_back(DTraceProbeInfo(atom, fit->offsetInAtom, fit->u.name)); break; case ld::Fixup::kindDtraceExtra: @@ -169,6 +171,7 @@ void doPass(const Options& opts, ld::Internal& internal) case CPU_TYPE_I386: case CPU_TYPE_X86_64: case CPU_TYPE_ARM: + case CPU_TYPE_ARM64: storeKind = ld::Fixup::kindStoreLittleEndian32; break; default: