[lld] r184398 - [TargetInfo] Undefined symbols move from ELFTargetInfo to TargetInfo

Shankar Easwaran shankare at codeaurora.org
Wed Jun 19 21:27:21 PDT 2013


Author: shankare
Date: Wed Jun 19 23:27:21 2013
New Revision: 184398

URL: http://llvm.org/viewvc/llvm-project?rev=184398&view=rev
Log:
[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)

Modified:
    lld/trunk/include/lld/Core/TargetInfo.h
    lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h

Modified: lld/trunk/include/lld/Core/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/TargetInfo.h?rev=184398&r1=184397&r2=184398&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/TargetInfo.h (original)
+++ lld/trunk/include/lld/Core/TargetInfo.h Wed Jun 19 23:27:21 2013
@@ -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.

Modified: lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h?rev=184398&r1=184397&r2=184398&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h Wed Jun 19 23:27:21 2013
@@ -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
 





More information about the llvm-commits mailing list