ELF: Do not instantiate InputSectionBase::Discarded.
authorRui Ueyama <ruiu@google.com>
Wed, 24 Feb 2016 18:33:35 +0000 (18:33 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 24 Feb 2016 18:33:35 +0000 (18:33 +0000)
commit733153de3cea8a77991448c1a8c59fe3659ce355
tree03b5a20a4add61f95a2efb81a2b7ffc924bdd7cc
parent795dc5a0fbb056f9756c4fee4f05fffffa22bf73
ELF: Do not instantiate InputSectionBase::Discarded.

"Discarded" section is a marker for discarded sections, and we do not
use the instance except for checking its identity. In that sense, it
is just another type of a "null" pointer for InputSectionBase. So,
it doesn't have to be a real instance of InputSectionBase class.

In this patch, we no longer instantiate Discarded section but instead
use -1 as a pointer value. This eliminates a global variable which
needed initialization at startup.

llvm-svn: 261761
lld/ELF/InputFiles.cpp
lld/ELF/InputSection.cpp
lld/ELF/InputSection.h
lld/ELF/MarkLive.cpp
lld/ELF/OutputSections.cpp
lld/ELF/Writer.cpp