[PATCH] D26199: [ELF] - Implemented threaded --build-id computation

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 11:07:28 PDT 2016


grimar added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:93
+  if (Config->Threads)
+    parallel_for_each(Chunks.begin(), Chunks.end(),
+                      [&](ArrayRef<uint8_t> &Chunk) {
----------------
ruiu wrote:
> You can always call parallel_for_each. If multi-threads are not available, it will fall back to std::for_each.
Why we do that check in 
void OutputSection<ELFT>::writeTo(uint8_t *Buf) then ?

```
  if (Config->Threads) {
    parallel_for_each(Sections.begin(), Sections.end(),
                      [=](InputSection<ELFT> *C) { C->writeTo(Buf); });
  } else {
    for (InputSection<ELFT> *C : Sections)
      C->writeTo(Buf);
  }
```

I was thinking that it is for user to decide, if he/she uses -threads in command line, then threading is used if possible in LLD.
I think that might be helpfull. And also as I mentioned is consistent with OutputSection<ELFT>::writeTo.


https://reviews.llvm.org/D26199





More information about the llvm-commits mailing list