9#ifndef LLVM_LIB_OBJCOPY_COFF_COFFOBJECT_H
10#define LLVM_LIB_OBJCOPY_COFF_COFFOBJECT_H
43 if (!OwnedContents.empty())
49 OwnedContents.clear();
55 OwnedContents = std::move(
Data);
61 OwnedContents.clear();
66 std::vector<uint8_t> OwnedContents;
72 std::copy(In.begin(), In.end(),
Opaque);
113 return make_range(Symbols.begin(), Symbols.end());
129 return make_range(Sections.begin(), Sections.end());
139 std::vector<Symbol> Symbols;
142 size_t NextSymbolUniqueId = 0;
144 std::vector<Section> Sections;
147 ssize_t NextSectionUniqueId = 1;
150 void updateSymbols();
153 void updateSections();
160template <
class Symbol1Ty,
class Symbol2Ty>
162 static_assert(
sizeof(Dest.Name.ShortName) ==
sizeof(Src.Name.ShortName),
163 "Mismatched name sizes");
164 memcpy(Dest.Name.ShortName, Src.Name.ShortName,
sizeof(Dest.Name.ShortName));
165 Dest.Value = Src.Value;
166 Dest.SectionNumber = Src.SectionNumber;
167 Dest.Type = Src.Type;
168 Dest.StorageClass = Src.StorageClass;
169 Dest.NumberOfAuxSymbols = Src.NumberOfAuxSymbols;
174template <
class PeHeader1Ty,
class PeHeader2Ty>
176 Dest.Magic = Src.Magic;
177 Dest.MajorLinkerVersion = Src.MajorLinkerVersion;
178 Dest.MinorLinkerVersion = Src.MinorLinkerVersion;
179 Dest.SizeOfCode = Src.SizeOfCode;
180 Dest.SizeOfInitializedData = Src.SizeOfInitializedData;
181 Dest.SizeOfUninitializedData = Src.SizeOfUninitializedData;
182 Dest.AddressOfEntryPoint = Src.AddressOfEntryPoint;
183 Dest.BaseOfCode = Src.BaseOfCode;
184 Dest.ImageBase = Src.ImageBase;
185 Dest.SectionAlignment = Src.SectionAlignment;
186 Dest.FileAlignment = Src.FileAlignment;
187 Dest.MajorOperatingSystemVersion = Src.MajorOperatingSystemVersion;
188 Dest.MinorOperatingSystemVersion = Src.MinorOperatingSystemVersion;
189 Dest.MajorImageVersion = Src.MajorImageVersion;
190 Dest.MinorImageVersion = Src.MinorImageVersion;
191 Dest.MajorSubsystemVersion = Src.MajorSubsystemVersion;
192 Dest.MinorSubsystemVersion = Src.MinorSubsystemVersion;
193 Dest.Win32VersionValue = Src.Win32VersionValue;
194 Dest.SizeOfImage = Src.SizeOfImage;
195 Dest.SizeOfHeaders = Src.SizeOfHeaders;
196 Dest.CheckSum = Src.CheckSum;
197 Dest.Subsystem = Src.Subsystem;
198 Dest.DLLCharacteristics = Src.DLLCharacteristics;
199 Dest.SizeOfStackReserve = Src.SizeOfStackReserve;
200 Dest.SizeOfStackCommit = Src.SizeOfStackCommit;
201 Dest.SizeOfHeapReserve = Src.SizeOfHeapReserve;
202 Dest.SizeOfHeapCommit = Src.SizeOfHeapCommit;
203 Dest.LoaderFlags = Src.LoaderFlags;
204 Dest.NumberOfRvaAndSize = Src.NumberOfRvaAndSize;
ReachingDefAnalysis InstSet & ToRemove
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
void copySymbol(Symbol1Ty &Dest, const Symbol2Ty &Src)
void copyPeHeader(PeHeader1Ty &Dest, const PeHeader2Ty &Src)
coff_symbol< support::ulittle16_t > coff_symbol16
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
AuxSymbol(ArrayRef< uint8_t > In)
uint8_t Opaque[sizeof(object::coff_symbol16)]
ArrayRef< uint8_t > getRef() const
ArrayRef< Symbol > getSymbols() const
ArrayRef< uint8_t > DosStub
iterator_range< std::vector< Symbol >::iterator > getMutableSymbols()
object::coff_file_header CoffFileHeader
void truncateSections(function_ref< bool(const Section &)> ToTruncate)
const Symbol * findSymbol(size_t UniqueId) const
std::vector< object::data_directory > DataDirectories
const Section * findSection(ssize_t UniqueId) const
void addSections(ArrayRef< Section > NewSections)
object::pe32plus_header PeHeader
void removeSections(function_ref< bool(const Section &)> ToRemove)
iterator_range< std::vector< Section >::iterator > getMutableSections()
object::dos_header DosHeader
ArrayRef< Section > getSections() const
void addSymbols(ArrayRef< Symbol > NewSymbols)
Error removeSymbols(function_ref< Expected< bool >(const Symbol &)> ToRemove)
object::coff_relocation Reloc
Relocation(const object::coff_relocation &R)
void setOwnedContents(std::vector< uint8_t > &&Data)
object::coff_section Header
std::vector< Relocation > Relocs
void setContentsRef(ArrayRef< uint8_t > Data)
ArrayRef< uint8_t > getContents() const
object::coff_symbol32 Sym
std::optional< size_t > WeakTargetSymbolId
ssize_t AssociativeComdatTargetSectionId
std::vector< AuxSymbol > AuxData
support::ulittle32_t SizeOfRawData