Index: ELF/SyntheticSections.h =================================================================== --- ELF/SyntheticSections.h +++ ELF/SyntheticSections.h @@ -685,6 +685,10 @@ template InputSection *createCommonSection(); template InputSection *createInterpSection(); template MergeInputSection *createCommentSection(); +template +SymbolBody * +addSyntheticLocal(StringRef Name, uint8_t Type, typename ELFT::uint Value, + typename ELFT::uint Size, InputSectionBase *Section); // Linker generated sections which can be used as inputs. template struct In { Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -284,6 +284,18 @@ return Ret; } +template +SymbolBody *elf::addSyntheticLocal(StringRef Name, uint8_t Type, + typename ELFT::uint Value, + typename ELFT::uint Size, + InputSectionBase *Section) { + auto S = new (BAlloc) DefinedRegular( + Name, /*IsLocal*/ true, STV_DEFAULT, Type, Value, Size, Section, nullptr); + if (In::SymTab) + In::SymTab->addLocal(S); + return S; +} + static size_t getHashSize() { switch (Config->BuildId) { case BuildIdKind::Fast: @@ -1875,6 +1887,19 @@ template MergeInputSection *elf::createCommentSection(); template MergeInputSection *elf::createCommentSection(); +template SymbolBody * +elf::addSyntheticLocal(StringRef, uint8_t, ELF32LE::uint, + ELF32LE::uint, InputSectionBase *); +template SymbolBody * +elf::addSyntheticLocal(StringRef, uint8_t, ELF32BE::uint, + ELF32BE::uint, InputSectionBase *); +template SymbolBody * +elf::addSyntheticLocal(StringRef, uint8_t, ELF64LE::uint, + ELF64LE::uint, InputSectionBase *); +template SymbolBody * +elf::addSyntheticLocal(StringRef, uint8_t, ELF64BE::uint, + ELF64BE::uint, InputSectionBase *); + template class elf::MipsAbiFlagsSection; template class elf::MipsAbiFlagsSection; template class elf::MipsAbiFlagsSection;