std::vector<const coff_symbol *> &symbols,
std::vector<COFFDefinedFileAtom *> &atoms);
- error_code AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
- std::vector<const DefinedAtom *> &definedAtoms);
+ error_code
+ AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
+ std::vector<const DefinedAtom *> &definedAtoms);
error_code findAtomAt(const coff_section *section, uint32_t targetAddress,
COFFDefinedFileAtom *&result, uint32_t &offsetInAtom);
error_code getAtomBySymbolIndex(uint32_t index, Atom *&ret);
- error_code addRelocationReference(const coff_relocation *rel,
- const coff_section *section,
- const std::vector<COFFDefinedFileAtom *> &atoms);
+ error_code
+ addRelocationReference(const coff_relocation *rel,
+ const coff_section *section,
+ const std::vector<COFFDefinedFileAtom *> &atoms);
error_code getSectionContents(StringRef sectionName,
ArrayRef<uint8_t> &result);
std::map<const coff_symbol *, const coff_symbol *> _auxSymbol;
// A map from section to its atoms.
- std::map<const coff_section *, std::vector<COFFDefinedFileAtom *> > _sectionAtoms;
+ std::map<const coff_section *, std::vector<COFFDefinedFileAtom *>>
+ _sectionAtoms;
// A set of COMDAT sections.
std::set<const coff_section *> _comdatSections;
return ec;
_auxSymbol[sym] = aux;
}
- next:
- i += sym->NumberOfAuxSymbols;
+ next:
+ i += sym->NumberOfAuxSymbols;
}
return error_code();
}
/// Create atoms for the defined symbols. This pass is a bit complicated than
/// the other two, because in order to create the atom for the defined symbol
/// we need to know the adjacent symbols.
-error_code FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
- std::vector<const DefinedAtom *> &result) {
+error_code
+FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
+ std::vector<const DefinedAtom *> &result) {
// A defined atom can be merged if its section attribute allows its contents
// to be merged. In COFF, it's not very easy to get the section attribute
// for the symbol, so scan all sections in advance and cache the attributes
/// Atomize \p symbols and append the results to \p atoms. The symbols are
/// assumed to have been defined in the \p section.
-error_code
-FileCOFF::AtomizeDefinedSymbolsInSection(const coff_section *section,
- std::vector<const coff_symbol *> &symbols,
- std::vector<COFFDefinedFileAtom *> &atoms) {
+error_code FileCOFF::AtomizeDefinedSymbolsInSection(
+ const coff_section *section, std::vector<const coff_symbol *> &symbols,
+ std::vector<COFFDefinedFileAtom *> &atoms) {
// Sort symbols by position.
std::stable_sort(
symbols.begin(), symbols.end(),
// For some reason MSVC fails to allow the lambda in this context with a
// "illegal use of local type in type instantiation". MSVC is clearly
// wrong here. Force a conversion to function pointer to work around.
- static_cast<bool (*)(const coff_symbol *, const coff_symbol *)>([](
- const coff_symbol * a,
- const coff_symbol * b)->bool { return a->Value < b->Value; }));
+ static_cast<bool (*)(const coff_symbol *, const coff_symbol *)>(
+ [](const coff_symbol *a, const coff_symbol *b)
+ -> bool { return a->Value < b->Value; }));
StringRef sectionName;
if (error_code ec = _obj->getSectionName(section, sectionName))
return error_code();
}
-error_code
-FileCOFF::AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
- std::vector<const DefinedAtom *> &definedAtoms) {
+error_code FileCOFF::AtomizeDefinedSymbols(
+ SectionToSymbolsT &definedSymbols,
+ std::vector<const DefinedAtom *> &definedAtoms) {
// For each section, make atoms for all the symbols defined in the
// section, and append the atoms to the result objects.
for (auto &i : definedSymbols) {
/// Add relocation information to an atom based on \p rel. \p rel is an
/// relocation entry for the \p section, and \p atoms are all the atoms
/// defined in the \p section.
-error_code
-FileCOFF::addRelocationReference(const coff_relocation *rel,
- const coff_section *section,
- const std::vector<COFFDefinedFileAtom *> &atoms) {
+error_code FileCOFF::addRelocationReference(
+ const coff_relocation *rel, const coff_section *section,
+ const std::vector<COFFDefinedFileAtom *> &atoms) {
assert(atoms.size() > 0);
// The address of the item which relocation is applied. Section's
// VirtualAddress needs to be added for historical reasons, but the value
return ec;
atom->addReference(std::unique_ptr<COFFReference>(
new COFFReference(targetAtom, offsetInAtom, rel->Type,
- Reference::KindNamespace::COFF,
- _referenceArch)));
+ Reference::KindNamespace::COFF, _referenceArch)));
return error_code();
}
size_t e = array.size();
while (len < e && array[len] != '\0')
++len;
- std::string *contents = new (_alloc)
- std::string(reinterpret_cast<const char *>(&array[0]), len);
+ std::string *contents =
+ new (_alloc) std::string(reinterpret_cast<const char *>(&array[0]), len);
return StringRef(*contents).trim();
}
error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
- std::vector<std::unique_ptr<File> > &result) const override {
+ std::vector<std::unique_ptr<File>> &result) const override {
// Convert RC file to COFF
ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
if (error_code ec = coffPath.getError())
error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®istry,
- std::vector<std::unique_ptr<File> > &result) const override {
+ std::vector<std::unique_ptr<File>> &result) const override {
// Parse the memory buffer as PECOFF file.
const char *mbName = mb->getBufferIdentifier();
error_code ec;
using namespace llvm::COFF;
const Registry::KindStrings kindStringsI386[] = {
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_ABSOLUTE),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR16),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL16),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32NB),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SEG12),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECTION),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_TOKEN),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL7),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32),
- LLD_KIND_STRING_END
-};
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_ABSOLUTE),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR16),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL16),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32NB),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SEG12),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECTION),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_TOKEN),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL7),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32),
+ LLD_KIND_STRING_END};
const Registry::KindStrings kindStringsAMD64[] = {
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ABSOLUTE),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR64),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32NB),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_1),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_2),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_3),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_4),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_5),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECTION),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL7),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_TOKEN),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SREL32),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_PAIR),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32),
- LLD_KIND_STRING_END
-};
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ABSOLUTE),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR64),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32NB),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_1),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_2),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_3),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_4),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_5),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECTION),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL7),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_TOKEN),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SREL32),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_PAIR),
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32),
+ LLD_KIND_STRING_END};
} // end namespace anonymous