LLVM  15.0.0git
Typedefs | Functions
MachOObjcopy.cpp File Reference
#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"
Include dependency graph for MachOObjcopy.cpp:

Go to the source code of this file.

Typedefs

using SectionPred = std::function< bool(const std::unique_ptr< Section > &Sec)>
 
using LoadCommandPred = std::function< bool(const LoadCommand &LC)>
 

Functions

static bool isLoadCommandWithPayloadString (const LoadCommand &LC)
 
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)
 

Typedef Documentation

◆ LoadCommandPred

Definition at line 33 of file MachOObjcopy.cpp.

◆ SectionPred

using SectionPred = std::function<bool(const std::unique_ptr<Section> &Sec)>

Definition at line 32 of file MachOObjcopy.cpp.

Function Documentation

◆ addSection()

static Error addSection ( const NewSectionInfo NewSection,
Object Obj 
)
static

◆ buildRPathLoadCommand()

static LoadCommand buildRPathLoadCommand ( StringRef  Path)
static

◆ dumpSectionToFile()

static Error dumpSectionToFile ( StringRef  SecName,
StringRef  Filename,
Object Obj 
)
static

◆ findSection()

static Expected<Section &> findSection ( StringRef  SecName,
Object O 
)
static

◆ getPayloadString()

static StringRef getPayloadString ( const LoadCommand LC)
static

◆ handleArgs()

static Error handleArgs ( const CommonConfig Config,
const MachOConfig MachOConfig,
Object Obj 
)
static

◆ isLoadCommandWithPayloadString()

static bool isLoadCommandWithPayloadString ( const LoadCommand LC)
static

◆ isValidMachOCannonicalName()

static Error isValidMachOCannonicalName ( StringRef  Name)
static

Definition at line 373 of file MachOObjcopy.cpp.

References llvm::createStringError(), llvm::invalid_argument, and llvm::Error::success().

Referenced by handleArgs().

◆ markSymbols()

static void markSymbols ( const CommonConfig ,
Object Obj 
)
static

◆ processLoadCommands()

static Error processLoadCommands ( const MachOConfig MachOConfig,
Object Obj 
)
static

Definition at line 149 of file MachOObjcopy.cpp.

References buildRPathLoadCommand(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::contains(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::count(), llvm::createStringError(), E, llvm::StringRef::empty(), llvm::objcopy::MachOConfig::EmptySegmentsToRemove, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::erase(), getPayloadString(), llvm::objcopy::macho::LoadCommand::getSegmentName(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert(), llvm::objcopy::MachOConfig::InstallNamesToUpdate, llvm::invalid_argument, llvm::objcopy::macho::Object::LoadCommands, llvm::objcopy::macho::LoadCommand::MachOLoadCommand, llvm::objcopy::MachOConfig::RemoveAllRpaths, llvm::objcopy::macho::Object::removeLoadCommands(), llvm::objcopy::MachOConfig::RPathsToRemove, llvm::objcopy::MachOConfig::RPathsToUpdate, llvm::objcopy::MachOConfig::RPathToAdd, llvm::objcopy::MachOConfig::RPathToPrepend, llvm::objcopy::macho::LoadCommand::Sections, llvm::objcopy::MachOConfig::SharedLibId, llvm::StringRef::str(), llvm::Error::success(), and llvm::objcopy::macho::Object::updateLoadCommandIndexes().

Referenced by handleArgs().

◆ removeSections()

static Error removeSections ( const CommonConfig Config,
Object Obj 
)
static

◆ updateAndRemoveSymbols()

static void updateAndRemoveSymbols ( const CommonConfig Config,
const MachOConfig MachOConfig,
Object Obj 
)
static

◆ updateLoadCommandPayloadString()

template<typename LCType >
static void updateLoadCommandPayloadString ( LoadCommand LC,
StringRef  S 
)
static

◆ updateSection()

static Error updateSection ( const NewSectionInfo NewSection,
Object O 
)
static