#include "llvm/ObjCopy/ObjCopy.h"
#include "llvm/ObjCopy/ConfigManager.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/ObjectYAML/yaml2obj.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
usingnamespacellvm;
usingnamespaceobject;
usingnamespaceobjcopy;
usingnamespaceyaml;
const char *SimpleFileCOFFYAML = …;
const char *SimpleFileELFYAML = …;
const char *SimpleFileMachOYAML = …;
const char *SimpleFileWasmYAML = …;
Expected<std::unique_ptr<ObjectFile>> createObjectFileFromYamlDescription(
const char *YamlCreationString, SmallVector<char> &Storage,
function_ref<bool(const Binary &File)> IsValidFormat) { … }
Expected<std::unique_ptr<Binary>>
callObjCopy(ConfigManager &Config, object::Binary &In,
SmallVector<char> &DataVector,
function_ref<bool(const Binary &File)> IsValidFormat) { … }
bool hasSection(ObjectFile &File, StringRef SectionName) { … }
void checkSectionData(ObjectFile &File, StringRef SectionName,
StringRef SectionData) { … }
void copySimpleInMemoryFileImpl(
const char *YamlCreationString,
function_ref<bool(const Binary &File)> IsValidFormat) { … }
TEST(CopySimpleInMemoryFile, COFF) { … }
TEST(CopySimpleInMemoryFile, ELF) { … }
TEST(CopySimpleInMemoryFile, MachO) { … }
TEST(CopySimpleInMemoryFile, Wasm) { … }
enum Action : uint8_t { … };
void addOrUpdateSectionToFileImpl(
const char *YamlCreationString,
function_ref<bool(const Binary &File)> IsValidFormat,
StringRef NewSectionName, StringRef NewSectionData, Action SectionAction) { … }
TEST(AddSection, COFF) { … }
TEST(AddSection, ELF) { … }
TEST(AddSection, MachO) { … }
TEST(AddSection, Wasm) { … }
TEST(UpdateSection, COFF) { … }
TEST(UpdateSection, ELF) { … }
TEST(UpdateSection, MachO) { … }
void removeSectionByPatternImpl(
const char *YamlCreationString,
function_ref<bool(const Binary &File)> IsValidFormat,
StringRef SectionWildcard, StringRef SectionName) { … }
TEST(RemoveSectionByPattern, COFF) { … }
TEST(RemoveSectionByPattern, ELF) { … }
TEST(RemoveSectionByPattern, MachO) { … }
TEST(RemoveSectionByPattern, Wasm) { … }