Index: include/llvm/Object/MachO.h =================================================================== --- include/llvm/Object/MachO.h +++ include/llvm/Object/MachO.h @@ -381,6 +381,8 @@ ArrayRef getDyldInfoLazyBindOpcodes() const; ArrayRef getDyldInfoExportsTrie() const; + ErrorOr findAndGetUuidCommand() const; + StringRef getStringTableData() const; bool is64Bit() const; void ReadULEB128s(uint64_t Index, SmallVectorImpl &Out) const; Index: lib/Object/MachOObjectFile.cpp =================================================================== --- lib/Object/MachOObjectFile.cpp +++ lib/Object/MachOObjectFile.cpp @@ -2418,6 +2418,20 @@ return ArrayRef(Ptr, DyldInfo.export_size); } +ErrorOr +MachOObjectFile::findAndGetUuidCommand() const { + MachOObjectFile::LoadCommandInfo Command = getFirstLoadCommandInfo(); + uint32_t LoadCommandCount = getHeader().ncmds; + for (uint32_t i = 0;; ++i) { + if (Command.C.cmd == MachO::LC_UUID) + return getUuidCommand(Command); + if (i == LoadCommandCount - 1) + break; + else + Command = getNextLoadCommandInfo(Command); + } + return object_error::parse_failed; +} StringRef MachOObjectFile::getStringTableData() const { MachO::symtab_command S = getSymtabLoadCommand();