diff options
-rw-r--r-- | lld/ELF/ELFCreator.cpp | 5 | ||||
-rw-r--r-- | lld/ELF/InputFiles.cpp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lld/ELF/ELFCreator.cpp b/lld/ELF/ELFCreator.cpp index 37b7392be06..43aa4ac8729 100644 --- a/lld/ELF/ELFCreator.cpp +++ b/lld/ELF/ELFCreator.cpp @@ -6,6 +6,11 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file contains a class to create an ELF file in memory. This is +// supposed to be used for "-format binary" option. +// +//===----------------------------------------------------------------------===// #include "ELFCreator.h" diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 622dec531e6..e73ac7f1a32 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -733,6 +733,8 @@ static std::unique_ptr<InputFile> createELFFile(MemoryBufferRef MB) { } template <class ELFT> std::unique_ptr<InputFile> BinaryFile::createELF() { + // Wrap the binary blob with an ELF header and footer + // so that we can link it as a regular ELF file. ELFCreator<ELFT> ELF(ET_REL, Config->EMachine); auto DataSec = ELF.addSection(".data"); DataSec.Header->sh_flags = SHF_ALLOC; |