mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 17:45:07 +08:00
Remove Out::Pool and use make() instead.
llvm-svn: 285763
This commit is contained in:
@@ -543,8 +543,7 @@ template <class ELFT> void LinkerScript<ELFT>::adjustSectionsBeforeSorting() {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto *OutSec = new OutputSection<ELFT>(Cmd->Name, Type, Flags);
|
||||
Out<ELFT>::Pool.emplace_back(OutSec);
|
||||
auto *OutSec = make<OutputSection<ELFT>>(Cmd->Name, Type, Flags);
|
||||
OutputSections->push_back(OutSec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
#include "OutputSections.h"
|
||||
#include "Config.h"
|
||||
#include "EhFrame.h"
|
||||
#include "LinkerScript.h"
|
||||
#include "GdbIndex.h"
|
||||
#include "LinkerScript.h"
|
||||
#include "Memory.h"
|
||||
#include "Strings.h"
|
||||
#include "SymbolTable.h"
|
||||
#include "Target.h"
|
||||
@@ -1881,24 +1882,23 @@ OutputSectionFactory<ELFT>::create(const SectionKey<ELFT::Is64Bits> &Key,
|
||||
uint32_t Type = C->Type;
|
||||
switch (C->kind()) {
|
||||
case InputSectionBase<ELFT>::Regular:
|
||||
Sec = new OutputSection<ELFT>(Key.Name, Type, Flags);
|
||||
Sec = make<OutputSection<ELFT>>(Key.Name, Type, Flags);
|
||||
break;
|
||||
case InputSectionBase<ELFT>::EHFrame:
|
||||
return {Out<ELFT>::EhFrame, false};
|
||||
case InputSectionBase<ELFT>::Merge:
|
||||
Sec = new MergeOutputSection<ELFT>(Key.Name, Type, Flags, Key.Alignment);
|
||||
Sec = make<MergeOutputSection<ELFT>>(Key.Name, Type, Flags, Key.Alignment);
|
||||
break;
|
||||
case InputSectionBase<ELFT>::MipsReginfo:
|
||||
Sec = new MipsReginfoOutputSection<ELFT>();
|
||||
Sec = make<MipsReginfoOutputSection<ELFT>>();
|
||||
break;
|
||||
case InputSectionBase<ELFT>::MipsOptions:
|
||||
Sec = new MipsOptionsOutputSection<ELFT>();
|
||||
Sec = make<MipsOptionsOutputSection<ELFT>>();
|
||||
break;
|
||||
case InputSectionBase<ELFT>::MipsAbiFlags:
|
||||
Sec = new MipsAbiFlagsOutputSection<ELFT>();
|
||||
Sec = make<MipsAbiFlagsOutputSection<ELFT>>();
|
||||
break;
|
||||
}
|
||||
Out<ELFT>::Pool.emplace_back(Sec);
|
||||
return {Sec, true};
|
||||
}
|
||||
|
||||
|
||||
@@ -773,9 +773,6 @@ template <class ELFT> struct Out {
|
||||
static OutputSectionBase<ELFT> *PreinitArray;
|
||||
static OutputSectionBase<ELFT> *InitArray;
|
||||
static OutputSectionBase<ELFT> *FiniArray;
|
||||
|
||||
// This pool owns dynamically-allocated output sections.
|
||||
static std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Pool;
|
||||
};
|
||||
|
||||
template <bool Is64Bits> struct SectionKey {
|
||||
@@ -842,10 +839,6 @@ template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ProgramHeaders;
|
||||
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::PreinitArray;
|
||||
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::InitArray;
|
||||
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::FiniArray;
|
||||
|
||||
template <class ELFT>
|
||||
std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Out<ELFT>::Pool;
|
||||
|
||||
} // namespace elf
|
||||
} // namespace lld
|
||||
|
||||
|
||||
@@ -247,7 +247,6 @@ template <class ELFT> void elf::writeResult() {
|
||||
In<ELFT>::Sections = {BuildId.get()};
|
||||
|
||||
Writer<ELFT>().run();
|
||||
Out<ELFT>::Pool.clear();
|
||||
}
|
||||
|
||||
template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {
|
||||
|
||||
Reference in New Issue
Block a user