ELF: Introduce a separate bit for tracking whether an output section has ever had an input section added to it. NFCI.

We currently (ab)use the Live bit on output sections to track whether
the section has ever had an input section added to it, and then later
use it during orphan placement. This will conflict with one of my upcoming
partition-related changes that will assign all output sections to a partition
(thus marking them as live) so that they can be added to the correct segment
by the code that creates program headers.

Instead of using the Live bit for this purpose, create a new flag and
start using it to track the property explicitly.

Differential Revision: https://reviews.llvm.org/D62348

llvm-svn: 362444
This commit is contained in:
Peter Collingbourne
2019-06-03 20:14:25 +00:00
parent dd0adae65a
commit 06f3b094e4
4 changed files with 17 additions and 11 deletions

View File

@@ -889,10 +889,9 @@ void LinkerScript::adjustSectionsBeforeSorting() {
Sec->Alignment =
std::max<uint32_t>(Sec->Alignment, Sec->AlignExpr().getValue());
// A live output section means that some input section was added to it. It
// might have been removed (if it was empty synthetic section), but we at
// least know the flags.
if (Sec->isLive())
// The input section might have been removed (if it was an empty synthetic
// section), but we at least know the flags.
if (Sec->HasInputSections)
Flags = Sec->Flags;
// We do not want to keep any special flags for output section