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

Tim Northover t.p.northover at gmail.com
Tue Jul 8 02:27:04 PDT 2014


Hi Nick,

On 7 July 2014 21:50, kledzik at apple.com <kledzik at apple.com> wrote:
> My suggestion is to add a hidden linker option* and change all uses of llvm::sys::fs::exists() to call a new MachOLinkingContext::fileExists(StringRef) method.

I don't think that will work either, at least not universally: it
checks that we look for a file, but not what we do with it once found.
There may well be a use for such an option, but tests like this are
needed too.

> Tim , -syslibroot applies to all -L paths - not just the built in ones, or the "system directories".

I don't think it does:

$ cat foo.c
int foo() {
  return 'f';
}
tim $ clang foo.c -shared -olibfoo.dylib
tim $ cat main.c
extern int foo();
int main() {
  return foo();
}
tim $ clang -c main.c
tim $ ld main.o -o main -macosx_version_min 10.9 -lfoo -L.
/usr/lib/libSystem.dylib
tim $ ld main.o -o main -macosx_version_min 10.9 -lfoo -syslibroot
/Users -L. /usr/lib/libSystem.dylib
tim $ ld main.o -o main -macosx_version_min 10.9 -lfoo -L. -lSystem
tim $ ld main.o -o main -macosx_version_min 10.9 -lfoo -syslibroot
/Users -L. -lSystem
ld: library not found for -lSystem

Cheers.

Tim.



More information about the llvm-commits mailing list