Move the parser for the linker script to a separate file.

LinkerScript.cpp contains both the linker script processor and the
linker script parser. I put both into a single file, but the file grown
too large, so it's time to put them into two different files.

llvm-svn: 299515
This commit is contained in:
Rui Ueyama 2017-04-05 05:07:39 +00:00
parent fd9dafdc65
commit 2ec34544aa
6 changed files with 1217 additions and 1164 deletions

View File

@ -24,6 +24,7 @@ add_lld_library(lldELF
OutputSections.cpp
Relocations.cpp
ScriptLexer.cpp
ScriptParser.cpp
Strings.cpp
SymbolTable.cpp
Symbols.cpp

View File

@ -33,6 +33,7 @@
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "ScriptParser.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"

File diff suppressed because it is too large Load Diff

View File

@ -57,15 +57,6 @@ struct ExprValue {
// Later, we evaluate the expression by calling the function.
typedef std::function<ExprValue()> Expr;
// Parses a linker script. Calling this function updates
// Config and ScriptConfig.
void readLinkerScript(MemoryBufferRef MB);
// Parses a version script.
void readVersionScript(MemoryBufferRef MB);
void readDynamicList(MemoryBufferRef MB);
// This enum is used to implement linker script SECTIONS command.
// https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS
enum SectionsCommandKind {

1184
lld/ELF/ScriptParser.cpp Normal file

File diff suppressed because it is too large Load Diff

31
lld/ELF/ScriptParser.h Normal file
View File

@ -0,0 +1,31 @@
//===- ScriptParser.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_ELF_SCRIPT_PARSER_H
#define LLD_ELF_SCRIPT_PARSER_H
#include "lld/Core/LLVM.h"
#include "llvm/Support/MemoryBuffer.h"
namespace lld {
namespace elf {
// Parses a linker script. Calling this function updates
// Config and ScriptConfig.
void readLinkerScript(MemoryBufferRef MB);
// Parses a version script.
void readVersionScript(MemoryBufferRef MB);
void readDynamicList(MemoryBufferRef MB);
} // namespace elf
} // namespace lld
#endif