[PATCH] llvm-ld EmitShellScript and -L


I wanted to load /usr/lib64/libreadline.so into lli (aka "link against it" in
llvm-ld). Impossible with llvm-ld, because it uses sys::Path::FindLibrary()
which only checks the system lib paths, so it always picked up
/usr/lib/libreadline.so. Even copying it into ./mylib, and specifying -L mylib
doesn't work - again because sys::Path::FindLibrary() doesn't know about
directories specified by -L.

Attached patch lets EmitShellScript iterate over LibPaths before asking
sys::Path::FindLibrary(), which fixes both of these issues for me: I can
specify shlib directories for lli with -L, and I can override libs found in the
system paths.

My first patch to LLVM so don't be too brutal, please :wink:

Cheers, Axel.

llvm-ld_EmitShellScript_libpath.diff (1.53 KB)