diff --git a/lld/include/lld/Core/TargetInfo.h b/lld/include/lld/Core/TargetInfo.h index cb81eb86019f..42fd9b49c51f 100644 --- a/lld/include/lld/Core/TargetInfo.h +++ b/lld/include/lld/Core/TargetInfo.h @@ -12,6 +12,7 @@ #include "lld/Core/Error.h" #include "lld/Core/LLVM.h" +#include "lld/Core/range.h" #include "lld/Core/Reference.h" #include "lld/Driver/LinkerInput.h" @@ -237,6 +238,24 @@ public: _llvmOptions.push_back(opt); } + /// This method adds undefined symbols specified by the -u option to the + /// to the list of undefined symbols known to the linker. This option + /// essentially forces an undefined symbol to be create. + void addUndefinedSymbol(StringRef symbolName) { + _undefinedSymbols.push_back(symbolName); + } + + /// Iterators for symbols that appear on the command line + typedef std::vector StringRefVector; + typedef StringRefVector::iterator StringRefVectorIter; + typedef StringRefVector::const_iterator StringRefVectorConstIter; + + /// Return the list of undefined symbols that are specified in the + /// linker command line, using the -u option. + range undefinedSymbols() const { + return _undefinedSymbols; + } + /// After all set* methods are called, the Driver calls this method /// to validate that there are no missing options or invalid combinations /// of options. If there is a problem, a description of the problem @@ -340,6 +359,7 @@ protected: std::vector _inputFiles; std::vector _llvmOptions; std::unique_ptr _yamlReader; + StringRefVector _undefinedSymbols; private: /// Validate the subclass bits. Only called by validate. diff --git a/lld/include/lld/ReaderWriter/ELFTargetInfo.h b/lld/include/lld/ReaderWriter/ELFTargetInfo.h index b8f7da89fe9d..9163d88bfc46 100644 --- a/lld/include/lld/ReaderWriter/ELFTargetInfo.h +++ b/lld/include/lld/ReaderWriter/ELFTargetInfo.h @@ -12,7 +12,6 @@ #include "lld/Core/PassManager.h" #include "lld/Core/Pass.h" -#include "lld/Core/range.h" #include "lld/Core/TargetInfo.h" #include "lld/ReaderWriter/Reader.h" #include "lld/ReaderWriter/Writer.h" @@ -155,22 +154,6 @@ public: /// Searches directories then calls appendInputFile() bool appendLibrary(StringRef libName); - /// adds undefined symbols that are specified in the command line - void addUndefinedSymbol(StringRef symbolName) { - _undefinedSymbols.push_back(symbolName); - } - - /// Iterators for symbols that appear on the command line - typedef std::vector StringRefVector; - typedef StringRefVector::iterator StringRefVectorIter; - typedef StringRefVector::const_iterator StringRefVectorConstIter; - - /// Return the list of undefined symbols that are specified in the - /// linker command line, using the -u option. - range undefinedSymbols() const { - return _undefinedSymbols; - } - private: ELFTargetInfo() LLVM_DELETED_FUNCTION; protected: @@ -197,7 +180,6 @@ protected: std::unique_ptr _writer; std::unique_ptr _linkerScriptReader; StringRef _dynamicLinkerPath; - StringRefVector _undefinedSymbols; }; } // end namespace lld