1# REQUIRES: x86 2# RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t1.obj 3# RUN: llvm-mc -triple=x86_64-windows-msvc %S/Inputs/associative-comdat-2.s -filetype=obj -o %t2.obj 4 5# RUN: lld-link -entry:main %t1.obj %t2.obj -out:%t.gc.exe 6# RUN: llvm-readobj --sections %t.gc.exe | FileCheck %s 7 8# RUN: lld-link -entry:main %t1.obj %t2.obj -opt:noref -out:%t.nogc.exe 9# RUN: llvm-readobj --sections %t.nogc.exe | FileCheck %s 10 11# CHECK: Sections [ 12# CHECK: Section { 13# CHECK: Number: 2 14# CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00) 15# This is the critical check to show that only *one* definition of 16# foo_assoc was retained. This *must* be 8, not 16. 17# CHECK-NEXT: VirtualSize: 0x8 18# CHECK: Section { 19# CHECK: Number: 3 20# CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00) 21# CHECK-NEXT: VirtualSize: 0x4 22 23 .text 24 .def main; 25 .scl 2; 26 .type 32; 27 .endef 28 .globl main # -- Begin function main 29 .p2align 4, 0x90 30main: # @main 31# BB#0: 32 movl foo(%rip), %eax 33 retq 34 # -- End function 35 36# Defines foo and foo_assoc globals. foo is comdat, and foo_assoc is comdat 37# associative with it. foo_assoc should be discarded iff foo is discarded, 38# either by linker GC or normal comdat merging. 39 40 .section .rdata,"dr",associative,foo 41 .p2align 3 42 .quad foo 43 44 .section .data,"dw",discard,foo 45 .globl foo # @foo 46 .p2align 2 47foo: 48 .long 42 49