[ELF] Change gnuHashTab/hashTab to unique_ptr. NFC

and remove associated make<XXX> calls.

My x86-64 `lld` is ~5KiB smaller.
This commit is contained in:
Fangrui Song 2022-01-12 13:04:32 -08:00
parent 9dc4dea110
commit a5249c2dd2
2 changed files with 6 additions and 6 deletions

View File

@ -1216,8 +1216,8 @@ struct Partition {
std::unique_ptr<SymbolTableBaseSection> dynSymTab;
std::unique_ptr<EhFrameHeader> ehFrameHdr;
std::unique_ptr<EhFrameSection> ehFrame;
GnuHashTableSection *gnuHashTab;
HashTableSection *hashTab;
std::unique_ptr<GnuHashTableSection> gnuHashTab;
std::unique_ptr<HashTableSection> hashTab;
std::unique_ptr<RelocationBaseSection> relaDyn;
std::unique_ptr<RelrBaseSection> relrDyn;
std::unique_ptr<VersionDefinitionSection> verDef;

View File

@ -385,12 +385,12 @@ template <class ELFT> void elf::createSyntheticSections() {
add(*part.verNeed);
if (config->gnuHash) {
part.gnuHashTab = make<GnuHashTableSection>();
part.gnuHashTab = std::make_unique<GnuHashTableSection>();
add(*part.gnuHashTab);
}
if (config->sysvHash) {
part.hashTab = make<HashTableSection>();
part.hashTab = std::make_unique<HashTableSection>();
add(*part.hashTab);
}
@ -2091,8 +2091,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// symbol table section (dynSymTab) must be the first one.
for (Partition &part : partitions) {
finalizeSynthetic(part.dynSymTab.get());
finalizeSynthetic(part.gnuHashTab);
finalizeSynthetic(part.hashTab);
finalizeSynthetic(part.gnuHashTab.get());
finalizeSynthetic(part.hashTab.get());
finalizeSynthetic(part.verDef.get());
finalizeSynthetic(part.relaDyn.get());
finalizeSynthetic(part.relrDyn.get());