1 Test the linker line tables on roughly the following example:
5 inline void foo(void) {
18 $ clang-cl -Xclang -fdebug-compilation-dir -Xclang . -c -Z7 pdb_lines*.c
20 /pdbsourcepath: only sets the directory that relative paths are considered
21 relative to, so this test needs to pass relative paths to lld-link for:
22 1. The input obj files
24 3. The lld-link invocation itself
25 To achieve this, put all inputs of the lld-link invocation (including lld-link
26 itself) in a temp directory that's cwd and then make sure to only use relative
27 arguments when calling ./lld-link below.
30 RUN: cp lld-link %t/lld-link
33 RUN: yaml2obj %S/Inputs/pdb_lines_1_relative.yaml -o %t/pdb_lines_1_relative.obj
34 RUN: yaml2obj %S/Inputs/pdb_lines_2_relative.yaml -o %t/pdb_lines_2_relative.obj
35 RUN: ./lld-link -debug "-pdbsourcepath:c:\src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
36 RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck %s
37 RUN: ./lld-link -debug "-pdbsourcepath:/usr/src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
38 RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
40 CHECK-LABEL: - Module: 'c:\src\pdb_lines_1_relative.obj'
41 CHECK-NEXT: ObjFile: 'c:\src\pdb_lines_1_relative.obj'
43 CHECK-NEXT: - 'c:\src\pdb_lines_1.c'
44 CHECK-NEXT: - 'c:\src\foo.h'
46 CHECK: - FileName: 'c:\src\pdb_lines_1.c'
47 CHECK: - FileName: 'c:\src\foo.h'
48 CHECK: - !FileChecksums
49 CHECK: - FileName: 'c:\src\pdb_lines_1.c'
50 CHECK: - FileName: 'c:\src\foo.h'
52 CHECK-LABEL: - Module: 'c:\src\pdb_lines_2_relative.obj'
53 CHECK-NEXT: ObjFile: 'c:\src\pdb_lines_2_relative.obj'
55 CHECK-NEXT: - 'c:\src\pdb_lines_2.c'
57 CHECK: - FileName: 'c:\src\pdb_lines_2.c'
58 CHECK: - !FileChecksums
59 CHECK: - FileName: 'c:\src\pdb_lines_2.c'
61 CHECK-LABEL: - Kind: S_ENVBLOCK
62 CHECK-NEXT: EnvBlockSym:
65 CHECK-NEXT: - 'c:\src'
67 CHECK-NEXT: - 'c:\src\lld-link'
69 CHECK-NEXT: - 'c:\src\out.pdb'
71 CHECK-NEXT: - '-debug -pdbsourcepath:c:\src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'
74 POSIX-LABEL: - Module: '/usr/src/pdb_lines_1_relative.obj'
75 POSIX-NEXT: ObjFile: '/usr/src/pdb_lines_1_relative.obj'
77 POSIX-NEXT: - '/usr/src/pdb_lines_1.c'
78 POSIX-NEXT: - '/usr/src/foo.h'
80 POSIX: - FileName: '/usr/src/pdb_lines_1.c'
81 POSIX: - FileName: '/usr/src/foo.h'
82 POSIX: - !FileChecksums
83 POSIX: - FileName: '/usr/src/pdb_lines_1.c'
84 POSIX: - FileName: '/usr/src/foo.h'
86 POSIX-LABEL: - Module: '/usr/src/pdb_lines_2_relative.obj'
87 POSIX-NEXT: ObjFile: '/usr/src/pdb_lines_2_relative.obj'
89 POSIX-NEXT: - '/usr/src/pdb_lines_2.c'
91 POSIX: - FileName: '/usr/src/pdb_lines_2.c'
92 POSIX: - !FileChecksums
93 POSIX: - FileName: '/usr/src/pdb_lines_2.c'
95 POSIX-LABEL: - Kind: S_ENVBLOCK
96 POSIX-NEXT: EnvBlockSym:
99 POSIX-NEXT: - '/usr/src'
101 POSIX-NEXT: - '/usr/src/lld-link'
103 POSIX-NEXT: - '/usr/src/out.pdb'
105 POSIX-NEXT: - '-debug -pdbsourcepath:/usr/src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'