diff options
| -rw-r--r-- | lld/wasm/InputChunks.cpp | 18 | 
1 files changed, 9 insertions, 9 deletions
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp index 931e1e37b04..272cd03c98d 100644 --- a/lld/wasm/InputChunks.cpp +++ b/lld/wasm/InputChunks.cpp @@ -78,19 +78,19 @@ static void applyRelocation(uint8_t *Buf, const OutputRelocation &Reloc) {    }  } -static void applyRelocations(uint8_t *Buf, ArrayRef<OutputRelocation> Relocs) { -  if (!Relocs.size()) +// Copy this input chunk to an mmap'ed output file. +void InputChunk::writeTo(uint8_t *Buf) const { +  // Copy contents +  memcpy(Buf + getOutputOffset(), data().data(), data().size()); + +  // Apply relocations +  if (OutRelocations.empty())      return; -  DEBUG(dbgs() << "applyRelocations: count=" << Relocs.size() << "\n"); -  for (const OutputRelocation &Reloc : Relocs) +  DEBUG(dbgs() << "applyRelocations: count=" << OutRelocations.size() << "\n"); +  for (const OutputRelocation &Reloc : OutRelocations)      applyRelocation(Buf, Reloc);  } -void InputChunk::writeTo(uint8_t *SectionStart) const { -  memcpy(SectionStart + getOutputOffset(), data().data(), data().size()); -  applyRelocations(SectionStart, OutRelocations); -} -  // Populate OutRelocations based on the input relocations and offset within the  // output section.  Calculates the updated index and offset for each relocation  // as well as the value to write out in the final binary.  | 

