File indexing completed on 2026-05-10 08:43:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_MACHO_H
0014 #define LLVM_EXECUTIONENGINE_ORC_MACHO_H
0015
0016 #include "llvm/ExecutionEngine/Orc/LoadLinkableFile.h"
0017 #include "llvm/Support/Error.h"
0018 #include "llvm/Support/MemoryBuffer.h"
0019 #include "llvm/TargetParser/Triple.h"
0020
0021 namespace llvm {
0022
0023 namespace object {
0024
0025 class MachOUniversalBinary;
0026
0027 }
0028
0029 namespace orc {
0030
0031 class JITDylib;
0032 class ObjectLayer;
0033
0034
0035
0036
0037
0038 Error checkMachORelocatableObject(MemoryBufferRef Obj, const Triple &TT,
0039 bool ObjIsSlice);
0040
0041
0042
0043
0044
0045 Expected<std::unique_ptr<MemoryBuffer>>
0046 checkMachORelocatableObject(std::unique_ptr<MemoryBuffer> Obj, const Triple &TT,
0047 bool ObjIsSlice);
0048
0049
0050
0051
0052 Expected<std::pair<std::unique_ptr<MemoryBuffer>, LinkableFileKind>>
0053 loadMachOLinkableFile(
0054 StringRef Path, const Triple &TT, LoadArchives LA,
0055 std::optional<StringRef> IdentifierOverride = std::nullopt);
0056
0057
0058
0059
0060
0061 Expected<std::pair<std::unique_ptr<MemoryBuffer>, LinkableFileKind>>
0062 loadLinkableSliceFromMachOUniversalBinary(sys::fs::file_t FD,
0063 std::unique_ptr<MemoryBuffer> UBBuf,
0064 const Triple &TT, LoadArchives LA,
0065 StringRef UBPath,
0066 StringRef Identifier);
0067
0068
0069
0070 Expected<std::pair<size_t, size_t>>
0071 getMachOSliceRangeForTriple(object::MachOUniversalBinary &UB, const Triple &TT);
0072
0073
0074
0075 Expected<std::pair<size_t, size_t>>
0076 getMachOSliceRangeForTriple(MemoryBufferRef UBBuf, const Triple &TT);
0077
0078
0079 class ForceLoadMachOArchiveMembers {
0080 public:
0081 ForceLoadMachOArchiveMembers(ObjectLayer &L, JITDylib &JD, bool ObjCOnly)
0082 : L(L), JD(JD), ObjCOnly(ObjCOnly) {}
0083
0084 Error operator()(MemoryBufferRef MemberBuf);
0085
0086 private:
0087 ObjectLayer &L;
0088 JITDylib &JD;
0089 bool ObjCOnly;
0090 };
0091
0092 }
0093 }
0094
0095 #endif