Skip to content

Commit 5bbf01f

Browse files
committed
MC,test: Improve section symbol test
1 parent 0a2b979 commit 5bbf01f

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

llvm/test/MC/ELF/section-sym-err.s

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o 2>&1 | FileCheck %s
1+
# RUN: not llvm-mc -filetype=obj -triple x86_64 %s -o %t 2>&1 | FileCheck %s
22

33
.section foo
44
foo:
5+
# CHECK: [[#@LINE-1]]:1: error: symbol 'foo' is already defined
56

6-
// CHECK: error: symbol 'foo' is already defined
7+
x1:
8+
.section x1
9+
# CHECK: <unknown>:0: error: invalid symbol redefinition

llvm/test/MC/ELF/section-sym-err2.s

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

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

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols -r --expand-relocs - | FileCheck %s
1+
# RUN: llvm-mc -filetype=obj -triple x86_64 %s -o %t
2+
# RUN: llvm-readelf -Srs %t | FileCheck %s
23

3-
// Test that we can forward reference a section.
4+
## Test that we can forward reference a section.
45

56
mov .rodata, %rsi
6-
.section .rodata
7+
mov .debug_info, %rsi
78

8-
// CHECK:Relocations [
9-
// CHECK: Section {{.*}} .rela.text {
10-
// CHECK: Relocation {
11-
// CHECK: Offset: 0x4
12-
// CHECK: Type: R_X86_64_32S (11)
13-
// CHECK: Symbol: .rodata
14-
// CHECK: Addend: 0x0
15-
// CHECK: }
16-
// CHECK: }
17-
// CHECK:]
9+
.section .rodata,"a"
10+
.section .debug_info,"G",@progbits,11,comdat; .long x1
11+
.section .debug_info,"G",@progbits,22,comdat; .long x2
12+
.section .debug_info,"",@progbits; .long x0
1813

19-
// There is only one .rodata symbol
14+
# CHECK: Relocation section '.rela.debug_info' at offset {{.*}} contains 1
15+
# CHECK: Relocation section '.rela.debug_info' at offset {{.*}} contains 1
16+
# CHECK: Relocation section '.rela.debug_info' at offset {{.*}} contains 1
2017

21-
// CHECK:Symbols [
22-
// CHECK: Type: Section (0x3)
23-
// CHECK: Section: .rodata
24-
// CHECK-NOT: Section: .rodata
18+
# CHECK: Symbol table '.symtab' contains 8 entries:
19+
# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
20+
# CHECK-NEXT: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
21+
# CHECK-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .rodata
22+
# CHECK-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 11 .debug_info
23+
# CHECK-NEXT: 0000000000000000 0 NOTYPE LOCAL DEFAULT 5 11
24+
# CHECK-NEXT: 0000000000000000 0 NOTYPE LOCAL DEFAULT 8 22
25+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x1
26+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
27+
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x0

0 commit comments

Comments
 (0)