[PATCH] Add an LTO interface to parse metadata and extract linker options

Reid Kleckner rnk at google.com
Thu Dec 26 11:48:13 PST 2013


  Interesting.  This is essentially exposing the info that we would have put into the object file if we had generated one.


================
Comment at: include/llvm/Target/TargetLoweringObjectFile.h:60
@@ +59,3 @@
+  /// option string. Returns NULL if the option does not specify a library.
+  virtual const char *getDepLibFromLinkerOpt(StringRef LinkerOption) const {
+    return NULL;
----------------
This should return a StringRef.

================
Comment at: lib/LTO/LTOModule.cpp:817
@@ +816,3 @@
+            getObjFileLowering().getDepLibFromLinkerOpt(Op))
+          _deplibs.push_back(DepLibName);
+        else if (!Op.empty())
----------------
Now _deplibs and _linkeropts hold pointers into global metadata.  Is that OK?  Is that metadata guaranteed to outlive LTOModule?  Might be better to copy here.


http://llvm-reviews.chandlerc.com/D2343



More information about the llvm-commits mailing list