3 # RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t1.obj
4 # RUN: llvm-mc -triple=x86_64-windows-gnu %S/Inputs/associative-comdat-mingw-2.s -filetype=obj -o %t2.obj
6 # RUN: lld-link -lldmingw -entry:main %t1.obj %t2.obj -out:%t.gc.exe -verbose
7 # RUN: llvm-readobj --sections %t.gc.exe | FileCheck %s
12 # CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00)
13 # This is the critical check to show that only *one* definition of
14 # .xdata$foo was retained. This *must* be 0x24 (0x4 for the .xdata
15 # section and 0x20 for the .ctors/.dtors headers/ends).
16 # Make sure that no other .xdata sections get included, which would
17 # increase the size here.
18 # CHECK-NEXT: VirtualSize: 0x24
31 # Defines .text$foo (which has a leader symbol and is referenced like
32 # normally), and .xdata$foo (which lacks a leader symbol, which normally
33 # would be declared associative to the symbol foo).
34 # .xdata$foo should be implicitly treated as associative to foo and brought
35 # in, while .xdata$bar, implicitly associative to bar, not included, and
36 # .xdata$baz not included since there's no symbol baz.
38 # GNU binutils ld doesn't do this at all, but always includes all .xdata/.pdata
39 # comdat sections, even if --gc-sections is used.
41 .section .xdata$foo,"dr"
46 .section .xdata$bar,"dr"
51 .section .xdata$baz,"dr"
60 .section .text$foo,"xr",discard,foo
70 .section .text$bar,"xr",discard,bar