Index: ELF/SyntheticSections.h =================================================================== --- ELF/SyntheticSections.h +++ ELF/SyntheticSections.h @@ -974,6 +974,7 @@ // Linker generated sections which can be used as inputs. struct InX { + static uint8_t First; static InputSection *ARMAttributes; static BssSection *Bss; static BssSection *BssRelRo; @@ -1005,11 +1006,13 @@ }; template struct In { + static uint8_t First; static VersionDefinitionSection *VerDef; static VersionTableSection *VerSym; static VersionNeedSection *VerNeed; }; +template uint8_t In::First; template VersionDefinitionSection *In::VerDef; template VersionTableSection *In::VerSym; template VersionNeedSection *In::VerNeed; Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -3041,6 +3041,7 @@ return Changed; } +uint8_t InX::First; InputSection *InX::ARMAttributes; BssSection *InX::Bss; BssSection *InX::BssRelRo; Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -260,6 +260,8 @@ // Initialize all pointers with NULL. This is needed because // you can call lld::elf::main more than once as a library. memset(&Out::First, 0, sizeof(Out)); + memset(&InX::First, 0, sizeof(InX)); + memset(&In::First, 0, sizeof(In)); auto Add = [](InputSectionBase *Sec) { InputSections.push_back(Sec); };