LLVM 22.0.0git
llvm::objcopy::coff Namespace Reference

Classes

struct  AuxSymbol
class  COFFObjectFile
class  COFFReader
class  COFFWriter
struct  Object
struct  Relocation
struct  Section
struct  Symbol

Functions

LLVM_ABI Error executeObjcopyOnBinary (const CommonConfig &Config, const COFFConfig &, object::COFFObjectFile &In, raw_ostream &Out)
 Apply the transformations described by Config and COFFConfig to In and writes the result into Out.
static bool isDebugSection (const Section &Sec)
static uint64_t getNextRVA (const Object &Obj)
static Expected< std::vector< uint8_t > > createGnuDebugLinkSectionContents (StringRef File)
static void addSection (Object &Obj, StringRef Name, ArrayRef< uint8_t > Contents, uint32_t Characteristics)
static Error addGnuDebugLink (Object &Obj, StringRef DebugLinkFile)
static uint32_t flagsToCharacteristics (SectionFlag AllFlags, uint32_t OldChar)
static Error dumpSection (Object &O, StringRef SectionName, StringRef FileName)
static Error handleArgs (const CommonConfig &Config, const COFFConfig &COFFConfig, Object &Obj)
template<class Symbol1Ty, class Symbol2Ty>
void copySymbol (Symbol1Ty &Dest, const Symbol2Ty &Src)
template<class PeHeader1Ty, class PeHeader2Ty>
void copyPeHeader (PeHeader1Ty &Dest, const PeHeader2Ty &Src)

Function Documentation

◆ addGnuDebugLink()

◆ addSection()

◆ copyPeHeader()

template<class PeHeader1Ty, class PeHeader2Ty>
void llvm::objcopy::coff::copyPeHeader ( PeHeader1Ty & Dest,
const PeHeader2Ty & Src )

Definition at line 177 of file COFFObject.h.

◆ copySymbol()

template<class Symbol1Ty, class Symbol2Ty>
void llvm::objcopy::coff::copySymbol ( Symbol1Ty & Dest,
const Symbol2Ty & Src )

Definition at line 163 of file COFFObject.h.

◆ createGnuDebugLinkSectionContents()

◆ dumpSection()

◆ executeObjcopyOnBinary()

Error llvm::objcopy::coff::executeObjcopyOnBinary ( const CommonConfig & Config,
const COFFConfig & COFFConfig,
object::COFFObjectFile & In,
raw_ostream & Out )

Apply the transformations described by Config and COFFConfig to In and writes the result into Out.

Returns
any Error encountered whilst performing the operation.

Definition at line 330 of file COFFObjcopy.cpp.

References assert(), llvm::objcopy::coff::COFFReader::create(), llvm::createFileError(), E(), llvm::Expected< T >::get(), handleArgs(), llvm::objcopy::CommonConfig::InputFilename, llvm::objcopy::CommonConfig::OutputFilename, llvm::Error::success(), and llvm::Expected< T >::takeError().

Referenced by llvm::objcopy::executeObjcopyOnBinary().

◆ flagsToCharacteristics()

◆ getNextRVA()

◆ handleArgs()

Error llvm::objcopy::coff::handleArgs ( const CommonConfig & Config,
const COFFConfig & COFFConfig,
Object & Obj )
static

Definition at line 157 of file COFFObjcopy.cpp.

References llvm::objcopy::CommonConfig::AddGnuDebugLink, addGnuDebugLink(), llvm::objcopy::CommonConfig::AddSection, addSection(), llvm::objcopy::All, llvm::object::coff_section::Characteristics, llvm::createStringError(), llvm::objcopy::coff::Object::DataDirectories, llvm::COFF::DEBUG_DIRECTORY, llvm::objcopy::CommonConfig::DiscardMode, llvm::objcopy::CommonConfig::DumpSection, dumpSection(), E(), llvm::objcopy::NameMatcher::empty(), llvm::StringRef::empty(), llvm::objcopy::File, llvm::find_if(), flagsToCharacteristics(), llvm::objcopy::coff::Object::getMutableSections(), llvm::objcopy::coff::Object::getMutableSymbols(), llvm::objcopy::coff::Section::Header, I, llvm::COFF::IMAGE_SCN_ALIGN_1BYTES, llvm::COFF::IMAGE_SCN_CNT_CODE, llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA, llvm::COFF::IMAGE_SCN_MEM_DISCARDABLE, llvm::COFF::IMAGE_SYM_CLASS_STATIC, llvm::invalid_argument, isDebugSection(), llvm::objcopy::coff::Object::IsPE, llvm::objcopy::COFFConfig::MajorSubsystemVersion, llvm::object::pe32plus_header::MajorSubsystemVersion, llvm::objcopy::coff::Object::markSymbols(), llvm::objcopy::NameMatcher::matches(), llvm::objcopy::COFFConfig::MinorSubsystemVersion, llvm::object::pe32plus_header::MinorSubsystemVersion, llvm::objcopy::coff::Section::Name, llvm::objcopy::CommonConfig::OnlyKeepDebug, llvm::objcopy::CommonConfig::OnlySection, llvm::objcopy::CommonConfig::OutputFilename, llvm::objcopy::coff::Object::PeHeader, llvm::object::data_directory::RelativeVirtualAddress, llvm::objcopy::coff::Section::Relocs, llvm::objcopy::coff::Object::removeSections(), llvm::objcopy::coff::Object::removeSymbols(), llvm::objcopy::NewSectionInfo::SectionData, llvm::objcopy::NewSectionInfo::SectionName, llvm::objcopy::CommonConfig::SetSectionFlags, llvm::object::data_directory::Size, llvm::object::coff_section::SizeOfRawData, llvm::StringRef::str(), llvm::objcopy::CommonConfig::StripAll, llvm::objcopy::CommonConfig::StripAllGNU, llvm::objcopy::CommonConfig::StripDebug, llvm::objcopy::CommonConfig::StripUnneeded, llvm::objcopy::COFFConfig::Subsystem, llvm::object::pe32plus_header::Subsystem, llvm::Error::success(), llvm::objcopy::CommonConfig::SymbolsToRemove, llvm::objcopy::CommonConfig::SymbolsToRename, llvm::objcopy::CommonConfig::ToRemove, ToRemove, llvm::objcopy::coff::Object::truncateSections(), llvm::objcopy::CommonConfig::UnneededSymbolsToRemove, llvm::objcopy::CommonConfig::UpdateSection, and llvm::object::coff_section::VirtualAddress.

Referenced by executeObjcopyOnBinary().

◆ isDebugSection()

bool llvm::objcopy::coff::isDebugSection ( const Section & Sec)
static

Definition at line 31 of file COFFObjcopy.cpp.

References llvm::objcopy::coff::Section::Name, and llvm::StringRef::starts_with().

Referenced by handleArgs().