[lld] 14b7785 - [ELF] Simplify InputSection::writeTo. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 22:03:32 PST 2022


Author: Fangrui Song
Date: 2022-01-26T22:03:26-08:00
New Revision: 14b7785c093899988a1f23dcbf7edc098fe860d2

URL: https://github.com/llvm/llvm-project/commit/14b7785c093899988a1f23dcbf7edc098fe860d2
DIFF: https://github.com/llvm/llvm-project/commit/14b7785c093899988a1f23dcbf7edc098fe860d2.diff

LOG: [ELF] Simplify InputSection::writeTo. NFC

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index e6ce2c399ac9d..943cf18e6cf05 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1261,9 +1261,8 @@ template <class ELFT> 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<ELFT>(buf, bufEnd);
+  memcpy(buf, rawData.data(), rawData.size());
+  relocate<ELFT>(buf, buf + rawData.size());
 }
 
 void InputSection::replace(InputSection *other) {


        


More information about the llvm-commits mailing list