LLVM  14.0.0git
Namespaces | Functions
ArchiveWriter.cpp File Reference
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <unistd.h>
Include dependency graph for ArchiveWriter.cpp:

Go to the source code of this file.

Namespaces

 llvm
 ---------------------— PointerInfo ------------------------------------—
 

Functions

template<typename T >
static void printWithSpacePadding (raw_ostream &OS, T Data, unsigned Size)
 
static bool isDarwin (object::Archive::Kind Kind)
 
static bool isBSDLike (object::Archive::Kind Kind)
 
template<class T >
static void print (raw_ostream &Out, object::Archive::Kind Kind, T Val)
 
static void printRestOfMemberHeader (raw_ostream &Out, const sys::TimePoint< std::chrono::seconds > &ModTime, unsigned UID, unsigned GID, unsigned Perms, uint64_t Size)
 
static void printGNUSmallMemberHeader (raw_ostream &Out, StringRef Name, const sys::TimePoint< std::chrono::seconds > &ModTime, unsigned UID, unsigned GID, unsigned Perms, uint64_t Size)
 
static void printBSDMemberHeader (raw_ostream &Out, uint64_t Pos, StringRef Name, const sys::TimePoint< std::chrono::seconds > &ModTime, unsigned UID, unsigned GID, unsigned Perms, uint64_t Size)
 
static bool useStringTable (bool Thin, StringRef Name)
 
static bool is64BitKind (object::Archive::Kind Kind)
 
static void printMemberHeader (raw_ostream &Out, uint64_t Pos, raw_ostream &StringTable, StringMap< uint64_t > &MemberNames, object::Archive::Kind Kind, bool Thin, const NewArchiveMember &M, sys::TimePoint< std::chrono::seconds > ModTime, uint64_t Size)
 
static MemberData computeStringTable (StringRef Names)
 
static sys::TimePoint< std::chrono::seconds > now (bool Deterministic)
 
static bool isArchiveSymbol (const object::BasicSymbolRef &S)
 
static void printNBits (raw_ostream &Out, object::Archive::Kind Kind, uint64_t Val)
 
static uint64_t computeSymbolTableSize (object::Archive::Kind Kind, uint64_t NumSyms, uint64_t OffsetSize, StringRef StringTable, uint32_t *Padding=nullptr)
 
static void writeSymbolTableHeader (raw_ostream &Out, object::Archive::Kind Kind, bool Deterministic, uint64_t Size)
 
static void writeSymbolTable (raw_ostream &Out, object::Archive::Kind Kind, bool Deterministic, ArrayRef< MemberData > Members, StringRef StringTable)
 
static Expected< std::vector< unsigned > > getSymbols (MemoryBufferRef Buf, raw_ostream &SymNames, bool &HasObject)
 
static Expected< std::vector< MemberData > > computeMemberData (raw_ostream &StringTable, raw_ostream &SymNames, object::Archive::Kind Kind, bool Thin, bool Deterministic, bool NeedSymbols, ArrayRef< NewArchiveMember > NewMembers)
 
static ErrorOr< SmallString< 128 > > llvm::canonicalizePath (StringRef P)
 
Expected< std::string > llvm::computeArchiveRelativePath (StringRef From, StringRef To)
 
static Error llvm::writeArchiveToStream (raw_ostream &Out, ArrayRef< NewArchiveMember > NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin)
 
Error llvm::writeArchive (StringRef ArcName, ArrayRef< NewArchiveMember > NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin, std::unique_ptr< MemoryBuffer > OldArchiveBuf=nullptr)
 
Expected< std::unique_ptr< MemoryBuffer > > llvm::writeArchiveToBuffer (ArrayRef< NewArchiveMember > NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin)
 

Function Documentation

◆ computeMemberData()

