#include "MachOUtils.h"
#include "BinaryHolder.h"
#include "DebugMap.h"
#include "LinkUtils.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/CodeGen/NonRelocatableStringpool.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace dsymutil {
namespace MachOUtils {
llvm::Error ArchAndFile::createTempFile() { … }
llvm::StringRef ArchAndFile::getPath() const { … }
int ArchAndFile::getFD() const { … }
ArchAndFile::~ArchAndFile() { … }
std::string getArchName(StringRef Arch) { … }
static bool runLipo(StringRef SDKPath, SmallVectorImpl<StringRef> &Args) { … }
bool generateUniversalBinary(SmallVectorImpl<ArchAndFile> &ArchFiles,
StringRef OutputFileName,
const LinkOptions &Options, StringRef SDKPath,
bool Fat64) { … }
struct MachO::segment_command_64 adaptFrom32bits(MachO::segment_command Seg) { … }
template <typename FunctionTy>
static void iterateOnSegments(const object::MachOObjectFile &Obj,
FunctionTy Handler) { … }
template <typename NListTy>
static bool transferSymbol(NListTy NList, bool IsLittleEndian,
StringRef Strings, SmallVectorImpl<char> &NewSymtab,
NonRelocatableStringpool &NewStrings,
bool &InDebugNote) { … }
static unsigned transferSymbols(const object::MachOObjectFile &Obj,
SmallVectorImpl<char> &NewSymtab,
NonRelocatableStringpool &NewStrings) { … }
static MachO::section
getSection(const object::MachOObjectFile &Obj,
const MachO::segment_command &Seg,
const object::MachOObjectFile::LoadCommandInfo &LCI, unsigned Idx) { … }
static MachO::section_64
getSection(const object::MachOObjectFile &Obj,
const MachO::segment_command_64 &Seg,
const object::MachOObjectFile::LoadCommandInfo &LCI, unsigned Idx) { … }
template <typename SegmentTy>
static void transferSegmentAndSections(
const object::MachOObjectFile::LoadCommandInfo &LCI, SegmentTy Segment,
const object::MachOObjectFile &Obj, MachObjectWriter &Writer,
uint64_t LinkeditOffset, uint64_t LinkeditSize, uint64_t EHFrameOffset,
uint64_t EHFrameSize, uint64_t DwarfSegmentSize, uint64_t &GapForDwarf,
uint64_t &EndAddress) { … }
static bool createDwarfSegment(const MCAssembler& Asm,uint64_t VMAddr, uint64_t FileOffset,
uint64_t FileSize, unsigned NumSections,
MachObjectWriter &Writer) { … }
static bool isExecutable(const object::MachOObjectFile &Obj) { … }
static unsigned segmentLoadCommandSize(bool Is64Bit, unsigned NumSections) { … }
bool generateDsymCompanion(
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS, const DebugMap &DM,
MCStreamer &MS, raw_fd_ostream &OutFile,
const std::vector<MachOUtils::DwarfRelocationApplicationInfo>
&RelocationsToApply) { … }
}
}
}