From 29d8639732bc367aab862529779c70e43e463d0c Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 23 Oct 2018 17:52:44 +0000 Subject: [PATCH] Add a comment. llvm-svn: 345062 --- lld/ELF/Writer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index d761418..9b788fe 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1756,9 +1756,13 @@ template void Writer::addStartEndSymbols() { // 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); -- 2.7.4