49 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t1.obj3# RUN: llvm-mc -triple=x86_64-windows-msvc %S/Inputs/associative-comdat-2.s -filetype=obj -o %t2.obj4 5# RUN: lld-link -entry:main %t1.obj %t2.obj -out:%t.gc.exe6# RUN: llvm-readobj --sections %t.gc.exe | FileCheck %s7 8# RUN: lld-link -entry:main %t1.obj %t2.obj -opt:noref -out:%t.nogc.exe9# RUN: llvm-readobj --sections %t.nogc.exe | FileCheck %s10 11# CHECK: Sections [12# CHECK: Section {13# CHECK: Number: 214# CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00)15# This is the critical check to show that only *one* definition of16# foo_assoc was retained. This *must* be 8, not 16.17# CHECK-NEXT: VirtualSize: 0x818# CHECK: Section {19# CHECK: Number: 320# CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00)21# CHECK-NEXT: VirtualSize: 0x422 23 .text24 .def main;25 .scl 2;26 .type 32;27 .endef28 .globl main # -- Begin function main29 .p2align 4, 0x9030main: # @main31# BB#0:32 movl foo(%rip), %eax33 retq34 # -- End function35 36# Defines foo and foo_assoc globals. foo is comdat, and foo_assoc is comdat37# 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,foo41 .p2align 342 .quad foo43 44 .section .data,"dw",discard,foo45 .globl foo # @foo46 .p2align 247foo:48 .long 4249