Skip to content

Commit

Permalink
[LLD][COFF] Use parentName for import files in toString. (#106104)
Browse files Browse the repository at this point in the history
Improves diagnostic messages.
  • Loading branch information
cjacek authored Aug 26, 2024
1 parent 178fc47 commit e1cf849
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lld/COFF/InputFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) +
Expand Down
2 changes: 1 addition & 1 deletion lld/test/COFF/delayimports-error.test
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lld/test/COFF/duplicate.test
Original file line number Diff line number Diff line change
Expand Up @@ -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)

4 changes: 2 additions & 2 deletions lld/test/COFF/implib-machine.s
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e1cf849

Please sign in to comment.