Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -315,6 +315,8 @@ bool Seen = !VisitedFiles.insert(Path.lower()).second; if (Seen) return None; + if (Path.endswith_lower(".lib")) + VisitedLibs.insert(sys::path::filename(Path)); return Path; } Index: test/COFF/libpath.test =================================================================== --- test/COFF/libpath.test +++ test/COFF/libpath.test @@ -16,3 +16,11 @@ # RUN: FileCheck -check-prefix=CHECK2 %s < %t.log CHECK2: a{{[/\\]}}std64.lib + +# RUN: lld-link /out:%t.exe /entry:main /verbose \ +# RUN: %t/a/std64.lib /subsystem:console %p/Inputs/hello64.obj \ +# RUN: /libpath:%t/b /verbose > %t.log 2>&1 +# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log + +CHECK3: Reading {{.*}}a/std64.lib +CHECK3-NOT: Reading {{.*}}b/std64.lib