LLVM 20.0.0git
Classes | Functions
llvm::objcopy::coff Namespace Reference

Classes

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

Functions

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()

static Error llvm::objcopy::coff::addGnuDebugLink ( Object Obj,
StringRef  DebugLinkFile 
)
static

◆ addSection()

static void llvm::objcopy::coff::addSection ( Object Obj,
StringRef  Name,
ArrayRef< uint8_t >  Contents,
uint32_t  Characteristics 
)
static

◆ copyPeHeader()

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

Definition at line 175 of file COFFObject.h.

◆ copySymbol()

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

Definition at line 161 of file COFFObject.h.

◆ createGnuDebugLinkSectionContents()

static Expected< std::vector< uint8_t > > llvm::objcopy::coff::createGnuDebugLinkSectionContents ( StringRef  File)
static

◆ dumpSection()

static Error llvm::objcopy::coff::dumpSection ( Object O,
StringRef  SectionName,
StringRef  FileName 
)
static

◆ 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 322 of file COFFObjcopy.cpp.

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

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

◆ flagsToCharacteristics()

static uint32_t llvm::objcopy::coff::flagsToCharacteristics ( SectionFlag  AllFlags,
uint32_t  OldChar 
)
static

◆ getNextRVA()

static uint64_t llvm::objcopy::coff::getNextRVA ( const Object Obj)
static

◆ handleArgs()

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

Definition at line 157 of file COFFObjcopy.cpp.

References addGnuDebugLink(), addSection(), llvm::objcopy::All, llvm::object::coff_section::Characteristics, Config, llvm::createStringError(), dumpSection(), E, llvm::objcopy::File, llvm::find_if(), flagsToCharacteristics(), llvm::objcopy::coff::Object::getMutableSections(), llvm::objcopy::coff::Object::getMutableSymbols(), llvm::objcopy::coff::Section::Header, I, if(), llvm::COFF::IMAGE_SCN_ALIGN_1BYTES, llvm::COFF::IMAGE_SCN_CNT_CODE, llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA, 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::COFFConfig::MinorSubsystemVersion, llvm::object::pe32plus_header::MinorSubsystemVersion, llvm::objcopy::coff::Section::Name, llvm::objcopy::coff::Symbol::Name, llvm::objcopy::coff::Object::PeHeader, llvm::objcopy::coff::Symbol::Referenced, llvm::objcopy::coff::Section::Relocs, llvm::objcopy::coff::Object::removeSections(), llvm::objcopy::coff::Object::removeSymbols(), llvm::objcopy::NewSectionInfo::SectionData, llvm::objcopy::NewSectionInfo::SectionName, llvm::object::coff_symbol< SectionNumberType >::SectionNumber, llvm::object::coff_symbol< SectionNumberType >::StorageClass, llvm::StringRef::str(), llvm::objcopy::COFFConfig::Subsystem, llvm::object::pe32plus_header::Subsystem, llvm::Error::success(), Sym, llvm::objcopy::coff::Symbol::Sym, ToRemove, and llvm::objcopy::coff::Object::truncateSections().

Referenced by executeObjcopyOnBinary().

◆ isDebugSection()

static 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().