[lld] r267847 - Add comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 20:04:15 PDT 2016


Author: ruiu
Date: Wed Apr 27 22:04:15 2016
New Revision: 267847

URL: http://llvm.org/viewvc/llvm-project?rev=267847&view=rev
Log:
Add 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=267847&r1=267846&r2=267847&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Apr 27 22:04:15 2016
@@ -741,6 +741,18 @@ void Writer<ELFT>::scanRelocs(InputSecti
 }
 
 template <class ELFT> void Writer<ELFT>::scanRelocs(InputSection<ELFT> &C) {
+  // Scan all relocations. Each relocation goes through a series
+  // of tests to determine if it needs special treatment, such as
+  // creating GOT, PLT, copy relocations, etc.
+  //
+  // The current code is a bit wasteful because it scans relocations
+  // in non-SHF_ALLOC sections. Such sections are never mapped to
+  // memory at runtime. Debug section is an example. Relocations in
+  // non-alloc sections are much easier to handle because it will
+  // never need complex treatement such as GOT or PLT (because at
+  // runtime no one refers them). We probably should skip non-alloc
+  // sections here and directly handle non-alloc relocations in
+  // writeTo function.
   for (const Elf_Shdr *RelSec : C.RelocSections)
     scanRelocs(C, *RelSec);
 }




More information about the llvm-commits mailing list