static Expected<std::vector<MemberData> > computeMemberData ( raw_ostream StringTable,
raw_ostream SymNames,
object::Archive::Kind  Kind,
bool  Thin,
bool  Deterministic,
bool  NeedSymbols,
ArrayRef< NewArchiveMember NewMembers 
)
static

Definition at line 406 of file ArchiveWriter.cpp.

References isDarwin(), M, and llvm::MipsISD::Ret.

Referenced by llvm::writeArchiveToStream().

◆ computeStringTable()

static MemberData computeStringTable ( StringRef  Names)
static

◆ computeSymbolTableSize()

static uint64_t computeSymbolTableSize ( object::Archive::Kind  Kind,
uint64_t  NumSyms,
uint64_t  OffsetSize,
StringRef  StringTable,
uint32_t Padding = nullptr 
)
static

◆ getSymbols()

static Expected<std::vector<unsigned> > getSymbols ( MemoryBufferRef  Buf,
raw_ostream SymNames,
bool &  HasObject 
)
static

◆ is64BitKind()

static bool is64BitKind ( object::Archive::Kind  Kind)
static

◆ isArchiveSymbol()

static bool isArchiveSymbol ( const object::BasicSymbolRef S)
static

◆ isBSDLike()

static bool isBSDLike ( object::Archive::Kind  Kind)
static

◆ isDarwin()

static bool isDarwin ( object::Archive::Kind  Kind)
static

◆ now()

static sys::TimePoint<std::chrono::seconds> now ( bool  Deterministic)
static

◆ print()

template<class T >
static void print ( raw_ostream Out,
object::Archive::Kind  Kind,
T  Val 
)
static

◆ printBSDMemberHeader()

static void printBSDMemberHeader ( raw_ostream Out,
uint64_t  Pos,
StringRef  Name,
const sys::TimePoint< std::chrono::seconds > &  ModTime,
unsigned  UID,
unsigned  GID,
unsigned  Perms,
uint64_t  Size 
)
static

◆ printGNUSmallMemberHeader()

static void printGNUSmallMemberHeader ( raw_ostream Out,
StringRef  Name,
const sys::TimePoint< std::chrono::seconds > &  ModTime,
unsigned  UID,
unsigned  GID,
unsigned  Perms,
uint64_t  Size 
)
static

◆ printMemberHeader()

static void printMemberHeader ( raw_ostream Out,
uint64_t  Pos,
raw_ostream StringTable,
StringMap< uint64_t > &  MemberNames,
object::Archive::Kind  Kind,
bool  Thin,
const NewArchiveMember M,
sys::TimePoint< std::chrono::seconds >  ModTime,
uint64_t  Size 
)
static

◆ printNBits()

static void printNBits ( raw_ostream Out,
object::Archive::Kind  Kind,
uint64_t  Val 
)
static

Definition at line 281 of file ArchiveWriter.cpp.

References is64BitKind().

Referenced by writeSymbolTable().

◆ printRestOfMemberHeader()

static void printRestOfMemberHeader ( raw_ostream Out,
const sys::TimePoint< std::chrono::seconds > &  ModTime,
unsigned  UID,
unsigned  GID,
unsigned  Perms,
uint64_t  Size 
)
static

◆ printWithSpacePadding()

template<typename T >
static void printWithSpacePadding ( raw_ostream OS,
T  Data,
unsigned  Size 
)
static

◆ useStringTable()

static bool useStringTable ( bool  Thin,
StringRef  Name 
)
static

Definition at line 192 of file ArchiveWriter.cpp.

Referenced by printMemberHeader().

◆ writeSymbolTable()

static void writeSymbolTable ( raw_ostream Out,
object::Archive::Kind  Kind,
bool  Deterministic,
ArrayRef< MemberData >  Members,
StringRef  StringTable 
)
static

◆ writeSymbolTableHeader()

static void writeSymbolTableHeader ( raw_ostream Out,
object::Archive::Kind  Kind,
bool  Deterministic,
uint64_t  Size 
)
static