1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s | FileCheck %s 2 3// Test that these names are accepted. 4 5.section .note.GNU-stack,"",@progbits 6.section .note.GNU-stack2,"",%progbits 7.section .note.GNU-,"",@progbits 8.section -.note.GNU,"","progbits" 9.section src/stack.c,"",@progbits 10.section ~!@$%^&*()_-+={[}]|\\:<>,"",@progbits 11 12// CHECK: Name: .note.GNU-stack 13// CHECK: Name: .note.GNU-stack2 14// CHECK: Name: .note.GNU- 15// CHECK: Name: -.note.GNU 16// CHECK: Name: src/stack.c 17// CHECK: Name: ~!@$%^&*()_-+={[}]|\\:<> 18 19// Test that the defaults are used 20 21.section .init 22.section .fini 23.section .rodata 24.section zed, "" 25 26// CHECK: Section { 27// CHECK: Name: .init 28// CHECK-NEXT: Type: SHT_PROGBITS 29// CHECK-NEXT: Flags [ 30// CHECK-NEXT: SHF_ALLOC 31// CHECK-NEXT: SHF_EXECINSTR 32// CHECK-NEXT: ] 33// CHECK-NEXT: Address: 0x0 34// CHECK-NEXT: Offset: 35// CHECK-NEXT: Size: 0 36// CHECK-NEXT: Link: 0 37// CHECK-NEXT: Info: 0 38// CHECK-NEXT: AddressAlignment: 1 39// CHECK-NEXT: EntrySize: 0 40// CHECK-NEXT: } 41// CHECK-NEXT: Section { 42// CHECK-NEXT: Index: 43// CHECK-NEXT: Name: .fini 44// CHECK-NEXT: Type: SHT_PROGBITS 45// CHECK-NEXT: Flags [ 46// CHECK-NEXT: SHF_ALLOC 47// CHECK-NEXT: SHF_EXECINSTR 48// CHECK-NEXT: ] 49// CHECK-NEXT: Address: 0x0 50// CHECK-NEXT: Offset: 51// CHECK-NEXT: Size: 0 52// CHECK-NEXT: Link: 0 53// CHECK-NEXT: Info: 0 54// CHECK-NEXT: AddressAlignment: 1 55// CHECK-NEXT: EntrySize: 0 56// CHECK-NEXT: } 57// CHECK-NEXT: Section { 58// CHECK-NEXT: Index: 59// CHECK-NEXT: Name: .rodata 60// CHECK-NEXT: Type: SHT_PROGBITS 61// CHECK-NEXT: Flags [ 62// CHECK-NEXT: SHF_ALLOC 63// CHECK-NEXT: ] 64// CHECK-NEXT: Address: 0x0 65// CHECK-NEXT: Offset: 66// CHECK-NEXT: Size: 0 67// CHECK-NEXT: Link: 0 68// CHECK-NEXT: Info: 0 69// CHECK-NEXT: AddressAlignment: 1 70// CHECK-NEXT: EntrySize: 0 71// CHECK-NEXT: } 72// CHECK-NEXT: Section { 73// CHECK-NEXT: Index: 74// CHECK-NEXT: Name: zed 75// CHECK-NEXT: Type: SHT_PROGBITS 76// CHECK-NEXT: Flags [ 77// CHECK-NEXT: ] 78// CHECK-NEXT: Address: 0x0 79// CHECK-NEXT: Offset: 80// CHECK-NEXT: Size: 0 81// CHECK-NEXT: Link: 0 82// CHECK-NEXT: Info: 0 83// CHECK-NEXT: AddressAlignment: 1 84// CHECK-NEXT: EntrySize: 0 85// CHECK-NEXT: } 86 87.section .note.test,"",@note 88// CHECK: Section { 89// CHECK: Name: .note.test 90// CHECK-NEXT: Type: SHT_NOTE 91// CHECK-NEXT: Flags [ 92// CHECK-NEXT: ] 93// CHECK-NEXT: Address: 0x0 94// CHECK-NEXT: Offset: 95// CHECK-NEXT: Size: 0 96// CHECK-NEXT: Link: 0 97// CHECK-NEXT: Info: 0 98// CHECK-NEXT: AddressAlignment: 1 99// CHECK-NEXT: EntrySize: 0 100// CHECK-NEXT: } 101 102// Test that we can parse these 103foo: 104bar: 105.section .text.foo,"axG",@progbits,foo,comdat 106.section .text.bar,"axMG",@progbits,42,bar,comdat 107 108// Test that the default values are not used 109 110.section .eh_frame,"a",@unwind 111 112// CHECK: Section { 113// CHECK: Name: .eh_frame 114// CHECK-NEXT: Type: SHT_X86_64_UNWIND 115// CHECK-NEXT: Flags [ 116// CHECK-NEXT: SHF_ALLOC 117// CHECK-NEXT: ] 118// CHECK-NEXT: Address: 0x0 119// CHECK-NEXT: Offset: 120// CHECK-NEXT: Size: 0 121// CHECK-NEXT: Link: 0 122// CHECK-NEXT: Info: 0 123// CHECK-NEXT: AddressAlignment: 1 124// CHECK-NEXT: EntrySize: 0 125// CHECK-NEXT: } 126 127.section .excluded,"e",@progbits 128 129// CHECK: Section { 130// CHECK: Name: .excluded 131// CHECK-NEXT: Type: SHT_PROGBITS (0x1) 132// CHECK-NEXT: Flags [ (0x80000000) 133// CHECK-NEXT: SHF_EXCLUDE (0x80000000) 134// CHECK-NEXT: ] 135// CHECK-NEXT: Address: 0x0 136// CHECK-NEXT: Offset: 137// CHECK-NEXT: Size: 0 138// CHECK-NEXT: Link: 0 139// CHECK-NEXT: Info: 0 140// CHECK-NEXT: AddressAlignment: 1 141// CHECK-NEXT: EntrySize: 0 142// CHECK-NEXT: } 143 144// Test that we handle the strings like gas 145.section bar-"foo" 146.section "foo" 147 148// CHECK: Section { 149// CHECK: Name: bar-"foo" 150// CHECK: Section { 151// CHECK: Name: foo 152