[PATCH] D25627: [ELF] Convert linker generated sections to input sections

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 14:48:20 PDT 2016


ruiu added inline comments.


================
Comment at: ELF/InputSection.cpp:863
+  memcpy(Buf.data() + 12, "GNU", 4);           // Name string
+  this->Data = ArrayRef<uint8_t>(Buf);
+}
----------------
Here, you fill the internal buffer with data, which to be memcpy'ed to the final output buffer. I think we don't want to do that. Instead, we want to virtualize InputFile's `writeTo` so that each input section will directly write to the output buffer.


================
Comment at: ELF/InputSection.h:254-255
 
+  // Location of this section in the output buffer
+  uint8_t *OutputLoc = nullptr;
+
----------------
This field is very specific to build-id, which needs to back-fill the buildid value after we get a complete output file. No other sections should need them, and that's a good thing because it keeps most sections being agnostic where they are written. So I'd move this to BuildIdSection, as it used to be.


https://reviews.llvm.org/D25627





More information about the llvm-commits mailing list