summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputSection.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 97ba06a1579..aff57551a8b 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -661,11 +661,9 @@ template <class ELFT> void InputSection::writeTo(uint8_t *Buf) {
return;
}
- // Copy section contents from source object file to output file.
- ArrayRef<uint8_t> Data = this->Data;
+ // Copy section contents from source object file to output file
+ // and then apply relocations.
memcpy(Buf + OutSecOff, Data.data(), Data.size());
-
- // Iterate over all relocation sections that apply to this section.
uint8_t *BufEnd = Buf + OutSecOff + Data.size();
this->relocate<ELFT>(Buf, BufEnd);
}
OpenPOWER on IntegriCloud