std::vector<uint64_t> &SectionRVA,
uint64_t ImageBase) {
Buffer = Buffer + _fileOffset;
- for (const auto *Layout : _atomLayouts) {
- const DefinedAtom *Atom = cast<DefinedAtom>(Layout->_atom);
+ parallel_for_each(_atomLayouts.begin(), _atomLayouts.end(),
+ [&](const AtomLayout *layout) {
+ const DefinedAtom *Atom = cast<DefinedAtom>(layout->_atom);
for (const Reference *R : *Atom) {
if (R->kindNamespace() != Reference::KindNamespace::COFF)
continue;
Target->permissions() == DefinedAtom::permRWX;
const auto AtomOffset = R->offsetInAtom();
- const auto FileOffset = Layout->_fileOffset;
+ const auto FileOffset = layout->_fileOffset;
const auto TargetAddr = AtomRVA[R->target()] | (AssumeTHUMBCode ? 1 : 0);
auto RelocSite16 =
reinterpret_cast<ulittle16_t *>(Buffer + FileOffset + AtomOffset);
break;
}
}
- }
+ });
}
void AtomChunk::applyRelocationsX86(uint8_t *buffer,
std::vector<uint64_t> §ionRva,
uint64_t imageBaseAddress) {
buffer += _fileOffset;
- for (const auto *layout : _atomLayouts) {
+ parallel_for_each(_atomLayouts.begin(), _atomLayouts.end(),
+ [&](const AtomLayout *layout) {
const DefinedAtom *atom = cast<DefinedAtom>(layout->_atom);
for (const Reference *ref : *atom) {
// Skip if this reference is not for COFF relocation.
llvm::report_fatal_error("Unsupported relocation kind");
}
}
- }
+ });
}
void AtomChunk::applyRelocationsX64(uint8_t *buffer,
std::vector<uint64_t> §ionRva,
uint64_t imageBase) {
buffer += _fileOffset;
- for (const auto *layout : _atomLayouts) {
+ parallel_for_each(_atomLayouts.begin(), _atomLayouts.end(),
+ [&](const AtomLayout *layout) {
const DefinedAtom *atom = cast<DefinedAtom>(layout->_atom);
for (const Reference *ref : *atom) {
if (ref->kindNamespace() != Reference::KindNamespace::COFF)
llvm::report_fatal_error("Unsupported relocation kind");
}
}
- }
+ });
}
/// Print atom VAs. Used only for debugging.