#include "llvm/DWP/DWP.h"
#include "llvm/ADT/Twine.h"
#include "llvm/DWP/DWPError.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
#include "llvm/Object/Decompressor.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MemoryBuffer.h"
#include <limits>
usingnamespacellvm;
usingnamespacellvm::object;
static mc::RegisterMCTargetOptionsFlags MCTargetOptionsFlags;
static uint64_t debugStrOffsetsHeaderSize(DataExtractor StrOffsetsData,
uint16_t DwarfVersion) { … }
static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode) { … }
static Expected<const char *>
getIndexedString(dwarf::Form Form, DataExtractor InfoData, uint64_t &InfoOffset,
StringRef StrOffsets, StringRef Str, uint16_t Version) { … }
static Expected<CompileUnitIdentifiers>
getCUIdentifiers(InfoSectionUnitHeader &Header, StringRef Abbrev,
StringRef Info, StringRef StrOffsets, StringRef Str) { … }
static bool isSupportedSectionKind(DWARFSectionKind Kind) { … }
namespace llvm {
unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion) { … }
}
static unsigned getOnDiskSectionId(unsigned Index) { … }
static StringRef getSubsection(StringRef Section,
const DWARFUnitIndex::Entry &Entry,
DWARFSectionKind Kind) { … }
static Error sectionOverflowErrorOrWarning(uint32_t PrevOffset,
uint32_t OverflowedOffset,
StringRef SectionName,
OnCuIndexOverflow OverflowOptValue,
bool &AnySectionOverflow) { … }
static Error addAllTypesFromDWP(
MCStreamer &Out, MapVector<uint64_t, UnitIndexEntry> &TypeIndexEntries,
const DWARFUnitIndex &TUIndex, MCSection *OutputTypes, StringRef Types,
const UnitIndexEntry &TUEntry, uint32_t &TypesOffset,
unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue,
bool &AnySectionOverflow) { … }
static Error addAllTypesFromTypesSection(
MCStreamer &Out, MapVector<uint64_t, UnitIndexEntry> &TypeIndexEntries,
MCSection *OutputTypes, const std::vector<StringRef> &TypesSections,
const UnitIndexEntry &CUEntry, uint32_t &TypesOffset,
OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow) { … }
static std::string buildDWODescription(StringRef Name, StringRef DWPName,
StringRef DWOName) { … }
static Error createError(StringRef Name, Error E) { … }
static Error
handleCompressedSection(std::deque<SmallString<32>> &UncompressedSections,
SectionRef Sec, StringRef Name, StringRef &Contents) { … }
namespace llvm {
Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info) { … }
static void writeNewOffsetsTo(MCStreamer &Out, DataExtractor &Data,
DenseMap<uint64_t, uint32_t> &OffsetRemapping,
uint64_t &Offset, uint64_t &Size) { … }
void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
MCSection *StrOffsetSection,
StringRef CurStrSection,
StringRef CurStrOffsetSection, uint16_t Version) { … }
enum AccessField { … };
void writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
const AccessField &Field) { … }
void writeIndex(MCStreamer &Out, MCSection *Section,
ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
uint32_t IndexVersion) { … }
Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
const CompileUnitIdentifiers &ID, StringRef DWPName) { … }
Error handleSection(
const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
const MCSection *StrSection, const MCSection *StrOffsetSection,
const MCSection *TypesSection, const MCSection *CUIndexSection,
const MCSection *TUIndexSection, const MCSection *InfoSection,
const SectionRef &Section, MCStreamer &Out,
std::deque<SmallString<32>> &UncompressedSections,
uint32_t (&ContributionOffsets)[8], UnitIndexEntry &CurEntry,
StringRef &CurStrSection, StringRef &CurStrOffsetSection,
std::vector<StringRef> &CurTypesSection,
std::vector<StringRef> &CurInfoSection, StringRef &AbbrevSection,
StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength) { … }
Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
OnCuIndexOverflow OverflowOptValue) { … }
}