#include "llvm/ObjCopy/MachO/MachOObjcopy.h"
#include "Archive.h"
#include "MachOReader.h"
#include "MachOWriter.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ObjCopy/CommonConfig.h"
#include "llvm/ObjCopy/MachO/MachOConfig.h"
#include "llvm/ObjCopy/MultiFormatConfig.h"
#include "llvm/ObjCopy/ObjCopy.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/MachOUniversalWriter.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
usingnamespacellvm;
usingnamespacellvm::objcopy;
usingnamespacellvm::objcopy::macho;
usingnamespacellvm::object;
SectionPred;
LoadCommandPred;
#ifndef NDEBUG
static bool isLoadCommandWithPayloadString(const LoadCommand &LC) {
return LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_RPATH ||
LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_ID_DYLIB ||
LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_DYLIB ||
LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_WEAK_DYLIB;
}
#endif
static StringRef getPayloadString(const LoadCommand &LC) { … }
static Error removeSections(const CommonConfig &Config, Object &Obj) { … }
static void markSymbols(const CommonConfig &, Object &Obj) { … }
static void updateAndRemoveSymbols(const CommonConfig &Config,
const MachOConfig &MachOConfig,
Object &Obj) { … }
template <typename LCType>
static void updateLoadCommandPayloadString(LoadCommand &LC, StringRef S) { … }
static LoadCommand buildRPathLoadCommand(StringRef Path) { … }
static Error processLoadCommands(const MachOConfig &MachOConfig, Object &Obj) { … }
static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
Object &Obj) { … }
static Error addSection(const NewSectionInfo &NewSection, Object &Obj) { … }
static Expected<Section &> findSection(StringRef SecName, Object &O) { … }
static Error updateSection(const NewSectionInfo &NewSection, Object &O) { … }
static Error isValidMachOCannonicalName(StringRef Name) { … }
static Error handleArgs(const CommonConfig &Config,
const MachOConfig &MachOConfig, Object &Obj) { … }
Error objcopy::macho::executeObjcopyOnBinary(const CommonConfig &Config,
const MachOConfig &MachOConfig,
object::MachOObjectFile &In,
raw_ostream &Out) { … }
Error objcopy::macho::executeObjcopyOnMachOUniversalBinary(
const MultiFormatConfig &Config, const MachOUniversalBinary &In,
raw_ostream &Out) { … }