From 14b7785c093899988a1f23dcbf7edc098fe860d2 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 26 Jan 2022 22:03:26 -0800 Subject: [PATCH] [ELF] Simplify InputSection::writeTo. NFC --- lld/ELF/InputSection.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index e6ce2c3..943cf18 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -1261,9 +1261,8 @@ template void InputSection::writeTo(uint8_t *buf) { // Copy section contents from source object file to output file // and then apply relocations. - memcpy(buf, data().data(), data().size()); - uint8_t *bufEnd = buf + data().size(); - relocate(buf, bufEnd); + memcpy(buf, rawData.data(), rawData.size()); + relocate(buf, buf + rawData.size()); } void InputSection::replace(InputSection *other) { -- 2.7.4