1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj %S/Inputs/pdb-global-constants-a.s -o %t-a.obj -triple x86_64-windows-msvc
3# RUN: llvm-mc -filetype=obj %S/Inputs/pdb-global-constants-b.s -o %t-b.obj -triple x86_64-windows-msvc
4# RUN: lld-link -entry:main -nodefaultlib %t-a.obj %t-b.obj -out:%t.exe -pdb:%t.pdb -debug
5# RUN: llvm-pdbutil dump -globals %t.pdb | FileCheck %s
6
7# Test that lld deduplicates S_CONSTANT records with the same name and value.
8#
9# Compiled from this C code, using
10# clang t.cpp -g -gcodeview -S
11#
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 Symbols
23CHECK:           88 | S_CONSTANT [size = 16] `Bar`
24CHECK-NEXT:           type = 0x1002 (const int), value = 42
25CHECK-NEXT:      72 | S_CONSTANT [size = 16] `Foo`
26CHECK-NEXT:           type = 0x1002 (const int), value = 41
27CHECK-NEXT:     128 | S_CONSTANT [size = 16] `Foo`
28CHECK-NEXT:           type = 0x1002 (const int), value = 42
29