diff options
Diffstat (limited to 'lld/lib/ReaderWriter/ReaderLinkerScript.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/ReaderLinkerScript.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lld/lib/ReaderWriter/ReaderLinkerScript.cpp b/lld/lib/ReaderWriter/ReaderLinkerScript.cpp index 646f97e7f46..4e16ac86398 100644 --- a/lld/lib/ReaderWriter/ReaderLinkerScript.cpp +++ b/lld/lib/ReaderWriter/ReaderLinkerScript.cpp @@ -19,10 +19,11 @@ using namespace script; namespace { class LinkerScriptFile : public File { public: - static ErrorOr<std::unique_ptr<LinkerScriptFile> > - create(const TargetInfo &ti, std::unique_ptr<llvm::MemoryBuffer> mb) { + static ErrorOr<std::unique_ptr<LinkerScriptFile>> + create(const LinkingContext &context, + std::unique_ptr<llvm::MemoryBuffer> mb) { std::unique_ptr<LinkerScriptFile> file( - new LinkerScriptFile(ti, std::move(mb))); + new LinkerScriptFile(context, std::move(mb))); file->_script = file->_parser.parse(); if (!file->_script) return linker_script_reader_error::parse_error; @@ -37,7 +38,7 @@ public: _ordinal = ordinal++; } - virtual const TargetInfo &getTargetInfo() const { return _targetInfo; } + virtual const LinkingContext &getLinkingContext() const { return _context; } virtual const atom_collection<DefinedAtom> &defined() const { return _definedAtoms; @@ -60,14 +61,12 @@ public: } private: - LinkerScriptFile(const TargetInfo &ti, std::unique_ptr<llvm::MemoryBuffer> mb) - : File(mb->getBufferIdentifier(), kindLinkerScript), - _targetInfo(ti), - _lexer(std::move(mb)), - _parser(_lexer), - _script(nullptr) {} + LinkerScriptFile(const LinkingContext &context, + std::unique_ptr<llvm::MemoryBuffer> mb) + : File(mb->getBufferIdentifier(), kindLinkerScript), _context(context), + _lexer(std::move(mb)), _parser(_lexer), _script(nullptr) {} - const TargetInfo &_targetInfo; + const LinkingContext &_context; atom_collection_vector<DefinedAtom> _definedAtoms; atom_collection_vector<UndefinedAtom> _undefinedAtoms; atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms; @@ -79,10 +78,10 @@ private: } // end anon namespace namespace lld { -error_code -ReaderLinkerScript::parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb, - std::vector<std::unique_ptr<File> > &result) const { - auto lsf = LinkerScriptFile::create(_targetInfo, std::move(mb)); +error_code ReaderLinkerScript::parseFile( + std::unique_ptr<llvm::MemoryBuffer> &mb, + std::vector<std::unique_ptr<File>> &result) const { + auto lsf = LinkerScriptFile::create(_context, std::move(mb)); if (!lsf) return lsf; const LinkerScript *ls = (*lsf)->getScript(); @@ -90,7 +89,7 @@ ReaderLinkerScript::parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb, for (const auto &c : ls->_commands) { if (auto group = dyn_cast<Group>(c)) for (const auto &path : group->getPaths()) { - if (error_code ec = _targetInfo.readFile(path._path, result)) + if (error_code ec = _context.readFile(path._path, result)) return ec; } } |