MaskRay added a comment. In D65880#2294871 <https://reviews.llvm.org/D65880#2294871>, @protze.joachim wrote:
> I still see some clang-specific and system link directories listed in the > linker line before the directories from `LIBRARY_PATH`: > > $ LIBRARY_PATH=test1 /usr/local/clang/bin/clang -Ltest2 -v hello.c > "/usr/bin/ld" .../crtbegin.o -Ltest2 > -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 > -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 > -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. > -L/usr/local/clang/bin/../lib -L/lib -L/usr/lib -Ltest1 > > I think they are inserted by `ToolChain.AddFilePathLibArgs` in Gnu.cpp. Is > this the intended ordering? My expectation would be > > $ LIBRARY_PATH=test1 /usr/local/clang/bin/clang -Ltest2 -v hello.c > "/usr/bin/ld" .../crtbegin.o -Ltest2 -Ltest1 > -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 > -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 > -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. > -L/usr/local/clang/bin/../lib -L/lib -L/usr/lib > > @hfinkel any opinion? In GCC, some system directories precede LIBRARY_PATH. I don't know the exact rule yet (but this patch made the behavior more similar) % mkdir test1 % LIBRARY_PATH=test1 gcc-10 -Ltest2 -v a.c ... LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/l ib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:test1/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65880/new/ https://reviews.llvm.org/D65880 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits