mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 14:46:36 +00:00
[lld][COFF] Find libraries with relative paths.
This patch is spun out of https://reviews.llvm.org/D151188 and makes it possible for lld-link to find libraries with relative paths. This will be used later to implement the changes to autolinking runtimes explained in #63827 Differential Revision: https://reviews.llvm.org/D155268
This commit is contained in:
parent
cd1dcd2c95
commit
b6c2f100c2
@ -483,8 +483,7 @@ StringRef LinkerDriver::findFile(StringRef filename) {
|
||||
return filename;
|
||||
};
|
||||
|
||||
bool hasPathSep = (filename.find_first_of("/\\") != StringRef::npos);
|
||||
if (hasPathSep)
|
||||
if (sys::path::is_absolute(filename))
|
||||
return getFilename(filename);
|
||||
bool hasExt = filename.contains('.');
|
||||
for (StringRef dir : searchPaths) {
|
||||
|
@ -37,6 +37,12 @@ Breaking changes
|
||||
COFF Improvements
|
||||
-----------------
|
||||
|
||||
* lld-link can now find libraries with relative paths that are relative to
|
||||
`/libpath`. Before it would only be able to find libraries relative to the
|
||||
current directory.
|
||||
I.e. ``lld-link /libpath:c:\relative\root relative\path\my.lib`` where before
|
||||
we would have to do ``lld-link /libpath:c:\relative\root\relative\path my.lib``
|
||||
|
||||
MinGW Improvements
|
||||
------------------
|
||||
|
||||
|
4
lld/test/COFF/relative_search_paths.test
Normal file
4
lld/test/COFF/relative_search_paths.test
Normal file
@ -0,0 +1,4 @@
|
||||
We should be able to find libraries with relative search paths.
|
||||
# RUN: mkdir -p %t.dir/relative/path
|
||||
# RUN: cp %p/Inputs/std64.lib %t.dir/relative/path
|
||||
# RUN: lld-link %p/Inputs/hello64.obj /libpath:%t.dir relative/path/std64.lib /entry:main
|
Loading…
x
Reference in New Issue
Block a user