Skip to content

Commit

Permalink
[ELF] Avoid make in elf::writeARMCmseImportLib
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Nov 24, 2024
1 parent 48b13ca commit a87f776
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lld/ELF/Arch/ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
StringTableSection *shstrtab =
make<StringTableSection>(ctx, ".shstrtab", /*dynamic=*/false);
StringTableSection *strtab =
make<StringTableSection>(ctx, ".strtab", /*dynamic=*/false);
SymbolTableBaseSection *impSymTab =
make<SymbolTableSection<ELFT>>(ctx, *strtab);
auto shstrtab =
std::make_unique<StringTableSection>(ctx, ".shstrtab", /*dynamic=*/false);
auto strtab =
std::make_unique<StringTableSection>(ctx, ".strtab", /*dynamic=*/false);
auto impSymTab = std::make_unique<SymbolTableSection<ELFT>>(ctx, *strtab);

SmallVector<std::pair<std::unique_ptr<OutputSection>, SyntheticSection *>, 0>
osIsPairs;
osIsPairs.emplace_back(
std::make_unique<OutputSection>(ctx, strtab->name, 0, 0), strtab);
std::make_unique<OutputSection>(ctx, strtab->name, 0, 0), strtab.get());
osIsPairs.emplace_back(
std::make_unique<OutputSection>(ctx, impSymTab->name, 0, 0), impSymTab);
std::make_unique<OutputSection>(ctx, impSymTab->name, 0, 0),
impSymTab.get());
osIsPairs.emplace_back(
std::make_unique<OutputSection>(ctx, shstrtab->name, 0, 0), shstrtab);
std::make_unique<OutputSection>(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);
Expand Down

0 comments on commit a87f776

Please sign in to comment.