[PATCH] [Driver] Add -L and -l support.

Shankar Kalpathi Easwaran shankarke at gmail.com
Tue Feb 5 19:18:27 PST 2013



================
Comment at: lib/Driver/Drivers.cpp:168
@@ +167,3 @@
+        StringRef libName = (*it)->getValue();
+        SmallString<128> p;
+        for (const auto &path : _inputSearchPaths) {
----------------
This should use MAXPATHLEN, not sure if llvm has a value depending on the platform.

================
Comment at: lib/Driver/Drivers.cpp:171
@@ +170,3 @@
+          p = path;
+          llvm::sys::path::append(p, Twine("lib") + libName + ".a");
+          if (llvm::sys::fs::exists(p.str())) {
----------------
This could be a problem when shared libraries are added for searching. Should the extension be queried with targetInfo, because archive libraries could use different extensions in different platforms

================
Comment at: lib/Driver/Drivers.cpp:172-174
@@ +171,5 @@
+          llvm::sys::path::append(p, Twine("lib") + libName + ".a");
+          if (llvm::sys::fs::exists(p.str())) {
+            inputPath = newArgs->MakeArgString(p);
+            break;
+          }
----------------
Does this take care of symbolic links ?

================
Comment at: lib/Driver/Drivers.cpp:178
@@ +177,3 @@
+        if (inputPath.empty())
+          llvm_unreachable("Failed to lookup library!");
+      } else
----------------
I think this should just be a error and not llvm_unreachable. It should also include library name here.

================
Comment at: lib/Driver/CoreOptions.td:10
@@ -9,2 +9,3 @@
 def entry : Joined<["-"], "entry=">;
+def input_search_path : Joined<["-"], "input-search-path=">;
 def relocatable : Flag<["-"], "relocatable">;
----------------
Should this be an alias option for -L ?


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



More information about the llvm-commits mailing list