From a87f776c1c873ea86a95c368f1a9331adc65d1ee Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 23 Nov 2024 17:28:27 -0800 Subject: [PATCH] [ELF] Avoid make in elf::writeARMCmseImportLib --- lld/ELF/Arch/ARM.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp index 4a293af9b9a118..f32c43067c3daf 100644 --- a/lld/ELF/Arch/ARM.cpp +++ b/lld/ELF/Arch/ARM.cpp @@ -1445,21 +1445,22 @@ void ArmCmseSGSection::finalizeContents() { // See ArmĀ® v8-M Security Extensions: Requirements on Development Tools // https://developer.arm.com/documentation/ecm0359818/latest template void elf::writeARMCmseImportLib(Ctx &ctx) { - StringTableSection *shstrtab = - make(ctx, ".shstrtab", /*dynamic=*/false); - StringTableSection *strtab = - make(ctx, ".strtab", /*dynamic=*/false); - SymbolTableBaseSection *impSymTab = - make>(ctx, *strtab); + auto shstrtab = + std::make_unique(ctx, ".shstrtab", /*dynamic=*/false); + auto strtab = + std::make_unique(ctx, ".strtab", /*dynamic=*/false); + auto impSymTab = std::make_unique>(ctx, *strtab); SmallVector, SyntheticSection *>, 0> osIsPairs; osIsPairs.emplace_back( - std::make_unique(ctx, strtab->name, 0, 0), strtab); + std::make_unique(ctx, strtab->name, 0, 0), strtab.get()); osIsPairs.emplace_back( - std::make_unique(ctx, impSymTab->name, 0, 0), impSymTab); + std::make_unique(ctx, impSymTab->name, 0, 0), + impSymTab.get()); osIsPairs.emplace_back( - std::make_unique(ctx, shstrtab->name, 0, 0), shstrtab); + std::make_unique(ctx, shstrtab->name, 0, 0), + shstrtab.get()); llvm::sort(ctx.symtab->cmseSymMap, [&](const auto &a, const auto &b) { return a.second.sym->getVA(ctx) < b.second.sym->getVA(ctx);