Skip to content

Commit ac16520

Browse files
committed
MC: Improve ,unique tests
Run llvm-readelf and llvm-objdump, and test .pushsection
1 parent 9c60431 commit ac16520

File tree

1 file changed

+55
-28
lines changed

1 file changed

+55
-28
lines changed

llvm/test/MC/ELF/section-unique.s

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
1-
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
2-
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj --symbols - | FileCheck %s --check-prefix=OBJ
1+
# RUN: llvm-mc -triple x86_64 %s -o - | FileCheck %s --check-prefix=ASM
2+
# RUN: llvm-mc -triple x86_64 %s -filetype=obj -o %t
3+
# RUN: llvm-readelf -SsX -x data %t | FileCheck %s
4+
# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DIS
5+
6+
# ASM: .section .text,"ax",@progbits,unique,4294967293
7+
# ASM: f:
8+
9+
# ASM: .section .text,"ax",@progbits,unique,4294967294
10+
# ASM: g:
11+
12+
# CHECK: Name Type Address Off Size ES Flg Lk Inf Al
13+
# CHECK: text PROGBITS 0000000000000000 {{.*}} 000000 00 AX 0 0 4
14+
# CHECK-NEXT: .text PROGBITS 0000000000000000 {{.*}} 000004 00 AX 0 0 1
15+
# CHECK-NEXT: .text PROGBITS 0000000000000000 {{.*}} 000001 00 AX 0 0 1
16+
17+
# CHECK: 0000000000000001 0 NOTYPE LOCAL DEFAULT 3 (.text) f2
18+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 3 (.text) f
19+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 4 (.text) g
20+
21+
# CHECK: Hex dump of section 'data':
22+
# CHECK-NEXT: 0x00000000 03000000 06000000 .
23+
# CHECK-EMPTY:
24+
# CHECK-NEXT: Hex dump of section 'data':
25+
# CHECK-NEXT: 0x00000000 04000000 .
26+
27+
# DIS: Disassembly of section .text:
28+
# DIS-EMPTY:
29+
# DIS-NEXT: 0000000000000000 <f>:
30+
# DIS-NEXT: 0: 90 nop
31+
# DIS-EMPTY:
32+
# DIS-NEXT: 0000000000000001 <f2>:
33+
# DIS-NEXT: 1: 90 nop
34+
# DIS-NEXT: 2: cc int3
35+
# DIS-NEXT: 3: cc int3
36+
# DIS-EMPTY:
37+
# DIS-NEXT: Disassembly of section .text:
38+
# DIS-EMPTY:
39+
# DIS-NEXT: 0000000000000000 <g>:
40+
# DIS-NEXT: 0: 90 nop
341

442
.section .text,"ax",@progbits,unique, 4294967293
543
.globl f
@@ -11,29 +49,18 @@ f:
1149
g:
1250
nop
1351

14-
// test that f and g are in different sections.
15-
16-
// CHECK: .section .text,"ax",@progbits,unique,4294967293
17-
// CHECK: f:
18-
19-
// CHECK: .section .text,"ax",@progbits,unique,4294967294
20-
// CHECK: g:
21-
22-
// OBJ: Symbol {
23-
// OBJ: Name: f
24-
// OBJ: Value: 0x0
25-
// OBJ: Size: 0
26-
// OBJ: Binding: Global
27-
// OBJ: Type: None
28-
// OBJ: Other: 0
29-
// OBJ: Section: .text (0x3)
30-
// OBJ: }
31-
// OBJ: Symbol {
32-
// OBJ: Name: g
33-
// OBJ: Value: 0x0
34-
// OBJ: Size: 0
35-
// OBJ: Binding: Global
36-
// OBJ: Type: None
37-
// OBJ: Other: 0
38-
// OBJ: Section: .text (0x4)
39-
// OBJ: }
52+
.section .text,"ax",@progbits, unique, 4294967293
53+
f2:
54+
nop
55+
56+
.pushsection data,"a",@progbits,unique,3
57+
.long 3
58+
.popsection
59+
int3
60+
.pushsection data,"a",@progbits,unique,4
61+
.long 4
62+
.popsection
63+
.pushsection data,"a",@progbits,unique,3
64+
.long 6
65+
.popsection
66+
int3

0 commit comments

Comments
 (0)