29 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj %S/Inputs/pdb-global-constants-a.s -o %t-a.obj -triple x86_64-windows-msvc3# RUN: llvm-mc -filetype=obj %S/Inputs/pdb-global-constants-b.s -o %t-b.obj -triple x86_64-windows-msvc4# RUN: lld-link -entry:main -nodefaultlib %t-a.obj %t-b.obj -out:%t.exe -pdb:%t.pdb -debug5# RUN: llvm-pdbutil dump -globals %t.pdb | FileCheck %s6 7# Test that lld deduplicates S_CONSTANT records with the same name and value.8#9# Compiled from this C code, using10# clang t.cpp -g -gcodeview -S11#12# %t-a.cpp:13# const int Foo = 41;14# const int Bar = 42;15# int main() { return Foo + Bar; }16#17# %t-b.cpp:18# const int Foo = 42;19# const int Bar = 42;20# int foobar() { return Foo + Bar; }21 22CHECK: Global Symbols23CHECK: 88 | S_CONSTANT [size = 16] `Bar`24CHECK-NEXT: type = 0x1002 (const int), value = 4225CHECK-NEXT: 72 | S_CONSTANT [size = 16] `Foo`26CHECK-NEXT: type = 0x1002 (const int), value = 4127CHECK-NEXT: 128 | S_CONSTANT [size = 16] `Foo`28CHECK-NEXT: type = 0x1002 (const int), value = 4229