summaryrefslogtreecommitdiff
path: root/ELF/OutputSections.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/OutputSections.cpp')
-rw-r--r--ELF/OutputSections.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/ELF/OutputSections.cpp b/ELF/OutputSections.cpp
index 71fc00ac35e72..839f68f2da55e 100644
--- a/ELF/OutputSections.cpp
+++ b/ELF/OutputSections.cpp
@@ -395,14 +395,20 @@ static void reportDiscarded(InputSectionBase *IS) {
void OutputSectionFactory::addInputSec(InputSectionBase *IS,
StringRef OutsecName) {
+ SectionKey Key = createKey(IS, OutsecName);
+ OutputSection *&Sec = Map[Key];
+ return addInputSec(IS, OutsecName, Sec);
+}
+
+void OutputSectionFactory::addInputSec(InputSectionBase *IS,
+ StringRef OutsecName,
+ OutputSection *&Sec) {
if (!IS->Live) {
reportDiscarded(IS);
return;
}
- SectionKey Key = createKey(IS, OutsecName);
uint64_t Flags = getOutFlags(IS);
- OutputSection *&Sec = Map[Key];
if (Sec) {
if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(IS->Flags))
error("incompatible section flags for " + Sec->Name +
@@ -418,7 +424,7 @@ void OutputSectionFactory::addInputSec(InputSectionBase *IS,
}
Sec->Flags |= Flags;
} else {
- Sec = make<OutputSection>(Key.Name, IS->Type, Flags);
+ Sec = make<OutputSection>(OutsecName, IS->Type, Flags);
OutputSections.push_back(Sec);
}