@@ -602,8 +602,9 @@ void AtomChunk::applyRelocationsARM(uint8_t *Buffer,
602
602
std::vector<uint64_t > &SectionRVA,
603
603
uint64_t ImageBase) {
604
604
Buffer = Buffer + _fileOffset;
605
- for (const auto *Layout : _atomLayouts) {
606
- const DefinedAtom *Atom = cast<DefinedAtom>(Layout->_atom );
605
+ parallel_for_each (_atomLayouts.begin (), _atomLayouts.end (),
606
+ [&](const AtomLayout *layout) {
607
+ const DefinedAtom *Atom = cast<DefinedAtom>(layout->_atom );
607
608
for (const Reference *R : *Atom) {
608
609
if (R->kindNamespace () != Reference::KindNamespace::COFF)
609
610
continue ;
@@ -614,7 +615,7 @@ void AtomChunk::applyRelocationsARM(uint8_t *Buffer,
614
615
Target->permissions () == DefinedAtom::permRWX;
615
616
616
617
const auto AtomOffset = R->offsetInAtom ();
617
- const auto FileOffset = Layout ->_fileOffset ;
618
+ const auto FileOffset = layout ->_fileOffset ;
618
619
const auto TargetAddr = AtomRVA[R->target ()] | (AssumeTHUMBCode ? 1 : 0 );
619
620
auto RelocSite16 =
620
621
reinterpret_cast <ulittle16_t *>(Buffer + FileOffset + AtomOffset);
@@ -645,15 +646,16 @@ void AtomChunk::applyRelocationsARM(uint8_t *Buffer,
645
646
break ;
646
647
}
647
648
}
648
- }
649
+ });
649
650
}
650
651
651
652
void AtomChunk::applyRelocationsX86 (uint8_t *buffer,
652
653
std::map<const Atom *, uint64_t > &atomRva,
653
654
std::vector<uint64_t > §ionRva,
654
655
uint64_t imageBaseAddress) {
655
656
buffer += _fileOffset;
656
- for (const auto *layout : _atomLayouts) {
657
+ parallel_for_each (_atomLayouts.begin (), _atomLayouts.end (),
658
+ [&](const AtomLayout *layout) {
657
659
const DefinedAtom *atom = cast<DefinedAtom>(layout->_atom );
658
660
for (const Reference *ref : *atom) {
659
661
// Skip if this reference is not for COFF relocation.
@@ -702,15 +704,16 @@ void AtomChunk::applyRelocationsX86(uint8_t *buffer,
702
704
llvm::report_fatal_error (" Unsupported relocation kind" );
703
705
}
704
706
}
705
- }
707
+ });
706
708
}
707
709
708
710
void AtomChunk::applyRelocationsX64 (uint8_t *buffer,
709
711
std::map<const Atom *, uint64_t > &atomRva,
710
712
std::vector<uint64_t > §ionRva,
711
713
uint64_t imageBase) {
712
714
buffer += _fileOffset;
713
- for (const auto *layout : _atomLayouts) {
715
+ parallel_for_each (_atomLayouts.begin (), _atomLayouts.end (),
716
+ [&](const AtomLayout *layout) {
714
717
const DefinedAtom *atom = cast<DefinedAtom>(layout->_atom );
715
718
for (const Reference *ref : *atom) {
716
719
if (ref->kindNamespace () != Reference::KindNamespace::COFF)
@@ -762,7 +765,7 @@ void AtomChunk::applyRelocationsX64(uint8_t *buffer,
762
765
llvm::report_fatal_error (" Unsupported relocation kind" );
763
766
}
764
767
}
765
- }
768
+ });
766
769
}
767
770
768
771
// / Print atom VAs. Used only for debugging.
0 commit comments