Possible solution to a llvm-ld bug


As previously mentioned I had a linking problem using llvm-ld

I was getting a error if I used -L switch when linking using the following command line:

   llvm-ld -o t1.app t1.bc t1.a -L/opt/llvm-1.6/llvm-gcc/lib -lcrtend

I believe I've tracked down the problem; in the "main" of tools/llvm-ld.cpp
the call to ParseCommandLineOptions is after the TheLinker.addPaths(LibPaths)
statement so the -L command line parameter is ignored.

My fix was to move the ParseCommandLineOptions to the beginning of the main routine.


Wink Saville

You're absolutely right. I have updated llvm-ld.cpp to parse the command
line arguments before using LibPaths. Thanks for the report.