[lld] [LLD][COFF] Use parentName for import files in toString. (PR #106104)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 10:03:05 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-coff
@llvm/pr-subscribers-platform-windows

@llvm/pr-subscribers-lld

Author: Jacek Caban (cjacek)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/106104.diff


4 Files Affected:

- (modified) lld/COFF/InputFiles.cpp (+1-1) 
- (modified) lld/test/COFF/delayimports-error.test (+1-1) 
- (modified) lld/test/COFF/duplicate.test (+1-1) 
- (modified) lld/test/COFF/implib-machine.s (+2-2) 


``````````diff
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index f9a22b0a7a5f0f..3ecd4d241f2cd4 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -61,7 +61,7 @@ static StringRef getBasename(StringRef path) {
 std::string lld::toString(const coff::InputFile *file) {
   if (!file)
     return "<internal>";
-  if (file->parentName.empty() || file->kind() == coff::InputFile::ImportKind)
+  if (file->parentName.empty())
     return std::string(file->getName());
 
   return (getBasename(file->parentName) + "(" + getBasename(file->getName()) +
diff --git a/lld/test/COFF/delayimports-error.test b/lld/test/COFF/delayimports-error.test
index cced9fb65e6142..5f45083cf5e613 100644
--- a/lld/test/COFF/delayimports-error.test
+++ b/lld/test/COFF/delayimports-error.test
@@ -8,7 +8,7 @@
 # RUN:   /alternatename:__delayLoadHelper2=main /opt:noref >& %t.log
 # RUN: FileCheck %s < %t.log
 
-# CHECK: cannot delay-load foo.dll due to import of data: __declspec(dllimport) datasym
+# CHECK: cannot delay-load foo.lib(foo.dll) due to import of data: __declspec(dllimport) datasym
 
 --- !COFF
 header:
diff --git a/lld/test/COFF/duplicate.test b/lld/test/COFF/duplicate.test
index 76c88b070ff375..11e5aa06318fe0 100644
--- a/lld/test/COFF/duplicate.test
+++ b/lld/test/COFF/duplicate.test
@@ -13,5 +13,5 @@ RUN: not lld-link /out:gamma.exe /subsystem:console /entry:mainCRTStartup gamma.
 
 CHECK-GAMMA: error: duplicate symbol: __declspec(dllimport) f
 CHECK-GAMMA: defined at {{.*}}gamma.obj
-CHECK-GAMMA: defined at alpha.dll
+CHECK-GAMMA: defined at alpha.lib(alpha.dll)
 
diff --git a/lld/test/COFF/implib-machine.s b/lld/test/COFF/implib-machine.s
index 32deff0fc25f89..92f01bbc72799b 100644
--- a/lld/test/COFF/implib-machine.s
+++ b/lld/test/COFF/implib-machine.s
@@ -6,10 +6,10 @@
 # RUN: llvm-mc -triple x86_64-windows-msvc %t.dir/test.s -filetype=obj -o %t.dir/test64.obj
 
 # RUN: not lld-link -dll -noentry -out:%t32.dll %t.dir/test32.obj %t.dir/test64.lib 2>&1 | FileCheck --check-prefix=ERR32 %s
-# ERR32: error: test.dll: machine type x64 conflicts with x86
+# ERR32: error: test64.lib(test.dll): machine type x64 conflicts with x86
 
 # RUN: not lld-link -dll -noentry -out:%t64.dll %t.dir/test64.obj %t.dir/test32.lib 2>&1 | FileCheck --check-prefix=ERR64 %s
-# ERR64: error: test.dll: machine type x86 conflicts with x64
+# ERR64: error: test32.lib(test.dll): machine type x86 conflicts with x64
 
 #--- test.s
         .def     @feat.00;

``````````

</details>


https://github.com/llvm/llvm-project/pull/106104


More information about the llvm-commits mailing list