Write sections mostly in one pass.
[oota-llvm.git] / test / MC / ELF / section-sym.s
1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -t -r --expand-relocs | FileCheck %s
2
3 .section foo, "aG", @progbits, f1, comdat
4 .section foo, "G", @progbits, f2, comdat
5 .section bar
6 .long foo
7
8 // Test that the relocation points to the first section foo.
9
10 // The first seciton foo has index 6
11 // CHECK:      Section {
12 // CHECK:        Index:   6
13 // CHECK-NEXT:   Name:    foo (28)
14 // CHECK-NEXT:   Type:    SHT_PROGBITS (0x1)
15 // CHECK-NEXT:   Flags [ (0x202)
16 // CHECK-NEXT:     SHF_ALLOC (0x2)
17 // CHECK-NEXT:     SHF_GROUP (0x200)
18 // CHECK-NEXT:   ]
19 // CHECK-NEXT:   Address:         0x0
20 // CHECK-NEXT:   Offset:
21 // CHECK-NEXT:   Size:    0
22 // CHECK-NEXT:   Link:    0
23 // CHECK-NEXT:   Info:    0
24 // CHECK-NEXT:   AddressAlignment:        1
25 // CHECK-NEXT:   EntrySize:       0
26 // CHECK-NEXT: }
27 // CHECK:      Section {
28 // CHECK:        Index:   8
29 // CHECK-NEXT:   Name:    foo (28)
30 // CHECK-NEXT:   Type:    SHT_PROGBITS (0x1)
31 // CHECK-NEXT:   Flags [ (0x200)
32 // CHECK-NEXT:     SHF_GROUP (0x200)
33 // CHECK-NEXT:   ]
34 // CHECK-NEXT:   Address:         0x0
35 // CHECK-NEXT:   Offset:
36 // CHECK-NEXT:   Size:    0
37 // CHECK-NEXT:   Link:    0
38 // CHECK-NEXT:   Info:    0
39 // CHECK-NEXT:   AddressAlignment:        1
40 // CHECK-NEXT:   EntrySize:       0
41 // CHECK-NEXT: }
42
43 // The relocation points to symbol 6
44 // CHECK:      Relocations [
45 // CHECK-NEXT:   Section ({{.*}}) .relabar {
46 // CHECK-NEXT:     Relocation {
47 // CHECK-NEXT:       Offset:  0x0
48 // CHECK-NEXT:       Type:    R_X86_64_32 (10)
49 // CHECK-NEXT:       Symbol:  foo (6)
50 // CHECK-NEXT:       Addend:  0x0
51 // CHECK-NEXT:     }
52 // CHECK-NEXT:   }
53 // CHECK-NEXT: ]
54
55
56 // The symbol 6 corresponds section 6
57 // CHECK: Symbols [
58
59 // symbol 0
60 // CHECK-NOT: Name
61 // CHECK: Name:
62
63 // symbol 1
64 // CHECK-NOT: Name
65 // CHECK: Name:    f1
66
67 // symbol 2
68 // CHECK-NOT: Name
69 // CHECK: Name:    f2
70
71 // symbol 3
72 // CHECK-NOT: Name
73 // CHECK: Name:    .text
74
75 // symbol 4
76 // CHECK-NOT: Name
77 // CHECK: Name:    .data
78
79 // symbol 5
80 // CHECK-NOT: Name
81 // CHECK: Name:    .bss
82
83 // symbol 6
84 // CHECK-NOT: Name
85 // CHECK: Name:    foo
86 // CHECK: Section: foo (0x6)
87
88 // symbol 7
89 // CHECK-NOT: Name
90 // CHECK: Name:    foo
91 // CHECK: Section: foo (0x8)