52 lines · plain
1# RUN: yaml2obj %S/Inputs/pdb-file-statics-a.yaml -o %t.a.obj2# RUN: yaml2obj %S/Inputs/pdb-file-statics-b.yaml -o %t.b.obj3# RUN: lld-link %t.a.obj %t.b.obj /nodefaultlib /entry:main /debug /pdb:%t.pdb4# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s5 6# S_FILESTATIC records are unique in that they refer to the string table, but7# they do *not* go through the file checksums table. They refer directly to8# the string table. This makes for special handling in the linker, so it9# deserves a custom test.10 11# Clang doesn't currently generate these records, but MSVC does, so we have to12# be able to correctly link them. These records are only generated when13# optimizations are turned on.14 15# // a.cpp16# // cl.exe /Z7 /O1 /c a.cpp17# 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.cpp32# // cl.exe /Z7 /O1 /c a.cpp33# void a(int);34#35# static int y = 0;36#37# void b(int) {38# if (y)39# a(y);40# }41 42# CHECK: Symbols43# 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 static47# 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 static50# CHECK-LABEL: Mod 0002 | `* Linker *`:51 52