diff options
author | Tom Stellard <tstellar@redhat.com> | 2019-05-15 18:43:15 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2019-05-15 18:43:15 +0000 |
commit | 0eebd31dff806031041214f0121bc2d6d5deb6a6 (patch) | |
tree | 11732fce048627726bd237b35ff3442fbf0a5199 | |
parent | d9ccd0db27889cbd016637c06290ffaa13faaf70 (diff) | |
download | llvm-0eebd31dff806031041214f0121bc2d6d5deb6a6.zip llvm-0eebd31dff806031041214f0121bc2d6d5deb6a6.tar.gz llvm-0eebd31dff806031041214f0121bc2d6d5deb6a6.tar.bz2 |
Merging r358547:
------------------------------------------------------------------------
r358547 | ruiu | 2019-04-16 19:12:47 -0700 (Tue, 16 Apr 2019) | 9 lines
Fix a crash bug caused by a nested call of parallelForEach.
parallelForEach is not reentrant. We use parallelForEach to call
each section's writeTo(), so calling the same function within writeTo()
is not safe.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41508
Differential Revision: https://reviews.llvm.org/D60757
------------------------------------------------------------------------
llvm-svn: 360791
-rw-r--r-- | lld/wasm/OutputSections.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp index 4123d63..6b7b18d 100644 --- a/lld/wasm/OutputSections.cpp +++ b/lld/wasm/OutputSections.cpp @@ -111,8 +111,8 @@ void CodeSection::writeTo(uint8_t *Buf) { memcpy(Buf, CodeSectionHeader.data(), CodeSectionHeader.size()); // Write code section bodies - parallelForEach(Functions, - [&](const InputChunk *Chunk) { Chunk->writeTo(Buf); }); + for (const InputChunk *Chunk : Functions) + Chunk->writeTo(Buf); } uint32_t CodeSection::numRelocations() const { @@ -176,7 +176,7 @@ void DataSection::writeTo(uint8_t *Buf) { // Write data section headers memcpy(Buf, DataSectionHeader.data(), DataSectionHeader.size()); - parallelForEach(Segments, [&](const OutputSegment *Segment) { + for (const OutputSegment *Segment : Segments) { // Write data segment header uint8_t *SegStart = Buf + Segment->SectionOffset; memcpy(SegStart, Segment->Header.data(), Segment->Header.size()); @@ -184,7 +184,7 @@ void DataSection::writeTo(uint8_t *Buf) { // Write segment data payload for (const InputChunk *Chunk : Segment->InputSegments) Chunk->writeTo(Buf); - }); + } } uint32_t DataSection::numRelocations() const { @@ -232,8 +232,8 @@ void CustomSection::writeTo(uint8_t *Buf) { Buf += NameData.size(); // Write custom sections payload - parallelForEach(InputSections, - [&](const InputSection *Section) { Section->writeTo(Buf); }); + for (const InputSection *Section : InputSections) + Section->writeTo(Buf); } uint32_t CustomSection::numRelocations() const { |