Skip to content

Commit d5608d6

Browse files
committed
MC,test: Improve section group test
Also add a case for #146581 ``` .section sec,"ax" .section .foo,"axG",@progbits,sec nop ```
1 parent 647aa66 commit d5608d6

File tree

2 files changed

+59
-100
lines changed

2 files changed

+59
-100
lines changed

llvm/test/MC/ELF/comdat.s

Lines changed: 0 additions & 100 deletions
This file was deleted.

llvm/test/MC/ELF/group.s

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# RUN: llvm-mc -filetype=obj -triple x86_64 %s -o %t
2+
# RUN: llvm-readelf -SsX %t | FileCheck %s
3+
# RUN: llvm-readelf -g %t | FileCheck %s --check-prefix=GROUP
4+
5+
## Test that we produce the group sections and that they are before the members
6+
7+
# CHECK: [ 3] .group GROUP 0000000000000000 {{.*}} 00000c 04 14 1 4
8+
# CHECK-NEXT: [ 4] .foo PROGBITS 0000000000000000 {{.*}} 000001 00 AXG 0 0 1
9+
# CHECK-NEXT: [ 5] .bar PROGBITS 0000000000000000 {{.*}} 000001 00 AXG 0 0 1
10+
# CHECK-NEXT: [ 6] .group GROUP 0000000000000000 {{.*}} 000008 04 14 2 4
11+
# CHECK-NEXT: [ 7] .zed PROGBITS 0000000000000000 {{.*}} 000001 00 AXG 0 0 1
12+
# CHECK-NEXT: [ 8] .group GROUP 0000000000000000 {{.*}} 00000c 04 14 4 4
13+
# CHECK-NEXT: [ 9] .baz PROGBITS 0000000000000000 {{.*}} 000004 00 AXG 0 0 1
14+
# CHECK-NEXT: [10] .rela.baz RELA 0000000000000000 {{.*}} 000018 18 G 14 9 8
15+
# CHECK-NEXT: [11] sec PROGBITS 0000000000000000 {{.*}} 000000 00 0 0 1
16+
# CHECK-NEXT: [12] .group GROUP 0000000000000000 {{.*}} 000008 04 14 3 4
17+
# CHECK-NEXT: [13] .qux PROGBITS 0000000000000000 {{.*}} 000000 00 AXG 0 0 1
18+
# CHECK-NEXT: [14] .symtab SYMTAB
19+
20+
## Test that g1 and g2 are local, but g3 is an undefined global.
21+
22+
# CHECK: 0000000000000000 0 NOTYPE LOCAL DEFAULT 4 (.foo) g1
23+
# CHECK-NEXT: 0000000000000000 0 NOTYPE LOCAL DEFAULT 6 (.group) g2
24+
# CHECK-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 11 (sec) sec
25+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND g3
26+
27+
# GROUP: COMDAT group section [ 3] `.group' [g1] contains 2 sections:
28+
# GROUP-NEXT: [Index] Name
29+
# GROUP-NEXT: [ 4] .foo
30+
# GROUP-NEXT: [ 5] .bar
31+
# GROUP-EMPTY:
32+
# GROUP-NEXT: COMDAT group section [ 6] `.group' [g2] contains 1 sections:
33+
# GROUP-NEXT: [Index] Name
34+
# GROUP-NEXT: [ 7] .zed
35+
# GROUP-EMPTY:
36+
# GROUP-NEXT: COMDAT group section [ 8] `.group' [g3] contains 2 sections:
37+
# GROUP-NEXT: [Index] Name
38+
# GROUP-NEXT: [ 9] .baz
39+
# GROUP-NEXT: [ 10] .rela.baz
40+
# GROUP-EMPTY:
41+
# GROUP-NEXT: group section [ 12] `.group' [] contains 1 sections:
42+
# GROUP-NEXT: [Index] Name
43+
# GROUP-NEXT: [ 13] .qux
44+
45+
.section .foo,"axG",@progbits,g1,comdat
46+
g1:
47+
nop
48+
49+
.section .bar,"ax?",@progbits
50+
nop
51+
52+
.section .zed,"axG",@progbits,g2,comdat
53+
nop
54+
55+
.section .baz,"axG",@progbits,g3,comdat
56+
.long g3
57+
58+
.section sec
59+
.section .qux,"axG",@progbits,sec

0 commit comments

Comments
 (0)