forked from OSchip/llvm-project
[TargetInfo] Undefined symbols move from ELFTargetInfo to TargetInfo
This change moves the functionality of undefinedSymbols that were created in ELFTargetInfo into TargetInfo. Looks like MachO/Windows use similiar options like in ELF for creating undefined symbols when the linker is invoked. Address comment from Ruiu. (No change in functionality, except moving the functionality from ELF to TargetInfo, so that multiple architectures can use the same) llvm-svn: 184398
This commit is contained in:
parent
94e9eaa4d7
commit
89488966bd
|
@ -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<StringRef> 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<const StringRef *> 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<LinkerInput> _inputFiles;
|
||||
std::vector<const char*> _llvmOptions;
|
||||
std::unique_ptr<Reader> _yamlReader;
|
||||
StringRefVector _undefinedSymbols;
|
||||
|
||||
private:
|
||||
/// Validate the subclass bits. Only called by validate.
|
||||
|
|
|
@ -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<StringRef> 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<const StringRef *> undefinedSymbols() const {
|
||||
return _undefinedSymbols;
|
||||
}
|
||||
|
||||
private:
|
||||
ELFTargetInfo() LLVM_DELETED_FUNCTION;
|
||||
protected:
|
||||
|
@ -197,7 +180,6 @@ protected:
|
|||
std::unique_ptr<Writer> _writer;
|
||||
std::unique_ptr<Reader> _linkerScriptReader;
|
||||
StringRef _dynamicLinkerPath;
|
||||
StringRefVector _undefinedSymbols;
|
||||
};
|
||||
} // end namespace lld
|
||||
|
||||
|
|
Loading…
Reference in New Issue