This fixes the second part of PR42407. For files with dwarf debug info, it manually loads and iterates .debug_info to find the declared location of variables, to allow reporting them. (This matches the corresponding code in the ELF linker.) For functions, it uses the existing getFileLineDwarf which uses LLVMSymbolizer for translating addresses to file lines. In object files with codeview debug info, only the source location of duplicate functions is printed. (And even there, only for the first input file. The getFileLineCodeView function requires the object file to be fully loaded and initialized to properly resolve source locations, but duplicate symbols are reported at a stage when the second object file isn't fully loaded yet.) Differential Revision: https://reviews.llvm.org/D68975 llvm-svn: 375218
18 lines
834 B
Plaintext
18 lines
834 B
Plaintext
# REQUIRES: x86
|
|
RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o alpha.obj %S/Inputs/alpha.ll
|
|
RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o beta.obj %S/Inputs/beta.ll
|
|
RUN: lld-link /out:alpha.dll /dll alpha.obj /implib:alpha.lib
|
|
RUN: not lld-link /out:beta.dll /dll alpha.obj beta.obj alpha.lib 2>&1 | FileCheck %s -check-prefix CHECK-ALPHA
|
|
|
|
CHECK-ALPHA: error: duplicate symbol: f
|
|
CHECK-ALPHA: defined at {{.*}}alpha.obj
|
|
CHECK-APLHA: defined at alpha.dll
|
|
|
|
RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o gamma.obj %S/Inputs/gamma.ll
|
|
RUN: not lld-link /out:gamma.exe /subsystem:console /entry:mainCRTStartup gamma.obj alpha.lib 2>&1 | FileCheck %s -check-prefix CHECK-GAMMA
|
|
|
|
CHECK-GAMMA: error: duplicate symbol: __declspec(dllimport) f
|
|
CHECK-GAMMA: defined at {{.*}}gamma.obj
|
|
CHECK-GAMMA: defined at alpha.dll
|
|
|