2013-04-12 12:06:46 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s | FileCheck %s
|
2010-09-17 01:05:55 +08:00
|
|
|
|
|
|
|
// Test that these names are accepted.
|
|
|
|
|
|
|
|
.section .note.GNU-stack,"",@progbits
|
2010-11-12 23:47:08 +08:00
|
|
|
.section .note.GNU-stack2,"",%progbits
|
2010-09-17 01:05:55 +08:00
|
|
|
.section .note.GNU-,"",@progbits
|
2013-09-21 13:25:12 +08:00
|
|
|
.section -.note.GNU,"","progbits"
|
2016-03-22 19:23:15 +08:00
|
|
|
.section src/stack.c,"",@progbits
|
|
|
|
.section ~!@$%^&*()_-+={[}]|\\:<>,"",@progbits
|
2010-09-17 01:05:55 +08:00
|
|
|
|
2015-05-23 05:37:13 +08:00
|
|
|
// CHECK: Name: .note.GNU-stack
|
|
|
|
// CHECK: Name: .note.GNU-stack2
|
|
|
|
// CHECK: Name: .note.GNU-
|
|
|
|
// CHECK: Name: -.note.GNU
|
2016-03-22 19:23:15 +08:00
|
|
|
// CHECK: Name: src/stack.c
|
|
|
|
// CHECK: Name: ~!@$%^&*()_-+={[}]|\\:<>
|
2010-10-28 02:45:20 +08:00
|
|
|
|
2010-12-27 05:30:59 +08:00
|
|
|
// Test that the defaults are used
|
2010-10-28 02:45:20 +08:00
|
|
|
|
|
|
|
.section .init
|
|
|
|
.section .fini
|
2010-11-08 10:47:59 +08:00
|
|
|
.section .rodata
|
2010-11-25 23:32:56 +08:00
|
|
|
.section zed, ""
|
2010-10-28 02:45:20 +08:00
|
|
|
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .init
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_EXECINSTR
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Section {
|
2015-04-29 21:55:07 +08:00
|
|
|
// CHECK-NEXT: Index:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Name: .fini
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_EXECINSTR
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Section {
|
2015-04-29 21:55:07 +08:00
|
|
|
// CHECK-NEXT: Index:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Name: .rodata
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Section {
|
2015-04-29 21:55:07 +08:00
|
|
|
// CHECK-NEXT: Index:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Name: zed
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
2010-10-29 05:33:33 +08:00
|
|
|
|
2010-12-27 05:30:59 +08:00
|
|
|
.section .note.test,"",@note
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .note.test
|
|
|
|
// CHECK-NEXT: Type: SHT_NOTE
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
2010-12-27 05:30:59 +08:00
|
|
|
|
2010-10-29 05:33:33 +08:00
|
|
|
// Test that we can parse these
|
2010-11-12 02:13:52 +08:00
|
|
|
foo:
|
|
|
|
bar:
|
2010-10-29 05:33:33 +08:00
|
|
|
.section .text.foo,"axG",@progbits,foo,comdat
|
2010-11-12 02:13:52 +08:00
|
|
|
.section .text.bar,"axMG",@progbits,42,bar,comdat
|
2011-01-23 13:43:40 +08:00
|
|
|
|
|
|
|
// Test that the default values are not used
|
|
|
|
|
|
|
|
.section .eh_frame,"a",@unwind
|
|
|
|
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .eh_frame
|
|
|
|
// CHECK-NEXT: Type: SHT_X86_64_UNWIND
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
2011-01-25 02:02:54 +08:00
|
|
|
|
2013-09-16 03:53:20 +08:00
|
|
|
.section .excluded,"e",@progbits
|
|
|
|
|
|
|
|
// CHECK: Section {
|
2015-11-04 03:24:17 +08:00
|
|
|
// CHECK: Name: .excluded
|
2013-09-16 03:53:20 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
|
|
|
|
// CHECK-NEXT: Flags [ (0x80000000)
|
|
|
|
// CHECK-NEXT: SHF_EXCLUDE (0x80000000)
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: 0x0
|
2015-04-30 21:57:06 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2013-09-16 03:53:20 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
|
|
// CHECK-NEXT: EntrySize: 0
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2011-01-25 02:02:54 +08:00
|
|
|
// Test that we handle the strings like gas
|
|
|
|
.section bar-"foo"
|
|
|
|
.section "foo"
|
|
|
|
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
2015-05-23 05:37:13 +08:00
|
|
|
// CHECK: Name: bar-"foo"
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
2015-05-23 05:37:13 +08:00
|
|
|
// CHECK: Name: foo
|
2017-02-09 22:59:20 +08:00
|
|
|
|
|
|
|
// Test SHF_LINK_ORDER
|
|
|
|
|
|
|
|
.section .shf_metadata_target1, "a"
|
|
|
|
.quad 0
|
|
|
|
.section .shf_metadata_target2, "a", @progbits, unique, 1
|
|
|
|
.Lshf_metadata_target2_1:
|
|
|
|
.quad 0
|
|
|
|
.section .shf_metadata_target2, "a", @progbits, unique, 2
|
|
|
|
.Lshf_metadata_target2_2:
|
|
|
|
.quad 0
|
|
|
|
|
|
|
|
.section .shf_metadata1,"am",@progbits,.Lshf_metadata_target2_1
|
|
|
|
.section .shf_metadata2,"am",@progbits,.Lshf_metadata_target2_2
|
|
|
|
.section .shf_metadata3,"am",@progbits,.shf_metadata_target1
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Index: 22
|
|
|
|
// CHECK-NEXT: Name: .shf_metadata_target1
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Index: 23
|
|
|
|
// CHECK-NEXT: Name: .shf_metadata_target2
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Index: 24
|
|
|
|
// CHECK-NEXT: Name: .shf_metadata_target2
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .shf_metadata1
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_LINK_ORDER
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address:
|
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size:
|
|
|
|
// CHECK-NEXT: Link: 23
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .shf_metadata2
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_LINK_ORDER
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address:
|
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size:
|
|
|
|
// CHECK-NEXT: Link: 24
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Name: .shf_metadata3
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_LINK_ORDER
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address:
|
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size:
|
|
|
|
// CHECK-NEXT: Link: 22
|
|
|
|
// CHECK-NEXT: Info: 0
|