}
template <class ELFT>
-std::vector<std::unique_ptr<OutputSectionBase<ELFT>>>
+std::vector<OutputSectionBase<ELFT> *>
LinkerScript<ELFT>::createSections(OutputSectionFactory<ELFT> &Factory) {
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Result;
+ std::vector<OutputSectionBase<ELFT> *> Result;
+
// Add input section to output section. If there is no output section yet,
// then create it and add to output section list.
auto AddInputSec = [&](InputSectionBase<ELFT> *C, StringRef Name) {
bool IsNew;
std::tie(Sec, IsNew) = Factory.create(C, Name);
if (IsNew)
- Result.emplace_back(Sec);
+ Result.push_back(Sec);
Sec->addSection(C);
};
public:
typedef PhdrEntry<ELFT> Phdr;
+ std::vector<OutputSectionBase<ELFT> *>
+ createSections(OutputSectionFactory<ELFT> &Factory);
+
StringRef getOutputSection(InputSectionBase<ELFT> *S);
ArrayRef<uint8_t> getFiller(StringRef Name);
bool isDiscarded(InputSectionBase<ELFT> *S);
bool shouldKeep(InputSectionBase<ELFT> *S);
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>>
- createSections(OutputSectionFactory<ELFT> &Factory);
void assignAddresses(ArrayRef<OutputSectionBase<ELFT> *> S);
int compareSections(StringRef A, StringRef B);
void addScriptedSymbols();
Sec = new MipsOptionsOutputSection<ELFT>();
break;
}
+ OwningSections.emplace_back(Sec);
return {Sec, true};
}
Key createKey(InputSectionBase<ELFT> *C, StringRef OutsecName);
llvm::SmallDenseMap<Key, OutputSectionBase<ELFT> *> Map;
+ std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> OwningSections;
};
template <class ELFT> BuildIdSection<ELFT> *Out<ELFT>::BuildId;
void copyLocalSymbols();
void addReservedSymbols();
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> createSections();
+ std::vector<OutputSectionBase<ELFT> *> createSections();
void finalizeSections();
void addPredefinedSections();
bool needsGot();
copyLocalSymbols();
addReservedSymbols();
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Sections =
- ScriptConfig->DoLayout ? Script<ELFT>::X->createSections(Factory)
- : createSections();
-
- for (std::unique_ptr<OutputSectionBase<ELFT>> &S : Sections)
- OutputSections.push_back(S.get());
-
+ OutputSections = ScriptConfig->DoLayout
+ ? Script<ELFT>::X->createSections(Factory)
+ : createSections();
finalizeSections();
if (HasError)
return;
}
template <class ELFT>
-std::vector<std::unique_ptr<OutputSectionBase<ELFT>>>
-Writer<ELFT>::createSections() {
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Result;
+std::vector<OutputSectionBase<ELFT> *> Writer<ELFT>::createSections() {
+ std::vector<OutputSectionBase<ELFT> *> Result;
for (const std::unique_ptr<elf::ObjectFile<ELFT>> &F :
Symtab.getObjectFiles()) {
bool IsNew;
std::tie(Sec, IsNew) = Factory.create(C, getOutputSectionName(C));
if (IsNew)
- Result.emplace_back(Sec);
-
+ Result.push_back(Sec);
Sec->addSection(C);
}
}