1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tfile0.o 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/common-filespec1.s -o %tfile1.o 4# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/common-filespec2.s -o %tfile2.o 5# RUN: echo "SECTIONS { .common.incl : { *(EXCLUDE_FILE (*file2.o) COMMON) } .common.excl : { *(COMMON) } }" > %t.script 6# RUN: ld.lld -o %t1 --script %t.script %tfile0.o %tfile1.o %tfile2.o 7# RUN: llvm-readobj -S --symbols %t1 | FileCheck %s 8 9# Commons from file0 and file1 are not excluded, so they must be in .common.incl 10# Commons from file2 are excluded from the first rule and should be caught by 11# the second in .common.excl 12# CHECK: Section { 13# CHECK: Index: 14# CHECK: Name: .common.incl 15# CHECK-NEXT: Type: SHT_NOBITS 16# CHECK-NEXT: Flags [ 17# CHECK-NEXT: SHF_ALLOC 18# CHECK-NEXT: SHF_WRITE 19# CHECK-NEXT: ] 20# CHECK-NEXT: Address: 0x8 21# CHECK-NEXT: Offset: 0x 22# CHECK-NEXT: Size: 16 23# CHECK-NEXT: Link: 0 24# CHECK-NEXT: Info: 0 25# CHECK-NEXT: AddressAlignment: 8 26# CHECK-NEXT: EntrySize: 0 27# CHECK-NEXT: } 28# CHECK: Section { 29# CHECK: Index: 30# CHECK: Name: .common.excl 31# CHECK-NEXT: Type: SHT_NOBITS 32# CHECK-NEXT: Flags [ 33# CHECK-NEXT: SHF_ALLOC 34# CHECK-NEXT: SHF_WRITE 35# CHECK-NEXT: ] 36# CHECK-NEXT: Address: 0x20 37# CHECK-NEXT: Offset: 0x 38# CHECK-NEXT: Size: 48 39# CHECK-NEXT: Link: 0 40# CHECK-NEXT: Info: 0 41# CHECK-NEXT: AddressAlignment: 16 42# CHECK-NEXT: EntrySize: 0 43# CHECK-NEXT: } 44# CHECK: Symbol { 45# CHECK: Name: common_multiple 46# CHECK-NEXT: Value: 0x20 47# CHECK-NEXT: Size: 32 48# CHECK-NEXT: Binding: Global 49# CHECK-NEXT: Type: Object 50# CHECK-NEXT: Other: 0 51# CHECK-NEXT: Section: .common.excl 52# CHECK-NEXT: } 53# CHECK: Symbol { 54# CHECK: Name: common_uniq_0 55# CHECK-NEXT: Value: 0x8 56# CHECK-NEXT: Size: 4 57# CHECK-NEXT: Binding: Global 58# CHECK-NEXT: Type: Object 59# CHECK-NEXT: Other: 0 60# CHECK-NEXT: Section: .common.incl 61# CHECK-NEXT: } 62# CHECK: Symbol { 63# CHECK: Name: common_uniq_1 64# CHECK-NEXT: Value: 0x10 65# CHECK-NEXT: Size: 8 66# CHECK-NEXT: Binding: Global 67# CHECK-NEXT: Type: Object 68# CHECK-NEXT: Other: 0 69# CHECK-NEXT: Section: .common.incl 70# CHECK-NEXT: } 71# CHECK: Symbol { 72# CHECK: Name: common_uniq_2 73# CHECK-NEXT: Value: 0x40 74# CHECK-NEXT: Size: 16 75# CHECK-NEXT: Binding: Global 76# CHECK-NEXT: Type: Object 77# CHECK-NEXT: Other: 0 78# CHECK-NEXT: Section: .common.excl 79# CHECK-NEXT: } 80 81.globl _start 82_start: 83 jmp _start 84 85.comm common_uniq_0,4,4 86.comm common_multiple,8,8 87