Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -620,7 +620,6 @@ void readExtern(); void readGroup(); void readInclude(); - void readNothing() {} void readOutput(); void readOutputArch(); void readOutputFormat(); @@ -656,27 +655,11 @@ void readGlobal(StringRef VerStr); void readLocal(); - const static StringMap Cmd; ScriptConfiguration &Opt = *ScriptConfig; StringSaver Saver = {ScriptConfig->Alloc}; bool IsUnderSysroot; }; -const StringMap elf::ScriptParser::Cmd = { - {"ENTRY", &ScriptParser::readEntry}, - {"EXTERN", &ScriptParser::readExtern}, - {"GROUP", &ScriptParser::readGroup}, - {"INCLUDE", &ScriptParser::readInclude}, - {"INPUT", &ScriptParser::readGroup}, - {"OUTPUT", &ScriptParser::readOutput}, - {"OUTPUT_ARCH", &ScriptParser::readOutputArch}, - {"OUTPUT_FORMAT", &ScriptParser::readOutputFormat}, - {"PHDRS", &ScriptParser::readPhdrs}, - {"SEARCH_DIR", &ScriptParser::readSearchDir}, - {"SECTIONS", &ScriptParser::readSections}, - {"VERSION", &ScriptParser::readVersion}, - {";", &ScriptParser::readNothing}}; - void ScriptParser::readVersionScript() { readVersionScriptCommand(); if (!atEOF()) @@ -710,8 +693,31 @@ void ScriptParser::readLinkerScript() { while (!atEOF()) { StringRef Tok = next(); - if (Handler Fn = Cmd.lookup(Tok)) { - (this->*Fn)(); + if (Tok == ";") + continue; + + if (Tok == "ENTRY") { + readEntry(); + } else if (Tok == "EXTERN") { + readExtern(); + } else if (Tok == "GROUP" || Tok == "INPUT") { + readGroup(); + } else if (Tok == "INCLUDE") { + readInclude(); + } else if (Tok == "OUTPUT") { + readOutput(); + } else if (Tok == "OUTPUT_ARCH") { + readOutputArch(); + } else if (Tok == "OUTPUT_FORMAT") { + readOutputFormat(); + } else if (Tok == "PHDRS") { + readPhdrs(); + } else if (Tok == "SEARCH_DIR") { + readSearchDir(); + } else if (Tok == "SECTIONS") { + readSections(); + } else if (Tok == "VERSION") { + readVersion(); } else if (SymbolAssignment *Cmd = readProvideOrAssignment(Tok)) { if (Opt.HasContents) Opt.Commands.emplace_back(Cmd);