[lld] r345062 - Add a comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 10:52:45 PDT 2018


Author: ruiu
Date: Tue Oct 23 10:52:44 2018
New Revision: 345062

URL: http://llvm.org/viewvc/llvm-project?rev=345062&view=rev
Log:
Add a comment.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=345062&r1=345061&r2=345062&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 23 10:52:44 2018
@@ -1756,9 +1756,13 @@ template <class ELFT> void Writer<ELFT>:
   // program to fail to link due to relocation overflow, if their
   // program text is above 2 GiB. We use the address of the .text
   // section instead to prevent that failure.
+  //
+  // In a rare sitaution, .text section may not exist. If that's the
+  // case, use the image base address as a last resort.
   OutputSection *Default = findSection(".text");
   if (!Default)
     Default = Out::ElfHeader;
+
   auto Define = [=](StringRef Start, StringRef End, OutputSection *OS) {
     if (OS) {
       addOptionalRegular(Start, OS, 0);




More information about the llvm-commits mailing list