2 ## Test that COMMON matches common symbols.
4 # RUN: rm -rf %t && split-file %s %t
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t/a.s -o %t/a.o
6 # RUN: ld.lld -T %t/1.t %t/a.o -o %t/a1
7 # RUN: llvm-readelf -S -s %t/a1 | FileCheck %s --check-prefix=CHECK1
8 # RUN: ld.lld -T %t/2.t %t/a.o -o %t/a2
9 # RUN: llvm-readelf -S -s %t/a2 | FileCheck %s --check-prefix=CHECK2
11 # CHECK1: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
12 # CHECK1-NEXT: [ 0] NULL [[#%x,]] [[#%x,]] 000000 00 0 0 0
13 # CHECK1-NEXT: [ 1] .text PROGBITS [[#%x,]] [[#%x,]] 000005 00 AX 0 0 4
14 # CHECK1-NEXT: [ 2] .data PROGBITS [[#%x,]] [[#%x,]] 000001 00 WA 0 0 1
15 # CHECK1-NEXT: [ 3] .common NOBITS [[#%x,]] [[#%x,]] 000180 00 WA 0 0 256
16 # CHECK1: Value Size Type Bind Vis Ndx Name
17 # CHECK1-DAG: [[#%x,]] 128 OBJECT GLOBAL DEFAULT [[#]] q1
18 # CHECK1-DAG: [[#%x,]] 128 OBJECT GLOBAL DEFAULT [[#]] q2
20 # CHECK2: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
21 # CHECK2-NEXT: [ 0] NULL [[#%x,]] [[#%x,]] 000000 00 0 0 0
22 # CHECK2-NEXT: [ 1] .text PROGBITS [[#%x,]] [[#%x,]] 000005 00 AX 0 0 4
23 # CHECK2-NEXT: [ 2] .data PROGBITS [[#%x,]] [[#%x,]] 000180 00 WA 0 0 256
24 # CHECK2: Value Size Type Bind Vis Ndx Name
25 # CHECK2-DAG: [[#%x,]] 128 OBJECT GLOBAL DEFAULT [[#]] q1
26 # CHECK2-DAG: [[#%x,]] 128 OBJECT GLOBAL DEFAULT [[#]] q2
33 .section .data,"aw",@progbits
40 SECTIONS
{ . = SIZEOF_HEADERS; .common : { *(COMMON) } }
43 ## COMMON can be placed in a SHT_PROGBITS section.
44 SECTIONS
{ . = SIZEOF_HEADERS; .data : { *(.data) *(COMMON) } }