21using namespace object;
37 return Sec.
Name ==
"producers";
43 if (Sec.
Name == SecName) {
49 std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufferOrErr);
50 std::copy(Contents.
begin(), Contents.
end(), Buf->getBufferStart());
51 if (
Error E = Buf->commit())
57 SecName.
str().c_str());
64 if (!
Config.ToRemove.empty()) {
66 return Config.ToRemove.matches(Sec.Name);
71 RemovePred = [RemovePred](
const Section &Sec) {
77 RemovePred = [RemovePred](
const Section &Sec) {
83 if (
Config.OnlyKeepDebug) {
91 if (!
Config.OnlySection.empty()) {
95 return !
Config.OnlySection.matches(Sec.Name);
99 if (!
Config.KeepSection.empty()) {
102 if (
Config.KeepSection.matches(Sec.Name))
105 return RemovePred(Sec);
117 std::tie(SecName, FileName) = Flag.split(
"=");
133 InputData, NewSection.
SectionData->getBufferIdentifier());
135 reinterpret_cast<const uint8_t *
>(BufferCopy->getBufferStart()),
136 BufferCopy->getBufferSize());
151 assert(Obj &&
"Unable to deserialize Wasm object");
154 Writer TheWriter(*Obj, Out);
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
static Expected< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Expected< std::unique_ptr< Object > > create() const
This class implements an extremely fast bulk output stream that can only output to a stream.
static bool isCommentSection(const Section &Sec)
static void removeSections(const CommonConfig &Config, Object &Obj)
static Error dumpSectionToFile(StringRef SecName, StringRef Filename, Object &Obj)
static Error handleArgs(const CommonConfig &Config, Object &Obj)
static bool isDebugSection(const Section &Sec)
std::function< bool(const Section &Sec)> SectionPred
static bool isNameSection(const Section &Sec)
static bool isLinkerSection(const Section &Sec)
Error executeObjcopyOnBinary(const CommonConfig &Config, const WasmConfig &, object::WasmObjectFile &In, raw_ostream &Out)
Apply the transformations described by Config and WasmConfig to In and writes the result into Out.
This is an optimization pass for GlobalISel generic memory operations.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
std::shared_ptr< MemoryBuffer > SectionData
std::vector< Section > Sections
void addSectionWithOwnedContents(Section NewSection, std::unique_ptr< MemoryBuffer > &&Content)
void removeSections(function_ref< bool(const Section &)> ToRemove)
ArrayRef< uint8_t > Contents