summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/Writer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 7799a7030b9..6d9b2509f6b 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -741,6 +741,18 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {
}
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);
}
OpenPOWER on IntegriCloud