[PATCH] [lld] [mach-o] Support -l and -syslibroot options

Shankar Kalpathi Easwaran shankarke at gmail.com
Mon Jul 7 10:56:10 PDT 2014


================
Comment at: include/lld/ReaderWriter/MachOLinkingContext.h:134
@@ -127,1 +133,3 @@
   void setPrintAtoms(bool value=true) { _printAtoms = value; }
+  void setSyslibRoot(StringRef path) { _syslibRoot = path; }
+
----------------
should this be setSysRoot ?

================
Comment at: lib/Driver/DarwinLdOptions.td:72
@@ -71,1 +71,3 @@
         Group<grp_libs>;
+def syslibroot : Separate<["-"], "syslibroot">,
+        HelpText<"Add prefix to all system library search paths">,
----------------
I dont see this an option in the ld64 man page, is this fairly new ?

http://www.manpages.info/macosx/ld.1.html

================
Comment at: lib/Driver/DarwinLdOptions.td:78
@@ -72,1 +77,3 @@
+def l : Joined<["-"], "l">,
+        HelpText<"Root name of library to searchf for">;
 
----------------
nit pick : searchf for -> search for.

================
Comment at: lib/ReaderWriter/MachO/MachOLinkingContext.cpp:271
@@ +270,3 @@
+  SmallString<128> fullPath;
+  if (libName.endswith(".o")) {
+    // A request ending in .o is special: just search for the file directly.
----------------
  - Can the the system paths be prepended to a set of directories that are being looked up, This could help adding for -L.
  - We can possibly search for a library name outside the loop.





================
Comment at: lib/ReaderWriter/MachO/MachOLinkingContext.cpp:300
@@ +299,3 @@
+    path.assign(_syslibRoot);
+    llvm::sys::path::append(path, dir);
+
----------------
   - The gnu linker has a way to have the sys root paths be appeneded to the path only if the path starts with an equal to(=) sign, Does MachO also do something like this ? If so this needs to be changed.
  - Does not account for -L

http://reviews.llvm.org/D4409






More information about the llvm-commits mailing list