1# RUN: yaml2obj %S/Inputs/pdb-file-statics-a.yaml > %t.a.obj
2# RUN: yaml2obj %S/Inputs/pdb-file-statics-b.yaml > %t.b.obj
3# RUN: lld-link %t.a.obj %t.b.obj /nodefaultlib /entry:main /debug /pdb:%t.pdb
4# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
5
6# S_FILESTATIC records are unique in that they refer to the string table, but
7# they do *not* go through the file checksums table.  They refer directly to
8# the string table.  This makes for special handling in the linker, so it
9# deserves a custom test.
10
11# Clang doesn't currently generate these records, but MSVC does, so we have to
12# be able to correctly link them.  These records are only generated when
13# optimizations are turned on.
14
15# // a.cpp
16# // cl.exe /Z7 /O1 /c a.cpp
17# static int x = 0;
18#
19# void b(int);
20#
21# void a(int) {
22#   if (x)
23#     b(x);
24# }
25#
26# int main(int argc, char **argv) {
27#   a(argc);
28#   return x;
29# }
30#
31# // b.cpp
32# // cl.exe /Z7 /O1 /c a.cpp
33# void a(int);
34#
35# static int y = 0;
36#
37# void b(int) {
38#   if (y)
39#     a(y);
40# }
41
42# CHECK:                           Symbols
43# CHECK: ============================================================
44# CHECK-LABEL:   Mod 0000 | `{{.*}}a.obj`:
45# CHECK:              232 | S_FILESTATIC [size = 16] `x`
46# CHECK-NEXT:               type = 0x0074 (int), file name = 2 (D:\src\llvmbuild\cl\Debug\x64\a.obj), flags = enreg global | enreg static
47# CHECK:         Mod 0001 | `{{.*}}b.obj`:
48# CHECK:              232 | S_FILESTATIC [size = 16] `y`
49# CHECK-NEXT:               type = 0x0074 (int), file name = 74 (D:\src\llvmbuild\cl\Debug\x64\b.obj), flags = enreg global | enreg static
50# CHECK-LABEL:   Mod 0002 | `* Linker *`:
51
52