summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-04-28 03:04:15 +0000
committerRui Ueyama <ruiu@google.com>2016-04-28 03:04:15 +0000
commite5c1ec47164b2e4bd812118a24ec76c95a577515 (patch)
tree457f5956e903828b16115e8c82605bebd0189566 /lld/ELF/Writer.cpp
parent01d07dbee57b76d0e250e5dc276e0dd378d123d3 (diff)
downloadbcm5719-llvm-e5c1ec47164b2e4bd812118a24ec76c95a577515.tar.gz
bcm5719-llvm-e5c1ec47164b2e4bd812118a24ec76c95a577515.zip
Add comment.
llvm-svn: 267847
Diffstat (limited to 'lld/ELF/Writer.cpp')
-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