Files
llvm/lld/ELF/SymbolListFile.cpp
George Rimar 20b6598c10 [ELF] - Remove VersionScriptParser class and move the members to ScriptParser
Patch removes VersionScriptParser class and moves the members to ScriptParser
It opens road for implementation of VERSION linkerscript command.

Differential revision: https://reviews.llvm.org/D23774

llvm-svn: 280212
2016-08-31 09:08:26 +00:00

58 lines
1.5 KiB
C++

//===- SymbolListFile.cpp -------------------------------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the parser/evaluator of the linker script.
// It does not construct an AST but consume linker script directives directly.
// Results are written to Driver or Config object.
//
//===----------------------------------------------------------------------===//
#include "SymbolListFile.h"
#include "Config.h"
#include "ScriptParser.h"
#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
using namespace llvm::ELF;
using namespace lld;
using namespace lld::elf;
// Parse the --dynamic-list argument. A dynamic list is in the form
//
// { symbol1; symbol2; [...]; symbolN };
//
// Multiple groups can be defined in the same file, and they are merged
// into a single group.
namespace {
class DynamicListParser final : public ScriptParserBase {
public:
DynamicListParser(StringRef S) : ScriptParserBase(S) {}
void run();
};
} // end anonymous namespace
void DynamicListParser::run() {
while (!atEOF()) {
expect("{");
while (!Error) {
Config->DynamicList.push_back(next());
expect(";");
if (skip("}"))
break;
}
expect(";");
}
}
void elf::parseDynamicList(MemoryBufferRef MB) {
DynamicListParser(MB.getBuffer()).run();
}